// RegisterHiiPackage - decompiled from Platform.efi
unsigned __int64 __fastcall RegisterHiiPackage(const void *SourceBuffer, unsigned __int64 n209, UINTN Length)
{
  __int64 v6; // rax
  __int64 v7; // rbp
  UINTN v8; // rdi
  __int64 v9; // rax
  void *va_; // [rsp+58h] [rbp+10h] BYREF

  if ( !n209 ) /*0x860b*/
    return 0x8000000000000002uLL; /*0x8617*/
  v6 = SetupBufferOps(SourceBuffer, n209, Length); /*0x861c*/
  if ( v6 == -1 ) /*0x8625*/
    return 0x800000000000000EuLL; /*0x8625*/
  v7 = 3 * v6; /*0x8636*/
  v8 = SetupPolicyInit((__int64)*(&off_FD00 + 3 * v6 + 1), &va_, (__int64)SourceBuffer, *(&off_FD00 + 3 * v6 + 2)); /*0x8658*/
  if ( !v8 ) /*0x865e*/
  {
    Assert( /*0x8673*/
      (__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c",
      494,
      (__int64)"DummyVariable != ((void *) 0)");
    return 0x800000000000000EuLL; /*0x8631*/
  }
  v9 = (*(__int64 (__fastcall **)(_QWORD, const void *, _QWORD, _QWORD, unsigned __int64))(RuntimeServices + 88))( /*0x8698*/
         *(&off_FD00 + v7 + 1),
         SourceBuffer,
         (unsigned int)va_,
         *(&off_FD00 + v7 + 2),
         n209);
  if ( v9 < 0 ) /*0x869e*/
  {
    DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x86af*/
    Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 499, (__int64)"!EFI_ERROR (Status)"); /*0x86c7*/
  }
  if ( byte_FF20 ) /*0x86d6*/
    (*(void (__fastcall **)(UINTN))(qword_FF18 + 88))(v8); /*0x86df*/
  else
    (*(void (__fastcall **)(UINTN))(BootServices + 72))(v8); /*0x86eb*/
  return 0; /*0x86fa*/
}
