RtlpHpVaMgrFree

UINT64 __stdcall RtlpHpVaMgrFree(INT64 a1, UINT64 a2){
  UINT64 v3; 
  unsigned __int16 v4; 
  UINT64 v5; 
  BOOL v6; 
  UINT64 v7; 

  v3 = RtlpHpVaMgrRangeCoalesce(a1, a2);
  v4 = *(_WORD *)(v3 + 24);
  if( v4 != *(_WORD *)(a1 + 40) )
  {
    v5 = *(_QWORD *)(a1 + 8);
    if( (*(_BYTE *)(a1 + 16) & 1) != 0 && v5 )
      v5 ^= a1 + 8;
    v6 = 0;
    if( v5 )
    {
      while( 1 )
      {
        if( v4 < *(_WORD *)(v5 + 24) )
        {
          v7 = *(_QWORD *)v5;
          if( (*(_BYTE *)(a1 + 16) & 1) != 0 )
          {
            if( !v7 )
              break;
            v7 ^= v5;
          }
          if( !v7 )
            break;
        }
        else
        {
          v7 = *(_QWORD *)(v5 + 8);
          if( (*(_BYTE *)(a1 + 16) & 1) != 0 )
          {
            if( !v7 )
              goto LABEL_17;
            v7 ^= v5;
          }
          if( !v7 )
          {
LABEL_17:
            v6 = 1;
            break;
          }
        }
        v5 = v7;
      }
    }
    RtlRbInsertNodeEx((UINT64 *)(a1 + 8), v5, v6, v3);
    return 0i64;
  }
  return v3;
}

Referenced by:

RtlpHpVaMgrAlloc
RtlpHpVaMgrCtxFree