//
// GJAccountManager::onGetAccountBackupURLCompleted from 0x846cd8 to 0x846fa8 (720 bytes)
//
// 2 xrefs:
// > GJAccountManager::handleIt @ 0x84916c
// > ??> @ 0x2d258
//
// 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::onGetAccountBackupURLCompleted(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
GJAccountBackupDelegate *m_backupDelegate; // x0
cocos2d::CCString *v13; // x0
char *CString; // x0
int v15; // w19
char *v16; // x0
GJAccountBackupDelegate *v17; // x0
void *v18; // x25
unsigned int *v19; // x26
int v20; // w0
unsigned int *v21; // x26
int v22; // w1
unsigned int *v23; // x1
int v24; // w2
__int64 v25; // [xsp+0h] [xbp+0h] BYREF
__int64 v26; // [xsp+68h] [xbp+68h]
void *v27; // [xsp+70h] [xbp+70h] BYREF
GJAccountManager::removeDLFromActive(a1, "burl_account");
sub_D153B8((int)&v27, "-1");
v4 = v27;
v5 = *((_QWORD *)v27 - 3);
v6 = *((_QWORD *)*a2 - 3);
if ( v5 > v6 )
v7 = *((_QWORD *)*a2 - 3);
else
v7 = *((_QWORD *)v27 - 3);
v8 = memcmp(*a2, v27, 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 )
{
v21 = v4 - 2;
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(v4 - 2);
*(v4 - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v10);
LABEL_7:
if ( !v8 )
{
m_backupDelegate = a1->m_backupDelegate;
if ( m_backupDelegate )
m_backupDelegate->backupAccountFailed(m_backupDelegate, GenericError, 0);
return _stack_chk_guard;
}
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s/database/accounts/backupGJAccountNew.php",
(const char *)*a2);
CString = (char *)cocos2d::CCString::getCString(v13);
sub_D153B8((unsigned int)&v25 + 104, CString);
sub_D18D28(&v27);
v15 = (unsigned __int8)GJAccountManager::backupAccount(a1);
v16 = (char *)v27 - 24;
if ( (char *)v27 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)((char *)v27 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v24 - 1;
}
if ( v24 <= 0 )
{
operator delete(v16);
if ( v15 )
goto LABEL_20;
LABEL_18:
v17 = a1->m_backupDelegate;
if ( v17 )
v17->backupAccountFailed(v17, GenericError, 0);
goto LABEL_20;
}
}
if ( !v15 )
goto LABEL_18;
LABEL_20:
v18 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v26 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v18);
}
return _stack_chk_guard;
}