PopVerifySystemPowerState

VOID __stdcall PopVerifySystemPowerState(_SYSTEM_POWER_STATE *PowerState, POP_SUBSTITUTION_POLICY SubstitutionPolicy){
  POP_SUBSTITUTION_POLICY v2; 
  _SYSTEM_POWER_STATE *v3; 
  _SYSTEM_POWER_STATE v4; 
  char v5; 
  char *v6; 
  _BYTE *v7; 
  _BYTE *v9; 

  v2 = SubstitutionPolicy;
  v3 = PowerState;
  if( PowerState )
  {
    v4 = *PowerState;
    if( *(int *)PowerState <= -1 || (unsigned int)(v4 - 2) <= 3 )
    {
      v5 = 1;
      if( SubstitutionPolicy >= SubstituteLightenSleep )
      {
        v6 = (char *)&stru_140C23628 + 2072;
        if( SubstitutionPolicy > SubstituteLightestOverallDownwardBounded )
        {
          if( SubstitutionPolicy != SubstituteDeepenSleep )
            goto LABEL_8;
        }
        else
        {
          if( v4 == PowerSystemHibernate )
          {
            if( PopIsHiberbootSupported((INT64)&stru_140C23628 + 2072) )
              goto LABEL_8;
            if( PopIsHibernateSupported(v7) )
              goto LABEL_8;
            v4 = PowerSystemSleeping3;
          }
          if( v4 == PowerSystemSleeping3 )
          {
            if( *(&stru_140C23628 + 2077) )
              goto LABEL_8;
            v4 = PowerSystemSleeping2;
          }
          if( v4 == PowerSystemSleeping2 )
          {
            if( *(&stru_140C23628 + 2076) )
              goto LABEL_8;
            v4 = PowerSystemSleeping1;
          }
          if( v4 == PowerSystemSleeping1 )
          {
            if( *(&stru_140C23628 + 2075) )
              goto LABEL_8;
            v4 = PowerSystemWorking;
          }
          if( v4 != PowerSystemWorking || v2 != SubstituteLightestOverallDownwardBounded )
            goto LABEL_8;
          v5 = 0;
          v4 = PowerSystemSleeping1;
        }
        if( v4 == PowerSystemSleeping1 )
        {
          if( *(&stru_140C23628 + 2075) )
            goto LABEL_8;
          v4 = PowerSystemSleeping2;
        }
        if( v4 == PowerSystemSleeping2 )
        {
          if( *(&stru_140C23628 + 2076) )
            goto LABEL_8;
          v4 = PowerSystemSleeping3;
        }
        if( v4 == PowerSystemSleeping3 )
        {
          if( *(&stru_140C23628 + 2077) )
            goto LABEL_8;
          v4 = PowerSystemHibernate;
        }
        if( v4 == PowerSystemHibernate && (!v5 || !PopIsHiberbootSupported((INT64)v6) && !PopIsHibernateSupported(v9)) )
          v4 = PowerSystemWorking;
      }
LABEL_8:
      *v3 = v4;
    }
  }
}

Referenced by:

PdcPoVerifyPowerState
PopActionRetrieveInitialState
PopAdvanceSystemPowerState
PopExecutePowerAction
PopVerifySystemPowerPolicy