//
// cocos2d::CCSprite::sortAllChildren from 0xd85da0 to 0xd85f78 (472 bytes)
//
// 82 xrefs:
// > ??> @ 0x88ab0
// > ??> @ 0x1413838
// > ??> @ 0x1413df8
// > ??> @ 0x1414ba8
// > ??> @ 0x1417418
// > ??> @ 0x14179b8
// > ??> @ 0x141b2d8
// > ??> @ 0x141b908
// > ??> @ 0x141cd88
// > ??> @ 0x14219b8
// > ??> @ 0x1421f68
// > ??> @ 0x1423928
// > ??> @ 0x1423ed8
// > ??> @ 0x14244a8
// > ??> @ 0x1428e88
// > ??> @ 0x14334f8
// > ??> @ 0x1433cf8
// > ??> @ 0x14342e8
// > ??> @ 0x1434ac8
// > ??> @ 0x14352d8
// > ??> @ 0x143a268
// > ??> @ 0x1443638
// > ??> @ 0x1443e48
// > ??> @ 0x1444658
// > ??> @ 0x1444e68
// > ??> @ 0x1445678
// > ??> @ 0x1445e88
// > ??> @ 0x1446698
// > ??> @ 0x1446ea8
// > ??> @ 0x1447688
// > ??> @ 0x1447e98
// > ??> @ 0x14486a8
// > ??> @ 0x1448eb8
// > ??> @ 0x14496c8
// > ??> @ 0x1449f18
// > ??> @ 0x144a728
// > ??> @ 0x144af38
// > ??> @ 0x144b748
// > ??> @ 0x144bf58
// > ??> @ 0x144c778
// > ??> @ 0x144cf88
// > ??> @ 0x144d798
// > ??> @ 0x144dfa8
// > ??> @ 0x144e7b8
// > ??> @ 0x144efc8
// > ??> @ 0x144f7d8
// > ??> @ 0x144ffe8
// > ??> @ 0x14507f8
// > ??> @ 0x1451008
// > ??> @ 0x1451818
// > ??> @ 0x1452028
// > ??> @ 0x1452838
// > ??> @ 0x1453048
// > ??> @ 0x1453858
// > ??> @ 0x1454068
// > ??> @ 0x1454878
// > ??> @ 0x1455088
// > ??> @ 0x1455898
// > ??> @ 0x14560a8
// > ??> @ 0x14568b8
// > ??> @ 0x14570c8
// > ??> @ 0x14578d8
// > ??> @ 0x14580e8
// > ??> @ 0x14588f8
// > ??> @ 0x1459128
// > ??> @ 0x145b018
// > ??> @ 0x145b5b8
// > ??> @ 0x14776a8
// > ??> @ 0x1479758
// > ??> @ 0x1486bb8
// > ??> @ 0x1487168
// > ??> @ 0x1491a98
// > ??> @ 0x1496ed8
// > ??> @ 0x1499428
// > ??> @ 0x14c1d58
// > ??> @ 0x14d9758
// > ??> @ 0x150cb78
// > ??> @ 0x1517a38
// > ??> @ 0x1517fd8
// > ??> @ 0x1518b58
// > ??> @ 0x152e5b8
// > ??> @ 0x152fdb8
//
// 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 13:08:12 +0000
//
__int64 __fastcall cocos2d::CCSprite::sortAllChildren(__int64 this)
{
__int64 v1; // x27
__int64 v2; // x0
_QWORD *v3; // x26
_QWORD *v4; // x24
__int64 v5; // x25
__int64 v6; // x23
_DWORD *v7; // x21
int v8; // w20
__int64 v9; // x22
_QWORD *v10; // x19
__int64 v11; // x1
int v12; // w0
int v13; // w28
int v14; // w28
unsigned int v15; // w28
unsigned int *v16; // x1
__int64 *v17; // x19
__int64 *i; // x20
if ( *(_BYTE *)(this + 288) )
{
v1 = this;
v2 = *(_QWORD *)(*(_QWORD *)(this + 208) + 56LL);
v3 = *(_QWORD **)(v2 + 16);
if ( *(int *)v2 > 1 )
{
v4 = *(_QWORD **)(v2 + 16);
v5 = (unsigned int)(*(_DWORD *)v2 - 2) + 1LL;
v6 = 0;
do
{
LABEL_4:
v7 = (_DWORD *)v4[1];
v8 = v6;
v9 = v6;
if ( (v6 & 0x80000000) == 0 )
{
v10 = v4;
while ( 1 )
{
v13 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v7 + 104LL))(v7);
if ( v13 >= (*(int (__fastcall **)(_QWORD))(*(_QWORD *)*v10 + 104LL))(*v10) )
{
v14 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v7 + 104LL))(v7);
if ( v14 != (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)*v10 + 104LL))(*v10) )
break;
v15 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v7 + 416LL))(v7);
if ( v15 >= (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)*v10 + 416LL))(*v10) )
break;
}
v11 = *v10;
v12 = v8 + 1;
v10[1] = *v10;
--v8;
--v10;
*(_DWORD *)(v11 + 36) = v12;
--v9;
if ( v8 == -1 )
{
++v6;
++v4;
*v3 = v7;
v7[9] = 0;
if ( v6 != v5 )
goto LABEL_4;
goto LABEL_11;
}
}
}
++v6;
++v4;
v3[v9 + 1] = v7;
v7[9] = v8 + 1;
}
while ( v6 != v5 );
}
LABEL_11:
this = *(_QWORD *)(v1 + 368);
if ( this )
{
this = *(_QWORD *)(v1 + 208);
if ( this )
{
v16 = *(unsigned int **)(this + 56);
this = *v16;
if ( (_DWORD)this )
{
v17 = *((__int64 **)v16 + 2);
for ( i = &v17[(unsigned int)this - 1];
i >= v17;
this = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)this + 600LL))(this) )
{
this = *v17;
if ( !*v17 )
break;
++v17;
}
}
}
}
*(_BYTE *)(v1 + 288) = 0;
}
return this;
}