//
// GameLevelManager::onBanUserCompleted from 0x6f6b5c to 0x6f6ecc (880 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x732574
// > ??> @ 0xb23f8
//
// 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 GameLevelManager::onBanUserCompleted(GameLevelManager *a1, const void **a2)
{
char *v4; // x22
unsigned __int64 v5; // x25
unsigned __int64 v6; // x20
size_t v7; // x2
int v8; // w19
__int64 v9; // x20
__int64 *v10; // x0
char *v12; // x0
char *v13; // x0
char *v14; // x0
char *v15; // x19
unsigned int *v16; // x22
int v17; // w0
unsigned int *v18; // x22
int v19; // w1
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
char *v26; // [xsp+60h] [xbp+60h] BYREF
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 - 24);
if ( v4 - 24 == (char *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v10 = (__int64 *)(v4 - 24);
if ( v9 >= (__int64)0xFFFFFFFF80000000LL )
v8 = v9;
else
v8 = 0x80000000;
if ( v10 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v18 = (unsigned int *)(v4 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v4 - 2);
*((_DWORD *)v4 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v10);
LABEL_7:
if ( v8 )
{
GameLevelManager::getLeaderboardKey((_BYTE *)&dword_0 + 1, (__int64)&v26);
GameLevelManager::resetTimerForKey(a1, v26);
v12 = v26 - 24;
if ( v26 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v26 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v12);
}
GameLevelManager::getLeaderboardKey((_BYTE *)&dword_0 + 1, (__int64)&v26);
GameLevelManager::resetTimerForKey(a1, v26);
v13 = v26 - 24;
if ( v26 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(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(v13);
}
GameLevelManager::getLeaderboardKey((_BYTE *)&dword_0 + 1, (__int64)&v26);
GameLevelManager::resetTimerForKey(a1, v26);
v14 = v26 - 24;
if ( v26 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v26 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v14);
}
GameLevelManager::getLeaderboardKey((_BYTE *)&dword_0 + 1, (__int64)&v26);
GameLevelManager::resetTimerForKey(a1, v26);
v15 = v26 - 24;
if ( v26 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v26 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v15);
}
}
return _stack_chk_guard;
}