//
// sub_1003536C4 from 0x1003536c4 to 0x100353730 (108 bytes)
//
// 5 xrefs:
// > cocos2d::CCNode::getChildren @ 0x10023b328
// > cocos2d::CCNode::updateChildIndexes @ 0x10023b350
// > cocos2d::CCNode::qsortAllChildrenWithIndex @ 0x10023be34
// > sub_100353544 @ 0x100353554
// > sub_100353774 @ 0x100353794
//
// 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
//
__int64 __fastcall sub_1003536C4(__int64 result)
{
__int64 v1; // x8
__int64 v2; // x9
int v3; // w10
__int64 v4; // x11
__int64 v5; // x12
v1 = *(unsigned int *)(result + 8);
if ( (_DWORD)v1 != -1 )
{
if ( (int)v1 >= 1 )
{
v2 = 0;
v3 = 0;
v4 = *(_QWORD *)(result + 16);
do
{
v5 = *(_QWORD *)(v4 + 8 * v2);
if ( v5 )
{
if ( v3 >= 1 )
{
*(_QWORD *)(v4 - 8LL * v3 + 8 * v2) = v5;
v4 = *(_QWORD *)(result + 16);
*(_DWORD *)(*(_QWORD *)(v4 - 8LL * v3 + 8 * v2) + 36LL) = v2 - v3;
}
}
else
{
++v3;
}
++v2;
}
while ( v1 != v2 );
}
*(_DWORD *)(result + 8) = -1;
}
return result;
}