//
// GJWriteMessagePopup::closeMessagePopup from 0x100296900 to 0x100296aa3 (419 bytes)
//
// 3 xrefs:
// > GJWriteMessagePopup::onClose @ 0x1002963c7
// > GJWriteMessagePopup::keyBackClicked @ 0x100296ad7
// > sub_100296AE0 @ 0x100296aee
//
// 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 12:27:51 +0000
//
__int64 __fastcall GJWriteMessagePopup::closeMessagePopup(__int64 a1, int a2, __m128 a3)
{
unsigned int v3; // eax
__m128 *v4; // r15
__int64 v5; // r14
__int64 v6; // rax
__int64 v7; // rax
__int64 StoredUserMessage; // rax
char *v9; // rax
std::string __str; // [rsp+0h] [rbp-50h] BYREF
std::string v12; // [rsp+20h] [rbp-30h] BYREF
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 1160LL))(*(_QWORD *)(a1 + 704), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 712) + 1160LL))(*(_QWORD *)(a1 + 712), 0);
if ( a2 || !*(_DWORD *)(a1 + 696) )
goto LABEL_20;
v3 = *(unsigned __int8 *)(a1 + 720);
if ( (v3 & 1) != 0 )
{
if ( !*(_QWORD *)(a1 + 728) )
goto LABEL_18;
LABEL_7:
v4 = (__m128 *)(a1 + 720);
v5 = GJUserMessage::create_1();
if ( (*(_BYTE *)(a1 + 720) & 1) != 0 )
{
sub_10001AD30(&__str, *(const void **)(a1 + 736), *(_QWORD *)(a1 + 728));
}
else
{
__str.__r_.__value_.__r.__words[2] = *(_QWORD *)(a1 + 736);
a3 = *v4;
*(__m128 *)&__str.__r_.__value_.__l.0 = *v4;
}
std::string::operator=((std::string *)(v5 + 352), &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)(a1 + 744) & 1) != 0 )
{
sub_10001AD30(&v12, *(const void **)(a1 + 760), *(_QWORD *)(a1 + 752));
}
else
{
v12.__r_.__value_.__r.__words[2] = *(_QWORD *)(a1 + 760);
a3 = *(__m128 *)(a1 + 744);
*(__m128 *)&v12.__r_.__value_.__l.0 = a3;
}
std::string::operator=((std::string *)(v5 + 328), &v12);
if ( (*(_BYTE *)&v12.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v12.__r_.__value_.__l.__data_);
v6 = GameLevelManager::sharedState(*(double *)a3.i64);
*(double *)a3.i64 = GameLevelManager::storeUserMessageReply(v6, *(unsigned int *)(a1 + 696), v5);
goto LABEL_18;
}
if ( v3 >> 1 )
goto LABEL_7;
LABEL_18:
v7 = GameLevelManager::sharedState(*(double *)a3.i64);
StoredUserMessage = GameLevelManager::getStoredUserMessage(v7, *(unsigned int *)(a1 + 696));
if ( StoredUserMessage )
{
v9 = sub_100293190(StoredUserMessage);
v9[596] = 1;
(*(void (__fastcall **)(char *))(*(_QWORD *)v9 + 1312LL))(v9);
}
LABEL_20:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1072LL))(a1, 0);
return (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 528LL))(a1, 1);
}