// SetupVariableSet - decompiled from Platform.efi
__int64 __fastcall SetupVariableSet(__int64 Buffer, __int64 a2, __int64 n72)
{
  UINT16 Value; // dx
  UINTN Port; // rcx
  __int64 (__fastcall **v5)(_QWORD, __int64 *, __int64 *); // rax
  UINTN Port_1; // rcx
  __int64 (__fastcall **v7)(_QWORD, __int64 *, __int64 *); // rdi
  __int64 *DestinationBuffer_1; // rax
  __int64 *DestinationBuffer; // rbx
  __int64 v11; // rax
  __int64 v12; // rbx
  char v13; // [rsp+20h] [rbp-58h] BYREF
  __int64 n72_1; // [rsp+90h] [rbp+18h] BYREF

  n72_1 = n72; /*0xb099*/
  DebugPrint(0x40u, "SmmLockBoxDxeLib RestoreLockBox - Enter\n"); /*0xb0af*/
  LOWORD(v5) = IoWrite16(Port, Value); /*0xb0b4*/
  v7 = v5; /*0xb0b9*/
  if ( !v5 ) /*0xb0bf*/
    return 0x8000000000000013uLL; /*0xb0c1*/
  LODWORD(DestinationBuffer_1) = IoRead32(Port_1); /*0xb0d0*/
  DestinationBuffer = (__int64 *)&v13; /*0xb0d8*/
  if ( DestinationBuffer_1 ) /*0xb0ea*/
    DestinationBuffer = DestinationBuffer_1; /*0xb0ea*/
  CopyMem(DestinationBuffer, &SourceBuffer__13, 0x10u); /*0xb0f1*/
  DestinationBuffer[2] = 48; /*0xb0ff*/
  DestinationBuffer[4] = -1; /*0xb10a*/
  *((_DWORD *)DestinationBuffer + 6) = 3; /*0xb10f*/
  *((_DWORD *)DestinationBuffer + 7) = 48; /*0xb11a*/
  CopyMem(DestinationBuffer + 5, &Port_, 0x10u); /*0xb11d*/
  DestinationBuffer[7] = 0; /*0xb122*/
  DestinationBuffer[8] = 0; /*0xb12f*/
  n72_1 = 72; /*0xb13a*/
  v11 = (*v7)(v7, DestinationBuffer, &n72_1); /*0xb146*/
  if ( v11 < 0 ) /*0xb14b*/
  {
    DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0xb15c*/
    Assert( /*0xb174*/
      (__int64)"e:\\hs\\MdeModulePkg\\Library\\SmmLockBoxLib\\SmmLockBoxDxeLib.c",
      462,
      (__int64)"!EFI_ERROR (Status)");
  }
  v12 = DestinationBuffer[4]; /*0xb179*/
  DebugPrint(0x40u, "SmmLockBoxDxeLib RestoreLockBox - Exit (%r)\n", v12); /*0xb18c*/
  return v12; /*0xb19c*/
}
