//
// sub_10023E558 from 0x10023e558 to 0x10023e7cc (628 bytes)
//
// 5 xrefs:
// > sub_10023E7CC @ 0x10023e8b0
// > sub_10023E7CC @ 0x10023eaf8
// > sub_10023E7CC @ 0x10023eb08
// > GJBaseGameLayer::orderSpawnObjects @ 0x1002a45c0
// > sub_1003F823C @ 0x1003f855c
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:01:23 +0000
//
__int64 __fastcall sub_10023E558(__int64 result, __int64 a2, char a3)
{
__int64 v4; // x19
__int64 v5; // x0
__int64 v6; // x22
unsigned int *v7; // x9
__int64 v8; // x8
__int64 *v9; // x21
unsigned __int64 v10; // x25
__int64 v11; // x23
__int64 v12; // x24
__n128 v13; // q0
int v14; // w0
_DWORD *v15; // x0
unsigned int *v16; // x9
__int64 v17; // x8
__int64 *v18; // x21
unsigned __int64 v19; // x26
__int64 v20; // x23
__int64 v21; // x24
__int64 v22; // x0
__int64 v23; // x25
__int64 v24; // x23
__int64 v25; // x24
__int64 v26; // x25
__int64 v27; // x0
int v28; // w27
__int64 v29; // x0
int (__cdecl *v30)(const void *, const void *); // x3
__int64 v31; // x21
__int64 v32; // x0
__int64 v33; // x0
if ( result )
{
v4 = result;
v5 = cocos2d::CCDictionary::create(result);
v6 = v5;
v7 = *(unsigned int **)(v4 + 56);
v8 = *v7;
if ( (_DWORD)v8 )
{
v9 = *((__int64 **)v7 + 2);
v10 = (unsigned __int64)&v9[v8 - 1];
do
{
v11 = *v9;
if ( !*v9 )
break;
if ( *(_DWORD *)(v11 + 1028) == 2900 && *(_BYTE *)(v11 + 1860) == 1 )
{
v12 = *(int *)(v11 + 1864);
v13 = cocos2d::CCDictionary::objectForKey_1(v6, v12);
if ( !v5 )
{
v14 = sub_1002FA40C(v11, v13);
v15 = sub_100145068(v14);
cocos2d::CCDictionary::setObject_1(v6, v15, v12);
}
}
++v9;
}
while ( (unsigned __int64)v9 <= v10 );
}
if ( !a2 )
a2 = cocos2d::CCDictionary::create(v5);
v16 = *(unsigned int **)(v4 + 56);
v17 = *v16;
if ( (_DWORD)v17 )
{
v18 = *((__int64 **)v16 + 2);
v19 = (unsigned __int64)&v18[v17 - 1];
do
{
v20 = *v18;
if ( !*v18 )
break;
v21 = *(int *)(v20 + 1776);
cocos2d::CCDictionary::objectForKey_1(a2, v21);
v23 = v22;
if ( !v22 )
{
v23 = sub_1002E736C(0);
cocos2d::CCDictionary::setObject_1(a2, v23, v21);
}
sub_1002E74E0(v23, v20);
++v18;
}
while ( (unsigned __int64)v18 <= v19 );
}
v24 = cocos2d::CCDictionary::allKeys(a2);
result = sub_1002E757C(v24);
if ( (_DWORD)result )
{
v25 = 0;
while ( 1 )
{
v26 = *(int *)(sub_1002E75A0(v24, v25) + 56);
cocos2d::CCDictionary::objectForKey_1(v6, v26);
if ( !v27 )
break;
v28 = *(_DWORD *)(v27 + 56);
cocos2d::CCDictionary::objectForKey_1(a2, v26);
if ( v28 == 1 )
{
v30 = (int (__cdecl *)(const void *, const void *))sub_10023B9E8;
goto LABEL_29;
}
if ( v28 == 3 )
{
v30 = (int (__cdecl *)(const void *, const void *))sub_10023B950;
goto LABEL_29;
}
if ( v28 != 2 )
goto LABEL_26;
v30 = (int (__cdecl *)(const void *, const void *))sub_10023BA80;
LABEL_29:
qsort(*(void **)(*(_QWORD *)(v29 + 56) + 16LL), **(unsigned int **)(v29 + 56), 8u, v30);
v25 = (unsigned int)(v25 + 1);
result = sub_1002E757C(v24);
if ( (unsigned int)v25 >= (unsigned int)result )
goto LABEL_30;
}
cocos2d::CCDictionary::objectForKey_1(a2, v26);
LABEL_26:
v30 = (int (__cdecl *)(const void *, const void *))sub_10023B8B8;
goto LABEL_29;
}
LABEL_30:
if ( (a3 & 1) != 0 )
{
sub_1002E7674(v4);
sub_10023E4A0(v4, a2, 0);
result = sub_1002E757C(v24);
if ( (_DWORD)result )
{
v31 = 0;
do
{
v32 = sub_1002E75A0(v24, v31);
cocos2d::CCDictionary::objectForKey_1(a2, *(int *)(v32 + 56));
sub_1002E7570(v4, v33);
v31 = (unsigned int)(v31 + 1);
result = sub_1002E757C(v24);
}
while ( (unsigned int)v31 < (unsigned int)result );
}
}
}
return result;
}