HalpTimerFindIdealPerformanceCounterSource

ULONG_PTR *HalpTimerFindIdealPerformanceCounterSource(){
  int v0; 
  ULONG_PTR *result; 
  if( HalpTimerPlatformSourceForced )
    goto LABEL_9;
  if( (unsigned __int8)HalpIsHvPresent() )
    goto LABEL_22;
  v0 = 0x2000;
  if( (unsigned __int8)HalpTimerDeepestIdleState > 1u )
    v0 = 24576;
  result = HalpFindTimer(5, 3, v0, 0, 0);
  if( !result )
  {
    result = HalpFindTimer(10, 3, v0, 0, 0);
    if( !result )
    {
LABEL_22:
      if( !*(_BYTE *)HalpHvCpuManager || qword_140C4A148 || (result = HalpFindTimer(3, 2, 24576, 0, 0)) == 0i64 )
      {
        result = HalpFindTimer(8, 2, 0, 0, 0);
        if( !result )
        {
LABEL_9:
          result = HalpFindTimer(11, 2, 24576, 0, 0);
          if( !result )
          {
            result = HalpFindTimer(3, 2, 24576, 0, 0);
            if( !result )
            {
              result = HalpFindTimer(6, 2, 24576, 0, 0);
              if( !result )
              {
                result = HalpFindTimer(1, 2, 24576, 0, 0);
                if( !result )
                {
                  if( (unsigned __int8)HalpIsHvPresent() )
                    return 0i64;
                  result = HalpFindTimer(0, 2, 24576, 0, 0);
                  if( !result )
                    return 0i64;
                }
              }
            }
          }
        }
      }
    }
  }
  return result;
}

Referenced by:

HalpTimerSelectRoles