// ProcessSetupConfig - decompiled from Platform.efi
unsigned __int64 __fastcall ProcessSetupConfig(unsigned __int16 *Buffer)
{
  const CHAR16 *Buffer_1; // rbx
  unsigned __int64 v2; // rdi
  __int16 n48; // r8
  CHAR16 n88; // cx
  __int64 SetupVarSize; // rax
  __int64 v7; // r9
  __int64 v8; // [rsp+30h] [rbp+8h]

  Buffer_1 = Buffer; /*0x5812*/
  if ( ((unsigned __int8)Buffer & 1) != 0 ) /*0x5818*/
    Assert( /*0x582d*/
      (__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
      1006,
      (__int64)"((UINTN) String & 0x00000001) == 0");
  v2 = 0; /*0x5832*/
  if ( !Buffer_1 ) /*0x5837*/
  {
    Assert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", 1011, (__int64)"(String != ((void *) 0))"); /*0x584c*/
    return v8; /*0x5851*/
  }
  if ( StrLen(Buffer_1) > 0xF4240 ) /*0x5877*/
    Assert( /*0x588c*/
      (__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
      1018,
      (__int64)"(StrnLenS (String, (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdMaxi"
               "mumUnicodeStringLength))");
  if ( StrLen(Buffer_1) > 0xF4240 ) /*0x58a4*/
    return v8; /*0x58a4*/
  while ( *Buffer_1 == 32 || *Buffer_1 == 9 ) /*0x58b0*/
    ++Buffer_1; /*0x58b2*/
  n48 = 48; /*0x58b8*/
  while ( *Buffer_1 == 48 ) /*0x58c7*/
    ++Buffer_1; /*0x58bf*/
  n88 = *Buffer_1; /*0x58c9*/
  if ( (unsigned __int16)(*Buffer_1 - 97) <= 0x19u ) /*0x58d3*/
    n88 -= 32; /*0x58d5*/
  if ( n88 == 88 ) /*0x58dd*/
  {
    if ( *(Buffer_1 - 1) == 48 ) /*0x58e4*/
    {
      ++Buffer_1; /*0x58ea*/
      goto LABEL_21; /*0x58ea*/
    }
  }
  else
  {
LABEL_21:
    while ( (unsigned __int16)(*Buffer_1 - n48) <= 9u /*0x5917*/
         || (unsigned __int16)(*Buffer_1 - 65) <= 5u
         || (unsigned __int16)(*Buffer_1 - 97) <= 5u )
    {
      SetupVarSize = GetSetupVarSize(*Buffer_1); /*0x5920*/
      if ( v2 > (unsigned __int64)(v7 - SetupVarSize) >> 4 ) /*0x5932*/
        return v7; /*0x5944*/
      v2 = SetupVarSize + 16 * v2; /*0x5938*/
      ++Buffer_1; /*0x593b*/
    }
  }
  return v2; /*0x585e*/
}
