// GetManufacturingMode - decompiled from Platform.efi
__int64 GetManufacturingMode()
{
  unsigned int v0; // edi
  __int64 v1; // rcx
  __int64 v2; // rdx
  unsigned int CpRcCfg2; // ebx
  UINTN Length; // r8
  int n4; // eax
  unsigned int n2; // esi
  __int64 v8; // rcx
  __int64 CpuPciCfg; // rax
  unsigned int v10; // [rsp+30h] [rbp+8h] BYREF

  v0 = 0; /*0x7cf0*/
  v10 = 0; /*0x7cf6*/
  SetupCallbackFinal(&v10); /*0x7cf9*/
  if ( v10 )
  {
    if ( (*(_DWORD *)(v10 + 300) & 0x8000) != 0 )
    {
      DebugPrint(0x40u, "HECI: GetOnBoardMeType() for DWR flow return Dfx type\n");
      return 15; /*0x7d83*/
    }
  }
  else
  {
    Assert( /*0x7d19*/
      (__int64)"e:\\hs\\PurleySktPkg\\SouthClusterLbg\\Library\\PeiDxeSmmPchPmcLib\\PchPmcLib.c",
      162,
      (__int64)"PchPwrmBase != 0");
  }
  CpRcCfg2 = *(_DWORD *)(ReadCpuPciCfg(v1, 22, 0) + 64); /*0x7d2d*/
  if ( CpRcCfg2 == -1 )
  {
    CpRcCfg2 = ReadCpRcCfg2(0xFFFFFFFF, v2, Length); /*0x7d48*/
    DebugPrint(0x40u, "HECI: GetOnBoardMeType() reads Hfs info from HOB = %d\n", CpRcCfg2);
  }
  n4 = CpRcCfg2 & 0xF; /*0x7d51*/
  if ( n4 != 15 )
  {
    if ( n4 == 4 ) /*0x7d8b*/
      return 255; /*0x7d92*/
    n2 = HIWORD(CpRcCfg2) & 0xF; /*0x7da5*/
    DebugPrint(0x40u, "HECI: MeOperationMode = %d\n", n2);
    if ( n2 > 1 )
    {
      if ( n2 == 2 ) /*0x7db8*/
        return 255; /*0x7db8*/
      if ( n2 > 5 )
      {
        if ( n2 != 7 )
        {
          if ( n2 == 15 )
          {
            return 1; /*0x7dcb*/
          }
          else
          {
            DebugPrint(0x80000000, "HECI: ME type not recognized (MEFS1: 0x%08X)\n", CpRcCfg2);
            CpuPciCfg = ReadCpuPciCfg(v8, 22, 0); /*0x7ded*/
            DebugPrint(0x80000000, "                             (MEFS2: 0x%08X)\n", *(_DWORD *)(CpuPciCfg + 72));
          }
          return v0; /*0x7dce*/
        }
        return 255; /*0x7dc4*/
      }
    }
    return 2; /*0x7e06*/
  }
  return 15; /*0x7e17*/
}
