//
// cocos2d::CCSpriteBatchNode::sortAllChildren from 0x1001d7830 to 0x1001d793c (268 bytes)
//
// 3 xrefs:
// > ??> @ 0x10076cc78
// > ??> @ 0x1007bf690
// > ??> @ 0x1007e9d30
//
// 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)
{
__int64 v1; // x29
__int64 v2; // x30
cocos2d::CCArray *m_pChildren; // x8
cocos2d::ccArray *data; // x10
__int64 num; // x9
cocos2d::CCObject **arr; // x20
unsigned __int64 v8; // x21
cocos2d::ccArray *v9; // x9
__int64 v10; // x8
cocos2d::CCSprite **v11; // x20
unsigned __int64 v12; // x21
int v13; // [xsp+Ch] [xbp-34h] BYREF
__int64 v14; // [xsp+30h] [xbp-10h]
__int64 v15; // [xsp+38h] [xbp-8h]
if ( a1->m_bReorderChildDirty )
{
v14 = v1;
v15 = v2;
if ( !a1->m_bManualSortChildren || a1->m_bManualSortAllChildrenDirty )
{
if ( a1->m_bUseChildIndex )
j_cocos2d::CCNode::qsortAllChildrenWithIndex(a1);
else
cocos2d::CCNode::sortAllChildrenNoIndex(a1);
if ( !(unsigned int)sub_10024A36C(a1->m_pChildren) )
goto LABEL_20;
m_pChildren = a1->m_pChildren;
if ( !m_pChildren )
goto LABEL_20;
data = m_pChildren->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v8 = (unsigned __int64)&arr[num - 1];
do
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCObject *))(*arr)->__vftable[7].isEqual)(*arr);
++arr;
}
while ( (unsigned __int64)arr <= v8 );
m_pChildren = a1->m_pChildren;
v13 = 0;
if ( !m_pChildren )
{
LABEL_20:
a1->m_bReorderChildDirty = 0;
a1->m_bManualSortAllChildrenDirty = 0;
return;
}
}
else
{
v13 = 0;
}
v9 = m_pChildren->data;
v10 = v9->num;
if ( (_DWORD)v10 )
{
v11 = (cocos2d::CCSprite **)v9->arr;
v12 = (unsigned __int64)&v11[v10 - 1];
do
{
if ( !*v11 )
break;
cocos2d::CCSpriteBatchNode::updateAtlasIndex(a1, *v11++, &v13);
}
while ( (unsigned __int64)v11 <= v12 );
}
goto LABEL_20;
}
}
}