HalpInitializeProfiling

VOID __stdcall HalpInitializeProfiling(INT64 Number){
  const INT8 *v1; 
  int v2; 
  __int64 v3; 
  const INT8 *v4; 
  __int32 v5; 
  __int32 v6; 
  __int64 v7; 
  char Str1[16]; 
  INT32 v9[4]; 
  v2 = Number;
  *(_OWORD *)Str1 = 0i64;
  *(_OWORD *)v9 = 0i64;
  if( (HalpFeatureBits & 1) == 0 )
    goto LABEL_17;
  if( !(_DWORD)Number )
  {
    v3 = __cpuid(0, 0);
    *(_DWORD *)&Str1[8] = EDX(v3);
    *(_DWORD *)&Str1[12] = ECX(v3);
    if( !(unsigned int)strncmp(&Str1[4], (size_t)"AuthenticAMD", 0xCui64, v1, (va_list)__PAIR64__(EBX(v3), EAX(v3))) )
    {
      HalpProfileInterface[0] = (__int64(__fastcall *)())Amd64ProfileInterface;
    }
    else if( *(_DWORD *)Str1 >= 0xAu
           && !(unsigned int)strncmp(&Str1[4], (size_t)"GenuineIntel", 0xCui64, v4, *(va_list *)Str1) )
    {
      v7 = __cpuid(10, 0);
      v5 = EAX(v7);
      v6 = EBX(v7);
      *(_DWORD *)&Str1[8] = ECX(v7);
      *(_DWORD *)Str1 = v5;
      *(_DWORD *)&Str1[4] = v6;
      *(_DWORD *)&Str1[12] = EDX(v7);
      if( (_BYTE)v5 )
      {
        if( (v5 & 0xFF000000) != 0 && (v6 & 1) == 0 )
        {
          HalpProfileInterface[0] = (__int64(__fastcall *)())EmonProfileInterface;
          if( (unsigned __int8)v5 >= 4u )
            HalpProfileFeatures |= 1u;
        }
      }
    }
    HalpPerfInterruptHandler = 0i64;
    if( !HalpIsMicrosoftCompatibleHvLoaded() || (HalpHvCpuid(1073741827i64, v9), (v9[3] & 4) != 0) )
    {
LABEL_13:
      HalpLbrInitialize();
      goto LABEL_3;
    }
    HalpProfileInterface[0] = (__int64(__fastcall *)())DefaultProfileInterface;
LABEL_17:
    if( v2 )
      goto LABEL_3;
    goto LABEL_13;
  }
LABEL_3:
  (*(void(__fastcall **)(INT64))HalpProfileInterface[0])(Number);
}

Referenced by:

HalpHwPerfCntInitSystem