RtlpHpLfhContextAllocate

INT64 __fastcall RtlpHpLfhContextAllocate(UINT64 a1, UINT64 a2, INT64 a3, UINT64 a4){
  unsigned int v4; 
  bool v5; 
  INT64 v6; 
  unsigned int v7; 
  __int64 v9; 
  INT64 v10; 
  INT64 v11; 
  v4 = a2;
  v5 = (_DWORD)a2 == (_DWORD)a3;
  v6 = (unsigned int)(a3 + 2);
  v7 = a4;
  if( v5 )
    v6 = (unsigned int)a3;
  v9 = *((unsigned __int8 *)RtlpLfhBucketIndexMap + ((unsigned __int64)(unsigned int)(v6 + 15) >> 4));
  if( (*(_QWORD *)(a1 + 8 * v9 + 128) & 1) != 0 && !RtlpHpLfhBucketUpdateStats(a1, v6, 1i64) )
    return -1i64;
  v10 = RtlpHpLfhBucketAllocate(a1, *(_QWORD *)(a1 + 8 * v9 + 128), v4, v7);
  v11 = v10;
  if( v10 && (v7 & 2) != 0 )
    memset(v10, 0i64);
  return v11;
}

Referenced by:

ExAllocateHeapPool
RtlpHpAllocateHeapInternal