// GetSetupString - decompiled from Platform.efi
unsigned __int64 GetSetupString()
{
  __int64 v0; // rax
  char *Buffer; // rdi
  UINTN *i; // rbx
  void *ZeroPool; // rax
  __int64 v5; // rax
  __int64 v6; // rax
  void *Port; // [rsp+40h] [rbp+8h] BYREF

  Port = 0; /*0x802c*/
  if ( !qword_FF28 || !byte_FF20 || !qword_FF18 ) /*0x8053*/
  {
    if ( !(*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_FBF0, 0, &qword_FF28) ) /*0x8070*/
      (*(void (__fastcall **)(__int64, char *))qword_FF28)(qword_FF28, &byte_FF20); /*0x808c*/
    if ( byte_FF20 ) /*0x8095*/
    {
      v0 = (*(__int64 (__fastcall **)(__int64, __int64 *))(qword_FF28 + 8))(qword_FF28, &qword_FF18); /*0x80a8*/
      if ( v0 < 0 ) /*0x80ae*/
      {
        DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v0); /*0x80bd*/
        Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 137, (__int64)"!EFI_ERROR (Status)"); /*0x80d5*/
      }
    }
  }
  Buffer = (char *)&Buffer_; /*0x80da*/
  ZeroMem(&Buffer_, 0x2A3Bu); /*0x80e9*/
  if ( off_FD00 ) /*0x80f6*/
  {
    for ( i = (UINTN *)&unk_FD10; *(i - 2); i += 3 ) /*0x80fc*/
    {
      if ( byte_FF20 ) /*0x810a*/
      {
        v5 = (*(__int64 (__fastcall **)(__int64, UINTN, void **))(qword_FF18 + 80))(6, *i, &Port); /*0x8167*/
        if ( v5 < 0 ) /*0x816d*/
        {
          DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x817c*/
          Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 155, (__int64)"!EFI_ERROR (Status)"); /*0x8194*/
        }
        if ( !Port ) /*0x81a1*/
          return 0x8000000000000009uLL; /*0x814e*/
        IoRead16((UINTN)Port); /*0x81a6*/
        ZeroPool = Port; /*0x81ab*/
      }
      else
      {
        ZeroPool = AllocateZeroPool(*i); /*0x810f*/
        Port = ZeroPool; /*0x8114*/
        if ( !ZeroPool ) /*0x811c*/
        {
          Assert( /*0x8135*/
            (__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c",
            149,
            (__int64)"Variable != ((void *) 0)");
          ZeroPool = Port; /*0x813a*/
          if ( !Port ) /*0x8142*/
            return 0x8000000000000009uLL; /*0x8142*/
        }
      }
      v6 = (*(__int64 (__fastcall **)(_QWORD, _QWORD, _QWORD, UINTN *, void *))(RuntimeServices + 72))( /*0x81ca*/
             *(i - 1),
             *(i - 2),
             0,
             i,
             ZeroPool);
      if ( v6 < 0 ) /*0x81d0*/
      {
        DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v6); /*0x81df*/
        Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 162, (__int64)"!EFI_ERROR (Status)"); /*0x81f7*/
      }
      CopyMem(Buffer, Port, *i); /*0x8207*/
      if ( byte_FF20 ) /*0x8218*/
        (*(void (__fastcall **)(void *))(qword_FF18 + 88))(Port); /*0x8221*/
      else
        (*(void (__fastcall **)(void *))(BootServices + 72))(Port); /*0x822d*/
      Buffer += *i; /*0x8230*/
    }
  }
  return 0; /*0x824e*/
}
