RtlpDynamicLookasideRebalance

NTSTATUS __stdcall RtlpDynamicLookasideRebalance(INT64 *a1){
  UINT64 v1; 
  unsigned int v2; 
  char *v4; 
  INT64 v5; 
  char *v6; 
  unsigned __int8 v7; 
  unsigned int v8; 
  int v9; 
  NTSTATUS result; 
  INT64 v11; 
  NTSTATUS *v12; 
  __int64 v13; 
  unsigned int v14; 
  INT64 *Base[64]; 

  v1 = *((unsigned int *)a1 + 2);
  v2 = 0;
  if( (_DWORD)v1 )
  {
    v4 = (char *)Base + 4;
    v5 = *a1;
    v6 = (char *)a1 + 84;
    do
    {
      v7 = _bittest64(&v5, v2);
      *((_DWORD *)v4 - 1) = v2;
      v8 = -1;
      v6 += 64;
      v4 += 8;
      v9 = -1;
      if( *((_DWORD *)v6 - 16) + (unsigned int)v7 - *((_DWORD *)v6 - 12) >= v7 )
        v8 = *((_DWORD *)v6 - 16) + v7 - *((_DWORD *)v6 - 12);
      if( v8 + *((_DWORD *)v6 - 14) - *((_DWORD *)v6 - 10) >= v8 )
        v9 = v8 + *((_DWORD *)v6 - 14) - *((_DWORD *)v6 - 10);
      ++v2;
      *((_DWORD *)v4 - 2) = v9;
    }
    while( v2 < (unsigned int)v1 );
  }
  qsort((UINT64)Base, v1, 8ui64, (INT64)RtlpDynamicLookasideBucketCompare, Base[0], (UINT64)Base[1], (UINT64)Base[2]);
  result = *((_DWORD *)a1 + 3);
  v11 = 0i64;
  if( result )
  {
    v12 = (NTSTATUS *)Base;
    v13 = (unsigned int)result;
    do
    {
      if( (unsigned int)v12[1] >= 0x19 )
      {
        result = *v12;
        v11 |= 1i64 << *v12;
      }
      v12 += 2;
      --v13;
    }
    while( v13 );
  }
  v14 = 0;
  for( *a1 = v11; v14 < *((_DWORD *)a1 + 2); ++v14 )
    result = RtlpLookasideAdjustDepth((INT64)&a1[8 * v14 + 8], !_bittest64(&v11, v14));
  return result;
}

Referenced by:

ExpScanSystemLookasideList