//
// GameLevelManager::onUpdateDescriptionCompleted from 0x6fb7c8 to 0x6fba9c (724 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x733304
// > ??> @ 0x5e890
//
// 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::onUpdateDescriptionCompleted(__int64 a1, const void **a2, char **a3)
{
char *v3; // x24
cocos2d::CCDictionary *v5; // x20
char *v7; // x0
cocos2d::CCArray *v8; // x25
char *v9; // x0
unsigned int v10; // w24
cocos2d::CCString *v11; // x0
const char *CString; // x0
_DWORD *v13; // x25
_QWORD *v14; // x1
unsigned __int64 v15; // x26
unsigned __int64 v16; // x21
size_t v17; // x2
int v18; // w19
__int64 v19; // x21
__int64 *v20; // x0
__int64 v21; // x0
unsigned int *v23; // x25
int v24; // w1
unsigned int *v25; // x1
int v26; // w2
unsigned int *v27; // x1
int v28; // w2
void *v29; // [xsp+60h] [xbp+60h] BYREF
v3 = *a3;
v5 = *(cocos2d::CCDictionary **)(a1 + 656);
sub_D153B8((int)&v29, *a3);
cocos2d::CCDictionary::removeObjectForKey(v5, (const std::string *)&v29);
v7 = (char *)v29 - 24;
if ( (char *)v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)((char *)v29 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v29, v3);
v8 = sub_6F004C(&v29, "_");
v9 = (char *)v29 - 24;
if ( (char *)v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)((char *)v29 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v9);
}
v10 = 0;
if ( (unsigned int)cocos2d::CCArray::count(v8) > 1 )
{
v11 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 1u);
CString = cocos2d::CCString::getCString(v11);
v10 = atoi(CString);
}
sub_D153B8((int)&v29, "-1");
v13 = v29;
v14 = *a2;
v15 = *((_QWORD *)v29 - 3);
v16 = *(v14 - 3);
if ( v15 > v16 )
v17 = *(v14 - 3);
else
v17 = *((_QWORD *)v29 - 3);
v18 = memcmp(v14, v29, v17);
if ( v18 || (v18 = 0x7FFFFFFF, v19 = v16 - v15, v19 > 0x7FFFFFFF) )
{
v20 = (__int64 *)(v13 - 6);
if ( v13 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_11;
}
else
{
v20 = (__int64 *)(v13 - 6);
if ( v19 >= (__int64)0xFFFFFFFF80000000LL )
v18 = v19;
else
v18 = 0x80000000;
if ( v20 == &qword_124B6B0 )
goto LABEL_11;
}
if ( &pthread_create )
{
v23 = v13 - 2;
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(v13 - 2);
*(v13 - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v20);
LABEL_11:
v21 = *(_QWORD *)(a1 + 824);
if ( v18 )
{
if ( v21 )
(**(void (__fastcall ***)(__int64, _QWORD, __int64))v21)(v21, v10, 24);
}
else if ( v21 )
{
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v21 + 8LL))(v21, v10, 24);
}
return _stack_chk_guard;
}