//
// sub_100667630 from 0x100667630 to 0x10066768d (93 bytes)
//
// 5 xrefs:
// > cocos2d::CCNode::getChildren @ 0x1002728fd
// > cocos2d::CCNode::updateChildIndexes @ 0x100272929
// > cocos2d::CCNode::sortAllChildren @ 0x1002735e9
// > cocos2d::CCNode::sortAllChildrenWithIndex @ 0x100273766
// > cocos2d::CCNode::qsortAllChildrenWithIndex @ 0x1002738f6
//
// 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_100667630(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rcx
__int64 v3; // rdx
int v4; // esi
__int64 v5; // r8
result = *(unsigned int *)(a1 + 8);
if ( result != 0xFFFFFFFFLL )
{
if ( (int)result > 0 )
{
v2 = *(_QWORD *)(a1 + 16);
v3 = 0;
v4 = 0;
do
{
v5 = *(_QWORD *)(v2 + 8 * v3);
if ( v5 )
{
if ( v4 > 0 )
{
*(_QWORD *)(v2 - 8LL * v4 + 8 * v3) = v5;
*(_DWORD *)(v5 + 36) = v3 - v4;
}
}
else
{
++v4;
}
++v3;
}
while ( result != v3 );
}
*(_DWORD *)(a1 + 8) = -1;
}
return result;
}