//
// cocos2d::CCNode::qsortAllChildrenWithIndex from 0xacdd58 to 0xacde64 (268 bytes)
//
// 3 xrefs:
// > PlayLayer::resetLevel @ 0x5e57b4
// > cocos2d::CCNode::sortAllChildrenWithIndex @ 0xacde64
// > ??> @ 0x84c90
//
// 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 cocos2d::CCNode::qsortAllChildrenWithIndex(cocos2d::CCNode *a1)
{
cocos2d::_ccArray *v2; // x1
__int64 *data; // x0
__int64 v4; // x22
__int64 v5; // x19
__int64 v6; // x20
_QWORD *v7; // x19
_QWORD *v8; // x0
if ( a1->m_bReorderChildDirty )
{
cocos2d::CCNode::updateChildIndexes(a1);
data = (__int64 *)a1->m_pChildren->data;
v4 = data[2];
v5 = 8LL * *(unsigned int *)data;
v6 = v4 + v5;
if ( v4 != v4 + v5 )
{
std::__introsort_loop>(
data[2],
(char *)(v4 + v5),
2 * (63 - __clz(v5 >> 3)),
(unsigned __int8 (__fastcall *)(_QWORD, __int64))sub_ACAB7C);
if ( (unsigned __int64)v5 <= 0x87 )
{
std::__insertion_sort>(
v4,
(char *)(v4 + v5),
(unsigned __int8 (__fastcall *)(__int64, __int64))sub_ACAB7C);
}
else
{
v7 = (_QWORD *)(v4 + 128);
std::__insertion_sort>(
v4,
(char *)(v4 + 128),
(unsigned __int8 (__fastcall *)(__int64, __int64))sub_ACAB7C);
if ( v6 != v4 + 128 )
{
do
{
v8 = v7++;
std::__unguarded_linear_insert>(
v8,
(unsigned __int8 (__fastcall *)(__int64, __int64))sub_ACAB7C);
}
while ( (_QWORD *)v6 != v7 );
data = (__int64 *)a1->m_pChildren->data;
goto LABEL_7;
}
}
data = (__int64 *)a1->m_pChildren->data;
}
LABEL_7:
cocos2d::ccArrayRecreateChildIndexes((cocos2d *)data, v2);
}
}