PopPepGetComponentPreferedIdleState

__int64 __fastcall PopPepGetComponentPreferedIdleState(_DWORD *a1){
  int v1; 
  unsigned int v3; 
  unsigned int v4; 
  unsigned int *v6; 
  __int64 v7; 
  unsigned int v8; 
  unsigned int v9; 
  int v10; 
  bool v11; 
  int v12; 

  v1 = 0;
  v3 = a1[47] - 1;
  if( v3 >= a1[41] )
    v3 = a1[41];
  v4 = v3;
  if( v3 )
  {
    v6 = a1 + 38;
    v7 = 6i64;
    do
    {
      v8 = *v6;
      v9 = *v6++;
      if( v8 >= v4 )
        v9 = v4;
      v4 = v9;
      v10 = v1 + 1;
      if( v8 != v3 )
        v10 = v1;
      v1 = v10;
      --v7;
    }
    while( v7 );
    v11 = 0;
    if( v10 == 5 )
      v11 = a1[40] < v3;
    v12 = a1[1];
    if( (v12 & 4) == 0 && v11 )
    {
      a1[1] = v12 | 4;
      if( _InterlockedIncrement((_DWORD *)&PopIrpWorkerControlEvent + 677) == 1 )
        PopPepArmIdleTimer(0);
    }
    else if( (a1[1] & 4) != 0 && !v11 )
    {
      a1[1] = v12 & 0xFFFFFFFB;
      _InterlockedDecrement((_DWORD *)&PopIrpWorkerControlEvent + 677);
    }
  }
  return v4;
}

Referenced by:

PopPepUpdateIdleState