//
// LevelTools::sortSpeedObjects from 0x72cc30 to 0x72cfc4 (916 bytes)
//
// 3 xrefs:
// > PlayLayer::createObjectsFromSetupFinished @ 0x6fdcc4
// > DrawGridLayer::sortSpeedObjects @ 0x790234
// > ??> @ 0xc0550
//
// 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 12:52:34 +0000
//
__int64 __fastcall LevelTools::sortSpeedObjects(LevelTools *this, cocos2d::CCArray *a2, GJBaseGameLayer *a3)
{
unsigned int *v5; // x1
unsigned int *v6; // x1
__int64 *v7; // x20
__int64 *v8; // x27
__int64 v9; // x19
unsigned int v10; // w25
unsigned int v11; // w21
int v12; // w0
const cocos2d::CCRect *v13; // x0
int v14; // w0
__int64 *v16; // x20
__int64 *v17; // x24
__int64 i; // x19
cocos2d::CCArray *Group; // x0
cocos2d::CCArray *v20; // x26
__int64 v21; // x0
float v22; // [xsp+78h] [xbp+78h] BYREF
float v23; // [xsp+7Ch] [xbp+7Ch]
_BYTE v24[8]; // [xsp+80h] [xbp+80h] BYREF
float v25[2]; // [xsp+88h] [xbp+88h] BYREF
float v26; // [xsp+90h] [xbp+90h]
float v27; // [xsp+94h] [xbp+94h]
if ( (unsigned int)cocos2d::CCArray::count(this) )
{
if ( this )
{
v5 = *((unsigned int **)this + 7);
if ( *v5 )
{
v16 = *((__int64 **)v5 + 2);
v17 = &v16[*v5 - 1];
if ( v16 <= v17 )
{
for ( i = *v16; *v16; i = *v16 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)i + 1816LL))(i);
cocos2d::CCPoint::operator=(i + 1784, v25);
if ( *(__int16 *)(i + 1782) == -5 )
{
Group = (cocos2d::CCArray *)GJBaseGameLayer::getGroup(a2, *(_DWORD *)(i + 1464));
v20 = Group;
if ( Group
&& (unsigned int)cocos2d::CCArray::count(Group)
&& (v21 = cocos2d::CCArray::randomObject(v20)) != 0 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v21 + 1816LL))(v21);
}
else
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)i + 1816LL))(i);
}
cocos2d::CCPoint::operator=(i + 1900, v25);
}
if ( v17 < ++v16 )
break;
}
}
}
LevelTools::sortChannelOrderObjects(this, nullptr, (cocos2d::CCDictionary *)((char *)&dword_0 + 1));
v6 = *((unsigned int **)this + 7);
if ( *v6 )
{
v7 = *((__int64 **)v6 + 2);
v8 = &v7[*v6 - 1];
if ( v7 <= v8 )
{
v9 = *v7;
if ( *v7 )
{
v10 = 0;
v11 = 0;
while ( 1 )
{
v12 = *(_DWORD *)(v9 + 1028);
if ( v12 == 1330 )
goto LABEL_20;
if ( v12 <= 1330 )
{
if ( v12 == 141 )
goto LABEL_20;
if ( v12 <= 141 )
{
if ( v12 == 36 || v12 == 84 )
goto LABEL_20;
LABEL_15:
if ( *(_BYTE *)(v9 + 1472) )
goto LABEL_16;
goto LABEL_20;
}
if ( v12 < 200 )
goto LABEL_15;
if ( v12 <= 203 )
goto LABEL_16;
if ( v12 != 1022 )
goto LABEL_15;
}
else
{
if ( v12 == 1704 )
goto LABEL_20;
if ( v12 <= 1704 )
{
if ( v12 == 1334 )
goto LABEL_16;
if ( v12 == 1594 || v12 == 1333 )
goto LABEL_20;
goto LABEL_15;
}
if ( v12 == 2902 )
{
LABEL_16:
if ( !*(_BYTE *)(v9 + 1474) )
{
v13 = (const cocos2d::CCRect *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 1328LL))(v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v25, v13);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v22,
v25[0] + (float)(v26 * 0.5),
v25[1] + (float)(v27 * 0.5));
if ( v10 >= (v11 ^ 1) )
{
if ( v11 <= v10 )
{
if ( v11 >= v10 )
{
if ( v10 && v11 )
v23 = (float)(v23 - (float)(v27 * 0.5)) - 15.0;
}
else
{
v23 = (float)(v23 + (float)(v27 * 0.5)) + 15.0;
}
}
else
{
v22 = (float)(v22 + (float)(v26 * 0.5)) + 15.0;
}
}
else
{
v22 = (float)(v22 - (float)(v26 * 0.5)) - 15.0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, (const cocos2d::CCPoint *)&v22);
cocos2d::CCPoint::operator=(v9 + 1784, v24);
}
goto LABEL_20;
}
if ( v12 != 3027 && v12 != 1751 )
goto LABEL_15;
}
LABEL_20:
v14 = *(__int16 *)(v9 + 1782);
if ( v14 == -4 )
{
if ( !*(_BYTE *)(v9 + 1861) )
{
v10 = (unsigned int)(*(_DWORD *)(v9 + 1840) - 3) <= 1;
v11 = (*(_DWORD *)(v9 + 1844) & 0xFFFFFFFD) == 1;
}
}
else if ( v14 == -1 )
{
v11 ^= 1u;
}
if ( v8 >= ++v7 )
{
v9 = *v7;
if ( *v7 )
continue;
}
break;
}
}
}
}
}
else
{
LevelTools::sortChannelOrderObjects(nullptr, nullptr, (cocos2d::CCDictionary *)((char *)&dword_0 + 1));
}
LevelTools::sortChannelOrderObjects(this, nullptr, (cocos2d::CCDictionary *)((char *)&dword_0 + 1));
}
return _stack_chk_guard;
}