RtlHpHeapManagerStart

INT64 __fastcall RtlHpHeapManagerStart(union _RTL_RUN_ONCE *a1, INT64 a2, INT64 a3, UINT64 a4, CHAR a5){
  unsigned int v5; 
  INT64 result; 
  unsigned int v10; 
  char v11; 
  __int128 Parameter; 
  v5 = a2;
  a1[1].Value = a3;
  result = RtlCSparseBitmapStart((INT64)&a1[2], 2 * (a4 >> 20), a2, (_DWORD)a2 == 1);
  if( (int)result >= 0 )
  {
    result = RtlpHpVaMgrCtxStart((INT64)&a1[11], v5, a3, a4 - 1);
    if( (int)result >= 0 )
    {
      if( (a5 & 2) != 0 )
      {
        Parameter = 0i64;
        *(_WORD *)((char *)&Parameter + 1) = 1;
        LOBYTE(Parameter) = (2 * (v5 & 3)) | 1;
        RtlpHpMetadataHeapCreate(a1 + 1814, &Parameter, 0i64);
      }
      if( (a5 & 1) != 0 )
      {
        v10 = 0;
        v11 = 2 * (v5 & 3);
        while( 1 )
        {
          Parameter = 0i64;
          *(_WORD *)((char *)&Parameter + 1) = (unsigned __int8)v10;
          LOBYTE(Parameter) = v11 | (v10 != 0);
          LODWORD(result) = RtlpHpMetadataHeapStart(&a1[2 * v10 + 1811], &Parameter);
          if( (int)result < 0 )
            break;
          if( ++v10 >= 3 )
            return 0i64;
        }
      }
      else
      {
        return 0i64;
      }
    }
  }
  return result;
}

Referenced by:

ExInitializeSessionHeapManager
RtlHpKInitializeHeapManager