HvpEnlistFreeCells

INT64 __fastcall HvpEnlistFreeCells(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
  char v4; 
  unsigned int v5; 
  unsigned int v6; 
  int v7; 
  int *v10; 
  int v11; 
  INT64 v13; 
  INT64 v14; 
  int v15; 
  v15 = a4;
  *(_DWORD *)(a1 + 144) += 32;
  v4 = 0;
  v5 = *(_DWORD *)(a2 + 8);
  v6 = 32;
  v7 = a3;
  v14 = *(_QWORD *)(a1 + 56);
  if( v5 <= 0x20 )
    return 0i64;
  do
  {
    v10 = (int *)(a2 + v6);
    v11 = *v10;
    if( *v10 < 0 )
      v11 = -v11;
    if( v11 + v6 < v6 || v11 + v6 > v5 || (v11 & 7) != 0 || !v11 )
    {
      if( (a4 & 0x20000) != 0 || !BYTE3(NlsMbCodePageTag) && (CmpBootType & 6) == 0 )
      {
        LODWORD(v13) = 0;
        SetFailureLocation(v14, 0i64, 26i64, 3221225804i64, v13);
        return 3221225804i64;
      }
      v11 = v5 - v6;
      if( !HvpMarkDirty(a1, v6 + v7, v5 - v6) )
      {
        LODWORD(v13) = 16;
        SetFailureLocation(v14, 0i64, 26i64, 3221225626i64, v13);
        return 3221225626i64;
      }
      memset(a2 + v6, 0i64);
      *v10 = v11;
      v4 = 1;
      LODWORD(v13) = 32;
      *(_DWORD *)(*(_QWORD *)(a1 + 64) + 4088i64) |= 4u;
      SetFailureLocation(v14, 1i64, 26i64, 1073741833i64, v13);
    }
    else if( *v10 < 0 )
    {
      *(_DWORD *)(a1 + 152) += v11;
      goto LABEL_10;
    }
    *(_DWORD *)(a1 + 148) += v11;
    HvpEnlistFreeCell(a1);
    LODWORD(a4) = v15;
LABEL_10:
    v5 = *(_DWORD *)(a2 + 8);
    v6 += v11;
  }
  while( v6 < v5 );
  if( !v4 )
    return 0i64;
  return 1073741833i64;
}

Referenced by:

HvpBuildMapForMemoryBackedHive
HvpRemapAndEnlistHiveBins