//
// GJMultiplayerManager::createAndAddComment from 0x140283b30 to 0x140283d02 (466 bytes)
//
// 2 xrefs:
// > GJMultiplayerManager::uploadComment @ 0x140283a91
// > ??> @ 0x1406d14cc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=2
void __fastcall GJMultiplayerManager::createAndAddComment(__int64 a1, const char *a2, unsigned int a3)
{
GJAccountManager *v6; // rax
const char *v7; // rdx
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // r8
__int64 v11; // rdx
__int64 v12; // rcx
__int64 v13; // r8
__int64 v14; // r9
void **v15; // r15
char *v16; // rsi
unsigned __int64 v17; // rbp
__int64 v18; // rbx
unsigned __int64 v19; // rdi
__int64 v20; // rcx
char *v21; // rax
__int128 v22; // [rsp+20h] [rbp-98h] BYREF
unsigned __int64 v23; // [rsp+30h] [rbp-88h]
__int64 v24; // [rsp+38h] [rbp-80h]
const char *v25; // [rsp+48h] [rbp-70h]
void *Src[2]; // [rsp+50h] [rbp-68h] BYREF
unsigned __int64 v27; // [rsp+60h] [rbp-58h]
unsigned __int64 v28; // [rsp+68h] [rbp-50h]
v25 = a2;
v6 = GJAccountManager::sharedState();
v7 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v7 = *(const char **)a2;
v8 = cocos2d::CCString::createWithFormat("2~%s~8~%i~9~7 minutes~6~-1", v7, v6->m_accountID - v6->m_unkInt1);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)Src = 0;
v27 = 0;
v28 = 0;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003A930(Src, CString, v10);
v22 = 0;
v23 = 0;
v24 = 0;
v15 = Src;
v16 = (char *)Src[0];
v17 = v28;
if ( v28 > 0xF )
v15 = (void **)Src[0];
v18 = 0x7FFFFFFFFFFFFFFFLL;
v19 = v27;
if ( v27 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v12, v11, v13, v14);
v24 = 15;
if ( v27 > 0xF )
{
if ( (v27 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v18 = v27 | 0xF;
if ( (v27 | 0xF) < 0x16 )
v18 = 22;
}
*(_QWORD *)&v22 = sub_14003AA10(v18 + 1);
v23 = v19;
v24 = v18;
memcpy((void *)v22, v15, v19 + 1);
}
else
{
v23 = v27;
v22 = *(_OWORD *)v15;
}
GJMultiplayerManager::addComment(a1, &v22, a3);
v20 = *(_QWORD *)(a1 + 352);
if ( v20 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v20 + 24LL))(v20);
if ( v17 > 0xF )
{
v21 = v16;
if ( v17 + 1 >= 0x1000 )
{
v16 = *((char **)v16 - 1);
if ( (unsigned __int64)(v21 - v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
sub_14003A830((__int64)a2);
}