RtlpHpSegSubAllocate

UINT64 __fastcall RtlpHpSegSubAllocate(PVOID ThreadHandle, PVOID ThreadInformation, int a3, _DWORD *a4, __int64 a5){
  unsigned int v5; 
  int v6; 
  UINT64 v9; 
  UINT64 v10; 
  UINT64 v11; 
  UINT64 *ReturnLength; 
  UINT64 *ReturnLengtha; 

  v5 = (unsigned int)ThreadInformation;
  v6 = a3 | 4;
  if( (unsigned int)ThreadInformation < 0x10000 )
    v6 = a3;
  LODWORD(ReturnLength) = v6;
  v9 = RtlpHpSegAlloc(
         (UINT16 *)ThreadHandle,
         (size_t)ThreadInformation,
         (unsigned int)ThreadInformation,
         0i64,
         (UINT64)ReturnLength);
  *a4 = 0;
  v11 = v9;
  *(_DWORD *)a5 = 0;
  if( v9
    && ((RtlpHpLfhPerfFlags & 0x80u) != 0 && BYTE1(*(_OWORD *)((char *)ThreadHandle + 40)) >= 2u
     || (RtlpHpLfhPerfFlags & 0x100) != 0
     && (*((_BYTE *)ThreadHandle + 13) & 7) != 0
     && RtlpHpSegPageRangeComputeLargePageCost(ThreadHandle, (_THREADINFOCLASS)v9, (PVOID)v5, v10, ReturnLengtha) <= 1) )
  {
    *a4 |= 1u;
  }
  return v11;
}

Referenced by:

RtlpHpSegLfhAllocate
RtlpHpSegVsAllocate