MiExtendPagingFiles

UINT64 __fastcall MiExtendPagingFiles(INT64 a1){
  __int64 v1; 
  unsigned __int64 v3; 
  UINT64 result; 
  unsigned int v5; 
  __int64 v6; 
  UINT64 v7; 
  BOOL v8; 
  UINT64 v9; 
  UINT64 v10; 
  unsigned __int64 v11; 
  UINT64 **v12; 
  __int64 v13; 
  UINT64 *v14; 
  unsigned int v15; 
  __int64 *v16; 
  v1 = *(_QWORD *)(a1 + 24);
  v3 = *(_QWORD *)(a1 + 32);
  result = *(unsigned __int8 *)(a1 + 76);
  v5 = *(_DWORD *)(v1 + 6936);
  if( !v5 )
    return result;
  if( (unsigned int)result < v5 )
  {
    _mm_lfence();
    v6 = *(_QWORD *)(v1 + 8 * result + 6944);
    if( *(_QWORD *)(v6 + 8) - *(_QWORD *)v6 < v3 )
      return result;
    result = MiAttemptPageFileExtension(a1, *(_QWORD *)(v1 + 8 * result + 6944), v3);
    v7 = result;
    if( result && (*(_BYTE *)(a1 + 79) & 2) != 0 )
      MiUpdatePagingFileMinimum((_MMPAGING_FILE *)v6, result);
    v8 = (*(_BYTE *)(v6 + 204) & 0x50) == 0;
    goto LABEL_24;
  }
  v8 = 1;
  if( (*(_BYTE *)(a1 + 79) & 1) == 0 )
  {
    v9 = *(_QWORD *)(v1 + 7464);
    v10 = *(_QWORD *)(v1 + 7592);
    result = v3 + v9 + *(_QWORD *)(v1 + 6256);
    if( result < v9 )
      return result;
    if( result <= v10 )
    {
      *(_QWORD *)(a1 + 40) = 1i64;
      return result;
    }
    v3 = result - v10;
  }
  v11 = 0i64;
  v12 = (UINT64 **)(v1 + 6944);
  v13 = *(unsigned int *)(v1 + 6936);
  do
  {
    v14 = *v12;
    if( (*((_BYTE *)*v12 + 204) & 0x50) == 0 )
    {
      result = *v14;
      v11 += v14[1] - *v14;
    }
    ++v12;
    --v13;
  }
  while( v13 );
  if( v11 >= v3 )
  {
    v7 = 0i64;
    v15 = 0;
    v16 = (__int64 *)(v1 + 6944);
    do
    {
      if( (*(_BYTE *)(*v16 + 204) & 0x50) == 0 )
      {
        result = MiAttemptPageFileExtension(a1, *v16, v3 - v7);
        v7 += result;
        if( v7 >= v3 )
          break;
      }
      ++v15;
      ++v16;
    }
    while( v15 < v5 );
LABEL_24:
    if( v7 )
    {
      *(_QWORD *)(a1 + 40) = v7;
      if( v8 )
        return MiIncreaseCommitLimits((_MI_PARTITION *)v1, v7, 0i64, 0i64, 0i64);
    }
  }
  return result;
}

Referenced by:

MiProcessDereferenceList