// SetupPolicyInit - decompiled from Platform.efi
UINTN SetupPolicyInit(__int64 a1, va_list va, const void *SourceBuffer, ...)
{
  __int64 v4; // rax
  bool v7; // zf
  void *ZeroPool; // rax
  __int64 v10; // rax
  __int64 v11; // rax
  __int64 v12; // rax
  UINTN v13[2]; // [rsp+30h] [rbp-10h] BYREF
  UINTN AllocationSize; // [rsp+78h] [rbp+38h] BYREF
  va_list v15; // [rsp+78h] [rbp+38h]
  va_list va1; // [rsp+80h] [rbp+40h] BYREF

  va_start(va1, SourceBuffer);
  va_start(v15, SourceBuffer);
  AllocationSize = va_arg(va1, _QWORD); /*0x7e20*/
  v13[0] = 0; /*0x7e3a*/
  v4 = qword_FF28; /*0x7e42*/
  if ( !qword_FF28 || !byte_FF20 || !qword_FF18 ) /*0x7e65*/
  {
    v7 = (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_FBF0, 0, &qword_FF28) == 0; /*0x7e84*/
    v4 = qword_FF28; /*0x7e87*/
    if ( v7 ) /*0x7e8e*/
    {
      (*(void (__fastcall **)(__int64, char *))qword_FF28)(qword_FF28, &byte_FF20); /*0x7e9a*/
      v4 = qword_FF28; /*0x7e9c*/
    }
  }
  if ( byte_FF20 ) /*0x7eb0*/
  {
    v10 = (*(__int64 (__fastcall **)(__int64, __int64 *))(v4 + 8))(v4, &qword_FF18); /*0x7efc*/
    if ( v10 < 0 ) /*0x7f02*/
    {
      DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v10); /*0x7f11*/
      Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 85, (__int64)"!EFI_ERROR (Status)"); /*0x7f29*/
    }
    v11 = (*(__int64 (__fastcall **)(__int64, UINTN, UINTN *))(qword_FF18 + 80))(6, AllocationSize, v13); /*0x7f42*/
    if ( v11 < 0 ) /*0x7f48*/
    {
      DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0x7f57*/
      Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 87, (__int64)"!EFI_ERROR (Status)"); /*0x7f6f*/
    }
    if ( !v13[0] ) /*0x7f7b*/
      return 0; /*0x7f7b*/
    IoRead16(v13[0]); /*0x7f85*/
    ZeroPool = (void *)v13[0]; /*0x7f8a*/
  }
  else
  {
    ZeroPool = AllocateZeroPool(AllocationSize); /*0x7eb6*/
    v13[0] = (UINTN)ZeroPool; /*0x7ebb*/
    if ( !ZeroPool ) /*0x7ec2*/
    {
      Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 79, (__int64)"Buffer != ((void *) 0)"); /*0x7ed9*/
      return 0; /*0x7eed*/
    }
  }
  v12 = (*(__int64 (__fastcall **)(__int64, const void *, va_list, UINTN *, void *))(RuntimeServices + 72))( /*0x7fa7*/
          a1,
          SourceBuffer,
          va,
          (UINTN *)v15,
          ZeroPool);
  if ( v12 < 0 ) /*0x7fad*/
  {
    DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v12); /*0x7fbc*/
    Assert((__int64)"e:\\hs\\PurleyRpPkg\\Library\\SetupLib\\DxeSetupLib.c", 98, (__int64)"!EFI_ERROR (Status)"); /*0x7fd4*/
    if ( byte_FF20 ) /*0x7fe4*/
      (*(void (__fastcall **)(UINTN))(qword_FF18 + 88))(v13[0]); /*0x7fed*/
    else
      (*(void (__fastcall **)(UINTN))(BootServices + 72))(v13[0]); /*0x7ffc*/
    return 0; /*0x7ff0*/
  }
  return v13[0]; /*0x8012*/
}
