RtlpLookasideAdjustDepth

NTSTATUS __fastcall RtlpLookasideAdjustDepth(INT64 a1, INT64 a2){
  int v2; 
  int v4; 
  unsigned int v5; 
  unsigned int v6; 
  NTSTATUS result; 
  unsigned int v8; 
  NTSTATUS v9; 
  unsigned int v10; 

  v2 = *(_DWORD *)(a1 + 20);
  LOWORD(v4) = 0;
  v5 = v2 - *(_DWORD *)(a1 + 36);
  *(_DWORD *)(a1 + 36) = v2;
  v6 = *(_DWORD *)(a1 + 24) - *(_DWORD *)(a1 + 40);
  *(_DWORD *)(a1 + 40) = *(_DWORD *)(a1 + 24);
  result = *(_DWORD *)(a1 + 28);
  *(_DWORD *)(a1 + 44) = result;
  if( (_DWORD)a2 )
    goto LABEL_2;
  v4 = *(unsigned __int16 *)(a1 + 16);
  v8 = v5;
  if( v6 <= v5 )
    v8 = v6;
  v9 = *(unsigned __int16 *)(a1 + 18);
  if( !v5 )
    v5 = 1;
  result = 1000 * v8 / v5;
  if( v5 < 0x19 )
  {
    v4 -= 10;
LABEL_10:
    if( v4 <= 4 )
      LOWORD(v4) = 4;
    goto LABEL_2;
  }
  if( (unsigned int)result < 5 )
  {
    --v4;
    goto LABEL_10;
  }
  v10 = result * (v9 - v4) / 0x7D0u + 5;
  if( v10 >= 0x1E )
    v10 = 30;
  result = v10 + v4;
  LOWORD(v4) = v10 + v4;
  if( result >= v9 )
    LOWORD(v4) = *(_WORD *)(a1 + 18);
LABEL_2:
  *(_WORD *)(a1 + 16) = v4;
  return result;
}

Referenced by:

RtlpDynamicLookasideRebalance