//
// ObjectManager::setup from 0x58b730 to 0x58bad8 (936 bytes)
//
// 2 xrefs:
// > LoadingLayer::loadAssets @ 0x5c4b08
// > ??> @ 0xc8e38
//
// 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
//
void ObjectManager::setup(ObjectManager *a1)
{
cocos2d::CCDictionary *m_objectDefinitions; // x0
unsigned int v2; // w20
cocos2d::CCArray *v3; // x24
cocos2d::CCString *v4; // x0
char *CString; // x0
_QWORD *v6; // x26
__int64 *v7; // x27
unsigned __int64 v8; // x28
unsigned __int64 v9; // x19
size_t v10; // x2
unsigned __int64 v11; // x19
_BOOL4 v12; // w28
char *v13; // x0
char *v14; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
void *v19; // x0
unsigned int *v20; // x1
int v21; // w2
__int64 v22; // x0
unsigned int *v23; // x3
int v24; // w0
_QWORD v25[15]; // [xsp+0h] [xbp+0h] BYREF
char v26; // [xsp+78h] [xbp+78h] BYREF
char v27; // [xsp+80h] [xbp+80h] BYREF
char *v28; // [xsp+88h] [xbp+88h] BYREF
_QWORD *v29; // [xsp+90h] [xbp+90h] BYREF
_QWORD *v30; // [xsp+98h] [xbp+98h] BYREF
__int64 v31; // [xsp+A0h] [xbp+A0h] BYREF
std::string v32; // 0:x1.8
m_objectDefinitions = a1->m_objectDefinitions;
v25[13] = &v27;
v25[12] = &v26;
v2 = 0;
v3 = cocos2d::CCDictionary::allKeys(m_objectDefinitions);
if ( (unsigned int)cocos2d::CCArray::count(v3) )
{
do
{
v4 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v3, v2);
CString = (char *)cocos2d::CCString::getCString(v4);
sub_D153B8((int)&v28, CString);
sub_D153B8((int)&v29, v28);
sub_D153B8((int)&v30, "GlobalAnimations");
v6 = v30;
v7 = v30 - 3;
v8 = *(v30 - 3);
v9 = *(v29 - 3);
if ( v8 > v9 )
v10 = *(v29 - 3);
else
v10 = *(v30 - 3);
if ( memcmp(v29, v30, v10) || (v11 = v9 - v8, v11 + 0x80000000 > 0xFFFFFFFF) || (v12 = 0, (_DWORD)v11) )
{
v22 = sub_D1641C((int)&v28, "xyz");
v6 = v30;
v7 = v30 - 3;
v12 = v22 == -1;
if ( v30 - 3 == &qword_124B6B0 )
goto LABEL_9;
}
else if ( v7 == &qword_124B6B0 )
{
goto LABEL_9;
}
if ( &pthread_create )
{
v23 = (unsigned int *)(v6 - 1);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v6 - 2);
*((_DWORD *)v6 - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v7);
LABEL_9:
v13 = (char *)(v29 - 3);
if ( v29 - 3 == &qword_124B6B0 )
goto LABEL_10;
if ( &pthread_create )
{
v17 = (unsigned int *)(v29 - 1);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v18 - 1;
}
if ( v18 > 0 )
{
LABEL_10:
if ( v12 )
goto LABEL_25;
}
else
{
operator delete(v13);
if ( v12 )
{
LABEL_25:
sub_D153B8((unsigned int)v25 + 160, v28);
SpriteAnimationManager::createAnimations((SpriteAnimationManager *)&v31, v32);
v19 = (void *)(v31 - 24);
if ( (__int64 *)(v31 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v31 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v31 - 8);
*(_DWORD *)(v31 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v19);
}
}
}
v14 = v28 - 24;
if ( v28 - 24 == (char *)&qword_124B6B0 )
goto LABEL_12;
if ( &pthread_create )
{
v15 = (unsigned int *)(v28 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v16 - 1;
}
if ( v16 > 0 )
{
LABEL_12:
++v2;
}
else
{
++v2;
operator delete(v14);
}
}
while ( v2 < (unsigned int)cocos2d::CCArray::count(v3) );
}
}