//
// GJAccountManager::handleIt from 0x8490e4 to 0x8497bc (1752 bytes)
//
// 3 xrefs:
// > GJAccountManager::onProcessHttpRequestCompleted @ 0x84983c
// > GJAccountManager::handleItND @ 0x849a58
// > ??> @ 0x31518
//
// 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::handleIt(GJAccountManager *a1, char a2, __int64 a3, __int64 a4, int a5)
{
void *v6; // x0
char *v7; // x1
char *v8; // x0
unsigned int *v9; // x1
int v10; // w2
void *v12; // x0
unsigned int *v13; // x1
void *v14; // x0
unsigned int *v15; // x1
void *v16; // x0
unsigned int *v17; // x1
void *v18; // x0
unsigned int *v19; // x1
void *v20; // x0
unsigned int *v21; // x1
void *v22; // x0
unsigned int *v23; // x1
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
int v38; // [xsp+30h] [xbp+30h]
char *v39; // [xsp+48h] [xbp+48h] BYREF
__int64 v40; // [xsp+50h] [xbp+50h] BYREF
if ( !a2 )
{
v38 = a5;
sub_D1798C(a3, "-1", 2);
a5 = v38;
}
switch ( a5 )
{
case 20:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onBackupAccountCompleted(a1, (const void **)&v39);
v14 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v40 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v14);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( !&pthread_create )
goto LABEL_48;
v15 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v15);
while ( __stlxr(v10 - 1, v15) );
goto LABEL_9;
}
break;
case 21:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onSyncAccountCompleted(a1, (const void **)&v39);
v16 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v40 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v16);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( !&pthread_create )
goto LABEL_48;
v17 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v17);
while ( __stlxr(v10 - 1, v17) );
goto LABEL_9;
}
break;
case 22:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onRegisterAccountCompleted(a1, (const void **)&v39);
v18 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(v40 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v18);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( !&pthread_create )
goto LABEL_48;
v19 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v19);
while ( __stlxr(v10 - 1, v19) );
goto LABEL_9;
}
break;
case 23:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onLoginAccountCompleted(a1, (const void **)&v39);
v20 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v40 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v20);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( !&pthread_create )
goto LABEL_48;
v21 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v21);
while ( __stlxr(v10 - 1, v21) );
goto LABEL_9;
}
break;
case 26:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onUpdateAccountSettingsCompleted(a1, (const void **)&v39);
v22 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(v40 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v22);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( !&pthread_create )
goto LABEL_48;
v23 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v23);
while ( __stlxr(v10 - 1, v23) );
goto LABEL_9;
}
break;
case 54:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onGetAccountBackupURLCompleted(a1, (const void **)&v39);
v6 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v40 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v6);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( !&pthread_create )
goto LABEL_48;
v9 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
goto LABEL_9;
}
break;
case 55:
sub_D18D28(&v39);
sub_D18D28(&v40);
GJAccountManager::onGetAccountSyncURLCompleted(a1, (const void **)&v39);
v12 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v40 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v12);
}
v7 = v39;
v8 = v39 - 24;
if ( v39 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v39 - 8);
do
v10 = __ldaxr(v13);
while ( __stlxr(v10 - 1, v13) );
}
else
{
LABEL_48:
v10 = *((_DWORD *)v7 - 2);
*((_DWORD *)v7 - 2) = v10 - 1;
}
LABEL_9:
if ( v10 <= 0 )
operator delete(v8);
}
break;
default:
return _stack_chk_guard;
}
return _stack_chk_guard;
}