//
// LocalLevelManager::getLevelsInNameGroups from 0x7e8940 to 0x7e8b44 (516 bytes)
//
// 2 xrefs:
// > LocalLevelManager::dataLoaded @ 0x7e9784
// > ??> @ 0x4e810
//
// 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::CCDictionary *LocalLevelManager::getLevelsInNameGroups(LocalLevelManager *a1)
{
unsigned int v2; // w19
cocos2d::CCDictionary *v3; // x25
cocos2d::CCObject *v4; // x22
cocos2d::CCArray *v5; // x21
cocos2d::CCArray *v6; // x0
unsigned int *v8; // x1
int v9; // w2
char *v10; // x0
unsigned int *v11; // x1
int v12; // w2
std::string v13; // [xsp+80h] [xbp+80h] BYREF
v2 = 0;
v3 = cocos2d::CCDictionary::create();
while ( v2 < (unsigned int)cocos2d::CCArray::count(a1->m_localLevels) )
{
v4 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a1->m_localLevels, v2);
sub_D18D28(&v13);
v5 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v3, &v13);
v6 = (cocos2d::CCArray *)((char *)v13.m_data.m_data - 24);
if ( (__int64 *)v13.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_3;
if ( &pthread_create )
{
v8 = (unsigned int *)((char *)v13.m_data.m_data - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *((_DWORD *)v13.m_data.m_data - 2);
*((_DWORD *)v13.m_data.m_data - 2) = v9 - 1;
}
if ( v9 > 0 )
{
LABEL_3:
if ( !v5 )
goto LABEL_11;
}
else
{
operator delete(v6);
if ( !v5 )
{
LABEL_11:
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
sub_D18D28(&v13);
cocos2d::CCDictionary::setObject((int)v3, v5);
v10 = (char *)v13.m_data.m_data - 24;
if ( (__int64 *)v13.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)((char *)v13.m_data.m_data - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v13.m_data.m_data - 2);
*((_DWORD *)v13.m_data.m_data - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
}
}
++v2;
cocos2d::CCArray::addObject(v5, v4);
}
return v3;
}