// MeFirmwareUpdateHandler - decompiled from Platform.efi
void __fastcall MeFirmwareUpdateHandler(unsigned __int8 *SourceBuffer)
{
  int v2; // edi
  __int64 v3; // rax
  _BYTE v4[18]; // [rsp+10h] [rbp-358h] BYREF
  char v5; // [rsp+22h] [rbp-346h]
  unsigned __int8 v6; // [rsp+370h] [rbp+8h] BYREF
  unsigned int v7; // [rsp+378h] [rbp+10h] BYREF
  __int64 n814; // [rsp+380h] [rbp+18h] BYREF

  if ( SourceBuffer && SourceBuffer[32] )
  {
    DebugPrint(0x40u, "[ME] Save to ME MeRcConfiguration->MePttEnabled: %d\n", SourceBuffer[23]);
    v2 = SourceBuffer[23]; /*0x4ce9*/
    DebugPrint(0x40u, "[ME] PttHeciUpdateState(%d)\n", v2); /*0x4cfc*/
    if ( SetupIfrKeywordHandle(&v6) >= 0 )
    {
      DebugPrint(0x40u, "[ME] Current Ptt State: %d\n", v6);
      if ( v6 != (_BYTE)v2 ) /*0x4d30*/
      {
        DebugPrint(0x40u, "[ME] Run PttHeciSetState(%d)\n", v2); /*0x4d3f*/
        SetupIfrSupplement(v2); /*0x4d47*/
      }
    }
    if ( SetupIfrKeywordHandle(&v6) >= 0 )
    {
      n814 = 814; /*0x4d66*/
      if ( (*(__int64 (__fastcall **)(const __int16 *, void *, unsigned int *, __int64 *, _BYTE *))(RuntimeServices + 72))(
             L"Setup",
             &unk_FB40,
             &v7,
             &n814,
             v4) >= 0
        && SourceBuffer[23] == 1
        && SourceBuffer[33] == 1
        && v6 == 1
        && v5 == 1 )
      {
        v5 = 0; /*0x4de8*/
        v3 = (*(__int64 (__fastcall **)(const __int16 *, void *, _QWORD, __int64, _BYTE *))(RuntimeServices + 88))( /*0x4ded*/
               L"Setup",
               &unk_FB40,
               v7,
               n814,
               v4);
        if ( v3 < 0 )
          DebugPrint(0x80000000, " ERROR: Cannot Update TpmSupport (%r) \n", v3);
      }
    }
  }
}
