HvpExpandMap

NTSTATUS __stdcall HvpExpandMap(INT8 *first, INT8 *last, UINT64 count){
  unsigned int v3; 
  NTSTATUS v4; 
  __int64 v5; 
  unsigned int v6; 
  unsigned int v7; 
  __int64 v9; 
  unsigned int v10; 
  unsigned int v11; 
  unsigned int v12; 
  INT64 v14; 
  INT64 v15; 
  INT8 *v16; 
  __int64 v17; 
  INT64 v18; 
  _QWORD *v19; 
  v4 = 0;
  v5 = (unsigned int)last;
  v6 = v3;
  v7 = count;
  if( !(_DWORD)count )
  {
    v14 = (*((__int64(__fastcall **)(__int64, _QWORD, __int64))first + 3))(12288i64, 0i64, 925977923i64);
    v15 = v14;
    if( !v14 )
      return -1073741801;
    memset(v14, 0i64);
    v16 = &first[632 * v5 + 288];
    *(_QWORD *)&first[632 * v5 + 280] = v16;
    *(_QWORD *)v16 = v15;
  }
  v9 = v5;
  if( v7 )
    v10 = (v7 >> 12) - 1;
  else
    v10 = 0;
  v11 = v10 >> 9;
  v12 = ((v6 >> 12) - 1) >> 9;
  if( v12 > v11 )
  {
    if( v11 || (v17 = 632 * v5, *(INT8 **)&first[632 * v9 + 280] != &first[632 * v9 + 288]) )
    {
LABEL_13:
      if( !HvpAllocateMap((INT64)first, *(_QWORD *)&first[632 * v9 + 280], v11 + 1, v12) )
      {
        v4 = -1073741801;
        HvpFreeMap((INT64)first, *(_QWORD *)&first[632 * v9 + 280], v11 + 1, v12);
      }
      return v4;
    }
    v18 = (*((__int64(__fastcall **)(__int64, _QWORD, __int64))first + 3))(0x2000i64, 0i64, 942755139i64);
    v19 = (_QWORD *)v18;
    if( v18 )
    {
      memset(v18, 0i64);
      *v19 = *(_QWORD *)&first[v17 + 288];
      *(_QWORD *)&first[v17 + 280] = v19;
      goto LABEL_13;
    }
    return -1073741801;
  }
  return v4;
}

Referenced by:

HvpAddBin
HvpPerformLogFileRecovery