HalpSelectFeasibleLowPowerState

NTSTATUS __stdcall HalpSelectFeasibleLowPowerState(
        _MEMORY_POWER_NODE *Mpn,
        UINT8 *DeepPowerStateValue,
        POWER_STATE_CHARACTERISTICS *PowerStateCharacteristics){
  __int64 v3; 
  char v4; 
  __int64 v5; 
  unsigned __int16 v6; 
  NTSTATUS v8; 
  ULONG PowerStateCount; 
  unsigned __int8 v10; 
  MEMORY_POWER_STATE *p_MpState; 
  __int64 PowerStateInformationIndex; 
  __int64 v13; 
  char v14; 
  UINT8 v15; 
  UCHAR PowerStateValue; 
  v4 = 0;
  v5 = v3;
  v6 = (unsigned __int16)PowerStateCharacteristics;
  v8 = 1;
  if( (Mpn->Flag & 3) != 3 )
    goto LABEL_17;
  PowerStateCount = Mpn->PowerStateCount;
  if( PowerStateCount <= 1 )
    goto LABEL_17;
  *DeepPowerStateValue = 0;
  v10 = 0;
  p_MpState = &Mpn->MpState;
  while( 1 )
  {
    PowerStateInformationIndex = p_MpState->PowerStateInformationIndex;
    if( (unsigned __int16)PowerStateInformationIndex >= v6 )
      break;
    v13 = 28 * PowerStateInformationIndex;
    v14 = *(_BYTE *)(28 * PowerStateInformationIndex + v5);
    if( (v14 & 0x3F) == 1
      && (v14 & 0xC0) == 64
      && (*(_BYTE *)(v13 + v5 + 1) & 5) == 1
      && *(_QWORD *)(v13 + v5 + 12) <= 0x3B9ACA00ui64 )
    {
      v15 = *DeepPowerStateValue;
      PowerStateValue = p_MpState->PowerStateValue;
      if( *DeepPowerStateValue <= p_MpState->PowerStateValue )
        v15 = p_MpState->PowerStateValue;
      *DeepPowerStateValue = v15;
      if( !PowerStateValue )
        v4 = 1;
    }
    ++v10;
    ++p_MpState;
    if( v10 >= PowerStateCount )
      goto LABEL_16;
  }
  v8 = 0;
LABEL_16:
  if( !v4 )
LABEL_17:
    *DeepPowerStateValue = 0;
  return v8;
}

Referenced by:

HalpChannelInitializeStaticConfiguration