TtmpPublishDisplayRequiredPowerRequestEvents

UINT64 __fastcall TtmpPublishDisplayRequiredPowerRequestEvents(INT64 a1, INT64 a2){
  UINT64 *v2; 
  INT64 *v4; 
  INT64 v6; 
  UINT64 result; 
  UINT64 *v8; 
  UINT64 v9; 
  v2 = *(UINT64 **)(a1 + 280);
  v4 = (INT64 *)v2;
  while( 1 )
  {
    if( !v4 )
      goto LABEL_7;
    v6 = *v4;
    result = *v4 & 0x8000000000000002ui64;
    if( result == 0x8000000000000002ui64 )
    {
      result = MEMORY[0];
      v6 = *v4;
    }
    if( (v6 & 1) != 0 )
    {
LABEL_7:
      v8 = v2 + 1;
      result = *(_QWORD *)(a1 + 280);
      v9 = result + 8 * ((unsigned __int64)*(unsigned int *)(a1 + 276) >> 5);
      while( 1 )
      {
        if( (unsigned __int64)v8 >= v9 )
        {
          v6 = 0i64;
          goto LABEL_12;
        }
        result = *v8;
        if( (*v8 & 1) == 0 )
          break;
        ++v8;
      }
      v4 = (INT64 *)*v8;
      v2 = v8;
      v6 = *v8;
    }
    else
    {
      v4 = (INT64 *)v6;
    }
LABEL_12:
    if( !v6 )
      return result;
    if( *(_DWORD *)(v6 + 40) )
      TtmpWriteDisplayRequiredPowerRequestUpdatedEvent(a1, a2, v6);
  }
}

Referenced by:

TtmiWriteEnumerationEventsToQueue