HalpLbrInitialize

VOID __stdcall HalpLbrInitialize(){
  unsigned __int8 v0; 
  unsigned __int64 v1; 
  int v2; 
  int v3; 
  UINT8 v4; 
  CHAR v5; 
  char v6[6]; 
  _HV_X64_HYPERVISOR_FEATURES HvFeaturesOut; 

  v5 = 0;
  v6[0] = 0;
  v4 = 0;
  *(&CmpDummyThreadEvent + 3844) = 0;
  HvFeaturesOut = 0i64;
  if( (dword_140C4A10C & 1) == 0 )
    return;
  if( HalpIsHvPresent() )
  {
    HviGetHypervisorFeatures(&HvFeaturesOut);
    if( (HvFeaturesOut._bf_8 & 0x400000000000000i64) == 0 )
      return;
  }
  if( !HalpGetCpuInfo(&v5, 0i64, (UINT8 *)v6, &v4) || v4 != 2 )
    return;
  if( v5 == 6 )
  {
    if( (unsigned __int8)v6[0] <= 0x56u )
    {
      if( v6[0] == 86 || v6[0] == 60 || v6[0] == 61 || v6[0] == 63 )
        goto LABEL_9;
      if( (unsigned __int8)v6[0] <= 0x44u )
        goto LABEL_28;
      if( (unsigned __int8)v6[0] <= 0x46u || v6[0] == 71 )
        goto LABEL_9;
      if( v6[0] != 78 )
      {
        if( v6[0] != 79 )
        {
          if( v6[0] != 85 )
            goto LABEL_28;
          goto LABEL_27;
        }
LABEL_9:
        *(&CmpDummyThreadEvent + 958) = 16;
        goto LABEL_10;
      }
LABEL_27:
      *(&CmpDummyThreadEvent + 958) = 32;
      goto LABEL_28;
    }
    if( v6[0] == 94 )
      goto LABEL_27;
    if( (unsigned __int8)v6[0] > 0x65u )
    {
      if( (unsigned __int8)v6[0] <= 0x67u )
        goto LABEL_39;
      if( (unsigned __int8)v6[0] > 0x7Cu )
      {
        if( (unsigned __int8)v6[0] <= 0x7Eu )
          goto LABEL_39;
        switch( (unsigned __int8)v6[0] )
        {
          case 0x8Eu:
            goto LABEL_27;
          case 0x9Du:
            goto LABEL_39;
          case 0x9Eu:
            goto LABEL_27;
          case 0x9Fu:
LABEL_39:
            *(&CmpDummyThreadEvent + 958) = 32;
            goto LABEL_10;
        }
      }
    }
  }
LABEL_28:
  if( *(&CmpDummyThreadEvent + 958) )
  {
LABEL_10:
    v0 = EAX(__cpuid(10, 0));
    if( !v0 )
      return;
    HalpLbrIsFreezeLegacy = v0 <= 3u;
    if( (ECX(__cpuid(1, 0)) & 0x8000) == 0 )
      goto LABEL_15;
    v1 = __readmsr(0x345u);
    v2 = (v1 & 0x3F) - 3;
    if( v2 )
    {
      v3 = v2 - 1;
      if( !v3 )
      {
        HalpLbrMostSignificantFromAddrBit = 60;
LABEL_15:
        *(&CmpDummyThreadEvent + 3844) = 1;
        off_140C00988[0] = (__int64(__fastcall *)())HalpLbrCaptureStack;
        off_140C00990[0] = (__int64(__fastcall *)())HalpLbrClearStack;
        off_140C00998[0] = (__int64(__fastcall *)())HalpLbrConfigureRecording;
        off_140C009A0[0] = (__int64(__fastcall *)())HalpLbrGetInformation;
        off_140C009A8[0] = (__int64(__fastcall *)())HalpLbrResumeRecording;
        off_140C009B0[0] = (__int64(__fastcall *)())HalpLbrStartRecording;
        off_140C009B8[0] = (__int64(__fastcall *)())HalpLbrStopRecording;
        return;
      }
      if( v3 != 2 )
        goto LABEL_15;
      HalpLbrMostSignificantToAddrBit = 47;
    }
    HalpLbrMostSignificantFromAddrBit = 62;
    goto LABEL_15;
  }
}

Referenced by:

HalpInitializeProfiling