//
// PurchaseItemPopup::onPurchase from 0x1403b5ef0 to 0x1403b5f99 (169 bytes)
//
// 2 xrefs:
// > PurchaseItemPopup::init @ 0x1403b589e
// > ??> @ 0x140923c6c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:31:24 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall PurchaseItemPopup::onPurchase(_QWORD *a1)
{
int v2; // edi
__int64 v3; // rcx
void (__fastcall ***v4)(_QWORD, _QWORD); // rcx
__int64 v5; // rdx
void *v7; // [rsp+30h] [rbp+8h]
v2 = *(_DWORD *)(a1[83] + 320LL) - *(_DWORD *)(a1[83] + 324LL);
v3 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v7 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v7);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v3 = qword_14090BFE0;
}
if ( GameStatsManager::purchaseItem(v3, v2) )
{
v4 = (void (__fastcall ***)(_QWORD, _QWORD))a1[84];
if ( v4 )
(**v4)(v4, a1[83]);
}
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 992LL))(a1, 0);
LOBYTE(v5) = 1;
return (*(__int64 (__fastcall **)(_QWORD *, __int64))(*a1 + 520LL))(a1, v5);
}