//
// GJAccountManager::onRegisterAccountCompleted from 0x845a78 to 0x845bec (372 bytes)
//
// 2 xrefs:
// > GJAccountManager::handleIt @ 0x8493e4
// > ??> @ 0x646e0
//
// 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::onRegisterAccountCompleted(GJAccountManager *a1, const void **a2)
{
_DWORD *v4; // x22
unsigned __int64 v5; // x25
unsigned __int64 v6; // x20
size_t v7; // x2
int v8; // w19
__int64 v9; // x20
__int64 *v10; // x0
GJAccountRegisterDelegate *v11; // x0
GJAccountRegisterDelegate *m_accountRegisterDelegate; // x19
unsigned int v14; // w0
unsigned int *v15; // x22
int v16; // w1
void *v17; // [xsp+60h] [xbp+60h] BYREF
GJAccountManager::removeDLFromActive(a1, "reg_account");
sub_D153B8((int)&v17, "1");
v4 = v17;
v5 = *((_QWORD *)v17 - 3);
v6 = *((_QWORD *)*a2 - 3);
if ( v5 > v6 )
v7 = *((_QWORD *)*a2 - 3);
else
v7 = *((_QWORD *)v17 - 3);
v8 = memcmp(*a2, v17, 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 )
{
v15 = v4 - 2;
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(v4 - 2);
*(v4 - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v10);
LABEL_7:
if ( v8 )
{
m_accountRegisterDelegate = a1->m_accountRegisterDelegate;
if ( m_accountRegisterDelegate )
{
v14 = atoi((const char *)*a2);
m_accountRegisterDelegate->registerAccountFailed(m_accountRegisterDelegate, (AccountError)v14);
}
}
else
{
v11 = a1->m_accountRegisterDelegate;
if ( v11 )
v11->registerAccountFinished(v11);
}
return _stack_chk_guard;
}