RtlpHpSegSizeInternal

UINT64 __fastcall RtlpHpSegSizeInternal(INT64 a1, INT64 a2, UINT64 a3, INT64 a4, INT64 *a5){
  unsigned __int64 v5; 
  int v8; 
  int v10[10]; 
  v5 = (a2 & *(_QWORD *)a1) + ((a2 - (a2 & *(_QWORD *)a1)) >> 5 << *(_BYTE *)(a1 + 8));
  if( a3 <= v5 )
  {
    if( a5 )
    {
      v8 = *(_WORD *)(a2 + 8) & 1;
      if( v8 )
        _InterlockedOr(v10, 0);
      *(_DWORD *)a5 = v8;
    }
    return((unsigned __int64)*(unsigned __int8 *)(a2 + 31) << *(_BYTE *)(a1 + 8)) - *(unsigned int *)(a2 + 4);
  }
  else if( (*(_BYTE *)(a2 + 24) & 0xC) == 8 )
  {
    return RtlpHpLfhSubsegmentSizeBlock(*(_QWORD *)(a1 + 24), v5, a3, a5);
  }
  else
  {
    return RtlpHpVsChunkSize(*(_QWORD *)(a1 + 32), a3, a3, a5);
  }
}

Referenced by:

RtlpHpSizeHeapInternal