TtmpFindPowerRequestEntryById

BOOL __stdcall TtmpFindPowerRequestEntryById(INT64 a1, INT64 a2, INT64 *a3){
  INT64 v3; 
  INT64 v4; 
  INT64 v5; 
  __int64 v8; 
  __int64 v9; 
  int v10; 
  int v11; 
  __int64 v13; 

  v3 = 0i64;
  v4 = (int)a2;
  v5 = 0i64;
  while( 1 )
  {
    v8 = -1i64 << (*(_BYTE *)(a1 + 276) & 0x1F);
    v9 = v8 & v4;
    if( v5 )
      goto LABEL_5;
    v10 = *(_DWORD *)(a1 + 276) >> 5;
    if( !v10 )
      break;
    v13 = v8 & v4;
    v5 = *(_QWORD *)(a1 + 280)
       + 8i64
       * ((37
         * (BYTE6(v13)
          + 37
          * (BYTE5(v13)
           + 37
           * (BYTE4(v13)
            + 37 * (BYTE3(v13) + 37 * (BYTE2(v13) + 37 * (BYTE1(v13) + 37 * ((unsigned __int8)v9 + 11623883)))))))
         + HIBYTE(v13)) & (unsigned int)(v10 - 1));
LABEL_5:
    while( 1 )
    {
      v5 = *(_QWORD *)v5;
      if( (v5 & 1) != 0 )
        break;
      if( v9 == (v8 & *(_QWORD *)(v5 + 8)) )
        goto LABEL_9;
    }
    v5 = 0i64;
LABEL_9:
    if( !v5 )
      goto LABEL_14;
    LOBYTE(v11) = TtmpPowerRequestEntryComparator(v5, v4);
    if( v11 )
      goto LABEL_13;
  }
  v5 = 0i64;
LABEL_13:
  if( !v5 )
  {
LABEL_14:
    TtmiLogError((INT8 *)"TtmpFindPowerRequestEntryById", 0x191ui64, 3221226021i64, 0xFFFFFFFFi64);
    goto LABEL_16;
  }
  v3 = v5;
LABEL_16:
  if( a3 )
    *a3 = v3;
  return v3 != 0;
}

Referenced by:

TtmiSetDisplayPowerRequest
TtmpSetDisplayRequestEnded
TtmpUpdateDisplayRequiredPowerRequest
TtmpUpdatePowerRequestAttribute