//
// GameLevelManager::onDeleteServerLevelListCompleted from 0x731ac4 to 0x731c54 (400 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x731e74
// > ??> @ 0x36b10
//
// 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::onDeleteServerLevelListCompleted(__int64 a1, const void **a2, const void **a3)
{
_QWORD *v5; // x20
_QWORD *v7; // x0
_QWORD *v8; // x1
unsigned int v9; // w23
_QWORD *v10; // x1
_DWORD *v11; // x22
unsigned __int64 v12; // x20
unsigned __int64 v13; // x24
size_t v14; // x2
int v15; // w19
__int64 v16; // x20
__int64 *v17; // x0
__int64 v18; // x0
unsigned int *v20; // x22
int v21; // w1
void *v22; // [xsp+60h] [xbp+60h] BYREF
v5 = (_QWORD *)(a1 + 320);
v7 = std::_Rb_tree,std::less,std::allocator>::equal_range(
a1 + 320,
a3);
std::_Rb_tree,std::less,std::allocator>::_M_erase_aux(
v5,
v7,
v8);
v9 = atoi((const char *)*a3);
sub_D153B8((int)&v22, "-1");
v10 = *a2;
v11 = v22;
v12 = *(v10 - 3);
v13 = *((_QWORD *)v22 - 3);
if ( v13 > v12 )
v14 = *(v10 - 3);
else
v14 = *((_QWORD *)v22 - 3);
v15 = memcmp(v10, v22, v14);
if ( v15 || (v15 = 0x7FFFFFFF, v16 = v12 - v13, v16 > 0x7FFFFFFF) )
{
v17 = (__int64 *)(v11 - 6);
if ( v11 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v17 = (__int64 *)(v11 - 6);
if ( v16 >= (__int64)0xFFFFFFFF80000000LL )
v15 = v16;
else
v15 = 0x80000000;
if ( v17 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v20 = v11 - 2;
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(v11 - 2);
*(v11 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v17);
LABEL_7:
v18 = *(_QWORD *)(a1 + 808);
if ( v15 )
{
if ( v18 )
(**(void (__fastcall ***)(__int64, _QWORD))v18)(v18, v9);
}
else if ( v18 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v18 + 8LL))(v18, v9);
}
return _stack_chk_guard;
}