//
// GJAccountManager::onGetAccountSyncURLCompleted from 0x8479ec to 0x847cc4 (728 bytes)
//
// 2 xrefs:
// > GJAccountManager::handleIt @ 0x84924c
// > ??> @ 0x3c8e8
//
// 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 GJAccountManager::onGetAccountSyncURLCompleted(GJAccountManager *a1, const void **a2)
{
_DWORD *v4; // x26
unsigned __int64 v5; // x27
unsigned __int64 v6; // x20
size_t v7; // x2
int v8; // w19
__int64 v9; // x20
__int64 *v10; // x0
cocos2d::CCString *v12; // x0
char *CString; // x0
int v14; // w19
char *v15; // x0
GJAccountSyncDelegate *m_syncDelegate; // x0
void *v17; // x25
unsigned int *v18; // x26
int v19; // w0
unsigned int *v20; // x26
int v21; // w1
unsigned int *v22; // x1
int v23; // w2
__int64 v24; // [xsp+0h] [xbp+0h] BYREF
__int64 v25; // [xsp+68h] [xbp+68h]
void *v26; // [xsp+70h] [xbp+70h] BYREF
GJAccountManager::removeDLFromActive(a1, "surl_account");
sub_D153B8((int)&v26, "-1");
v4 = v26;
v5 = *((_QWORD *)v26 - 3);
v6 = *((_QWORD *)*a2 - 3);
if ( v5 > v6 )
v7 = *((_QWORD *)*a2 - 3);
else
v7 = *((_QWORD *)v26 - 3);
v8 = memcmp(*a2, v26, v7);
if ( v8 || (v8 = 0x7FFFFFFF, v9 = v6 - v5, v9 > 0x7FFFFFFF) )
{
v10 = (__int64 *)(v4 - 6);
if ( v4 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v10 = (__int64 *)(v4 - 6);
if ( v9 >= (__int64)0xFFFFFFFF80000000LL )
v8 = v9;
else
v8 = 0x80000000;
if ( v10 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v20 = v4 - 2;
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(v4 - 2);
*(v4 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v10);
LABEL_7:
if ( !v8 )
{
if ( a1->m_backupDelegate )
a1->m_syncDelegate->syncAccountFailed(a1->m_syncDelegate, GenericError, 0);
return _stack_chk_guard;
}
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s/database/accounts/syncGJAccountNew.php",
(const char *)*a2);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_D153B8((unsigned int)&v24 + 104, CString);
sub_D18D28(&v26);
v14 = (unsigned __int8)GJAccountManager::syncAccount(a1);
v15 = (char *)v26 - 24;
if ( (char *)v26 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)((char *)v26 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v23 - 1;
}
if ( v23 <= 0 )
{
operator delete(v15);
if ( v14 )
goto LABEL_20;
LABEL_18:
m_syncDelegate = a1->m_syncDelegate;
if ( m_syncDelegate )
m_syncDelegate->syncAccountFailed(m_syncDelegate, GenericError, 0);
goto LABEL_20;
}
}
if ( !v14 )
goto LABEL_18;
LABEL_20:
v17 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v25 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v17);
}
return _stack_chk_guard;
}