//
// LocalLevelManager::getAllLevelsWithName from 0x7e8d40 to 0x7e8eec (428 bytes)
//
// 2 xrefs:
// > EditLevelLayer::verifyLevelName @ 0x6e2698
// > ??> @ 0x5ebc0
//
// 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
//
cocos2d::CCArray *__fastcall LocalLevelManager::getAllLevelsWithName(__int64 a1, const void **a2)
{
unsigned int v4; // w19
cocos2d::CCObject *v5; // x28
_QWORD *v6; // x27
__int64 *v7; // x25
unsigned __int64 v8; // x24
unsigned __int64 v9; // x26
size_t v10; // x2
signed __int64 v11; // x2
unsigned int *v13; // x3
int v14; // w0
int v15; // w0
int v16; // [xsp+68h] [xbp+68h]
cocos2d::CCArray *v17; // [xsp+78h] [xbp+78h]
_QWORD *v18; // [xsp+90h] [xbp+90h] BYREF
v4 = 0;
v17 = (cocos2d::CCArray *)cocos2d::CCArray::create(_stack_chk_guard);
if ( (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 336)) )
{
while ( 1 )
{
v5 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 336), v4);
sub_D18D28(&v18);
v6 = v18;
v7 = v18 - 3;
v8 = *(v18 - 3);
v9 = *((_QWORD *)*a2 - 3);
if ( v9 > v8 )
v10 = *(v18 - 3);
else
v10 = *((_QWORD *)*a2 - 3);
LODWORD(v11) = memcmp(v18, *a2, v10);
if ( (_DWORD)v11 )
goto LABEL_9;
v11 = v8 - v9;
if ( (__int64)(v8 - v9) > 0x7FFFFFFF )
break;
if ( v11 < (__int64)0xFFFFFFFF80000000LL )
{
LODWORD(v11) = 0x80000000;
goto LABEL_9;
}
if ( v7 == &qword_124B6B0 )
goto LABEL_18;
LABEL_14:
if ( &pthread_create )
{
v13 = (unsigned int *)(v6 - 1);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
if ( v14 > 0 )
{
LABEL_18:
if ( !(_DWORD)v11 )
goto LABEL_19;
goto LABEL_10;
}
}
else
{
v15 = *((_DWORD *)v6 - 2);
*((_DWORD *)v6 - 2) = v15 - 1;
if ( v15 > 0 )
goto LABEL_18;
}
v16 = v11;
operator delete(v7);
if ( !v16 )
{
LABEL_19:
++v4;
cocos2d::CCArray::addObject(v17, v5);
goto LABEL_11;
}
LABEL_10:
++v4;
LABEL_11:
if ( v4 >= (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 336)) )
return v17;
}
LODWORD(v11) = 0x7FFFFFFF;
LABEL_9:
if ( v7 == &qword_124B6B0 )
goto LABEL_10;
goto LABEL_14;
}
return v17;
}