RtlpHpRegisterEnvironment

__int64 __fastcall RtlpHpRegisterEnvironment(__int128 *a1){
  __int128 v1; 
  unsigned int v2; 
  union _RTL_RUN_ONCE *HeapManager; 
  int v5; 
  UINT64 v6; 
  int v7; 
  __int128 v9; 
  _DWORD a1a[4]; 
  INT64 v11; 
  int v12; 
  int v13; 
  __int64 v14; 
  v1 = *a1;
  v2 = 0;
  v13 = 0;
  v9 = v1;
  if( BYTE3(v1) )
    LODWORD(v11) = BYTE3(v1) - 1;
  else
    LODWORD(v11) = -1;
  HIDWORD(v11) = BYTE1(v1);
  v12 = BYTE2(v1);
  if( (v1 & 8) != 0 )
    v13 = 1;
  v14 = *((_QWORD *)&v1 + 1);
  *(_OWORD *)a1a = v1;
  HeapManager = RtlpHpEnvGetHeapManager(a1a);
  if( v5 )
  {
    v6 = 0x200000i64;
    if( BYTE1(v1) == 3 )
      v6 = 0x40000000i64;
    v7 = RtlpHpVaMgrCtxAllocatorReference((INT64)&HeapManager[11], (INT64)&v11, v6);
    if( v7 == -1 )
    {
      return(unsigned int)-1073741670;
    }
    else
    {
      BYTE3(v9) = v7 + 1;
      *a1 = v9;
    }
  }
  else
  {
    RtlpHpVaMgrCtxAllocatorDereference((INT64)&HeapManager[11], (UINT64 *)&v11);
  }
  return v2;
}

Referenced by:

RtlpHpHeapCreate
RtlpHpHeapDestroy