//
// cocos2d::CCSpriteBatchNode::sortAllChildren from 0x100176f20 to 0x100177057 (311 bytes)
//
// 4 xrefs:
// > ??> @ 0x1008c2e68
// > ??> @ 0x1008eab18
// > ??> @ 0x10095de20
// > ??> @ 0x100974308
//
// 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 __fastcall cocos2d::CCSpriteBatchNode::sortAllChildren(cocos2d::CCSpriteBatchNode *a1)
{
cocos2d::CCArray *m_pChildren; // rax
cocos2d::ccArray *data; // rcx
cocos2d::CCObject **arr; // r14
unsigned __int64 v4; // r15
cocos2d::CCArray *v5; // rax
cocos2d::ccArray *v6; // rax
__int64 num; // rcx
cocos2d::CCSprite **v8; // r15
unsigned __int64 v9; // r12
int v10; // [rsp-2Ch] [rbp-2Ch] BYREF
if ( a1->m_bReorderChildDirty && (!a1->m_bManualSortChildren || a1->m_bManualSortAllChildrenDirty) )
{
if ( a1->m_bUseChildIndex )
{
cocos2d::CCNode::sortAllChildrenWithIndex(a1);
if ( !(unsigned int)sub_100720070(a1->m_pChildren) )
goto LABEL_20;
}
else
{
cocos2d::CCNode::sortAllChildrenNoIndex(a1);
if ( !(unsigned int)sub_100720070(a1->m_pChildren) )
goto LABEL_20;
}
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
{
data = m_pChildren->data;
if ( data->num )
{
arr = data->arr;
v4 = (unsigned __int64)&arr[data->num - 1];
do
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCObject *))(*arr)->__vftable[7].isEqual)(*arr);
++arr;
}
while ( (unsigned __int64)arr <= v4 );
v5 = a1->m_pChildren;
v10 = 0;
if ( !v5 )
goto LABEL_20;
v6 = v5->data;
num = v6->num;
if ( !v6->num )
goto LABEL_20;
goto LABEL_17;
}
v10 = 0;
v6 = m_pChildren->data;
num = v6->num;
if ( v6->num )
{
LABEL_17:
v8 = (cocos2d::CCSprite **)v6->arr;
v9 = (unsigned __int64)&v8[num - 1];
do
{
if ( !*v8 )
break;
cocos2d::CCSpriteBatchNode::updateAtlasIndex(a1, *v8++, &v10);
}
while ( (unsigned __int64)v8 <= v9 );
}
}
LABEL_20:
a1->m_bReorderChildDirty = 0;
a1->m_bManualSortAllChildrenDirty = 0;
}
}