RtlpHpLfhContextAllocate

NTSTATUS __stdcall RtlpHpLfhContextAllocate(UINT64 a1, UINT64 a2, INT64 a3, UINT64 a4){
  size_t v4; 
  bool v5; 
  INT64 v6; 
  unsigned int v7; 
  __int64 v9; 
  VOID *v10; 
  NTSTATUS v11; 
  int v13; 

  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 )
  {
    LOBYTE(v13) = RtlpHpLfhBucketUpdateStats(a1, v6, 1i64);
    if( !v13 )
      return -1;
  }
  LODWORD(v10) = RtlpHpLfhBucketAllocate(a1, *(_QWORD *)(a1 + 8 * v9 + 128), v4, v7);
  v11 = (int)v10;
  if( v10 && (v7 & 2) != 0 )
    memset(v10, 0i64, v4);
  return v11;
}

Referenced by:

ExAllocateHeapPool
RtlpHpAllocateHeapInternal