RtlpHpAllocateHeapInternal

INT64 __fastcall RtlpHpAllocateHeapInternal(INT64 a1, UINT64 a2, UINT64 a3, UINT64 a4, INT64 a5){
  unsigned int v5; 
  unsigned __int64 v6; 
  UINT64 v7; 
  int v9; 
  INT64 v10; 
  UINT64 v12; 
  UINT64 v13; 
  v5 = a4;
  v6 = a3;
  v7 = a2;
  v9 = 3;
  if( a3 > (unsigned int)*(unsigned __int16 *)(a1 + 892) - 16
    || (v10 = RtlpHpLfhContextAllocate(a1 + 832, a2, a3, a4), a3 = (unsigned int)v6, a2 = (unsigned int)v7, v10 == -1) )
  {
    if( v6 > 0x20000 )
    {
      if( v6 > *(unsigned int *)(a1 + 464) )
      {
        v12 = RtlpHpLargeAlloc(a1, v7, v6, v5);
      }
      else
      {
        LODWORD(v13) = v5;
        v12 = RtlpHpSegAlloc(a1 + (*(unsigned int *)(a1 + 272) < v6 ? 448i64 : 256i64), v7, v6, v6, v13);
      }
    }
    else
    {
      v12 = RtlpHpVsContextAllocate(a1 + 640, a2, a3, v5);
    }
    v10 = v12;
  }
  else
  {
    v9 = 2;
  }
  *(_DWORD *)a5 = v9;
  return v10;
}

Referenced by:

RtlpHpAllocateHeap