//
// GJMultiplayerManager::createAndAddComment from 0x982ee0 to 0x9830b4 (468 bytes)
//
// 2 xrefs:
// > GJMultiplayerManager::uploadComment @ 0x983d00
// > ??> @ 0xa1d18
//
// 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
//
__int64 __fastcall GJMultiplayerManager::createAndAddComment(__int64 a1, char **a2, int a3)
{
GJAccountManager *v5; // x0
cocos2d::CCString *v6; // x0
char *CString; // x0
void *v8; // x0
__int64 v9; // x0
void *v10; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
char *v16; // [xsp+48h] [xbp+48h]
__int64 v17; // [xsp+58h] [xbp+58h] BYREF
__int64 v18; // [xsp+60h] [xbp+60h] BYREF
v16 = *a2;
v5 = GJAccountManager::sharedState();
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"2~%s~8~%i~9~7 minutes~6~-1",
v16,
(unsigned int)(v5->m_accountID - v5->m_unkInt1));
CString = (char *)cocos2d::CCString::getCString(v6);
sub_D153B8((int)&v17, CString);
sub_D18D28(&v18);
GJMultiplayerManager::addComment(a1, (__int64)&v18, a3);
v8 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v18 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v8);
}
v9 = *(_QWORD *)(a1 + 352);
if ( v9 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v9 + 24LL))(v9);
v10 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v17 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v10);
}
return _stack_chk_guard;
}