//
// sub_18009E0E0 from 0x18009e0e0 to 0x18009e16c (140 bytes)
//
// 9 xrefs:
// > cocos2d::CCNode::getChildren @ 0x1800033ed
// > cocos2d::CCNode::qsortAllChildrenWithIndex @ 0x180004549
// > cocos2d::CCNode::updateChildIndexes @ 0x180005554
// > sub_18009D6F0 @ 0x18009d738
// > sub_18009DA50 @ 0x18009da68
// > sub_18009DD50 @ 0x18009dd59
// > ??> @ 0x18013ef58
// > ??> @ 0x18013ef8c
// > ??> @ 0x1801b7524
//
// 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_18009E0E0(__int64 a1)
{
__int64 result; // rax
int v2; // r10d
int v3; // r11d
__int64 v4; // rsi
__int64 v5; // r9
__int64 v6; // r8
__int64 v7; // rbx
__int64 v8; // rdx
result = *(int *)(a1 + 8);
if ( (_DWORD)result != -1 )
{
v2 = 0;
v3 = 0;
v4 = *(int *)(a1 + 8);
if ( (int)result > 0 )
{
result = 0;
v5 = 0;
do
{
v6 = *(_QWORD *)(a1 + 16);
v7 = *(_QWORD *)(v6 + 8 * result);
if ( v7 )
{
if ( v5 > 0 )
{
v8 = 8 * (result - v5);
*(_QWORD *)(v8 + v6) = v7;
*(_DWORD *)(*(_QWORD *)(v8 + *(_QWORD *)(a1 + 16)) + 36LL) = v3 - v2;
}
}
else
{
++v2;
++v5;
}
++v3;
++result;
}
while ( result < v4 );
}
*(_DWORD *)(a1 + 8) = -1;
}
return result;
}