//
// cocos2d::CCNode::qsortAllChildrenWithIndex from 0x5be9d4 to 0x5bea54 (128 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x31fe86
// > cocos2d::CCNode::sortAllChildrenWithIndex @ 0x5bea5c
//
// 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; // r1
cocos2d::ccArray *data; // r3
int *arr; // r4
int v5; // r5
int *v6; // r7
int *v7; // r5
if ( a1->m_bReorderChildDirty )
{
cocos2d::CCNode::updateChildIndexes(a1);
data = a1->m_pChildren->data;
arr = (int *)data->arr;
v5 = 4 * data->num;
v6 = &arr[v5 / 4u];
if ( arr != &arr[v5 / 4u] )
{
std::__introsort_loop>(
(int)data->arr,
&arr[v5 / 4u],
2 * (31 - __clz(v5 >> 2)),
(int (__fastcall *)(int, int))sub_5BCBCC);
if ( v5 <= 67 )
{
std::__insertion_sort>(
arr,
&arr[v5 / 4u],
(int (__fastcall *)(int, int))sub_5BCBCC);
}
else
{
v7 = arr + 16;
std::__insertion_sort>(
arr,
arr + 16,
(int (__fastcall *)(int, int))sub_5BCBCC);
while ( v7 != v6 )
std::__unguarded_linear_insert>(
v7++,
(int (__fastcall *)(int, _DWORD))sub_5BCBCC);
}
}
cocos2d::ccArrayRecreateChildIndexes((cocos2d *)a1->m_pChildren->data, v2);
}
}