//
// cocos2d::CCParticleBatchNode::reorderChild from 0x1003c9080 to 0x1003c931d (669 bytes)
//
// 1 xrefs:
// > ??> @ 0x10092ed38
//
// 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::CCParticleBatchNode::reorderChild(
cocos2d::CCParticleBatchNode *a1,
cocos2d::CCNode *a2,
int a3)
{
unsigned int v4; // r13d
unsigned int v5; // r12d
char v6; // r15
cocos2d::CCNode *v7; // rbx
int v8; // eax
cocos2d::CCParticleBatchNode *v9; // r15
unsigned int v10; // ebx
unsigned int v11; // r12d
float b; // r12d
cocos2d::CCArray *m_pChildren; // rdi
float v14; // r13d
cocos2d::ccArray *data; // rax
cocos2d::CCObject **arr; // rbx
unsigned __int64 v17; // r15
int v18; // r12d
cocos2d::CCObject *v19; // rdi
unsigned int v20; // ebx
cocos2d::CCTextureAtlas *m_pTextureAtlas; // rbx
unsigned int v22; // eax
int v23; // [rsp+8h] [rbp-48h]
int v24; // [rsp+Ch] [rbp-44h]
cocos2d::CCParticleBatchNode *v25; // [rsp+10h] [rbp-40h]
int v26; // [rsp+1Ch] [rbp-34h]
unsigned int v27; // [rsp+20h] [rbp-30h]
float v28; // [rsp+20h] [rbp-30h]
int v29; // [rsp+24h] [rbp-2Ch]
sub_100720160(a1->m_pChildren, a2);
v23 = a3;
if ( ((unsigned int (__fastcall *)(cocos2d::CCNode *))a2->getZOrder)(a2) != a3 )
{
if ( (unsigned int)sub_100720070(a1->m_pChildren) >= 2 )
{
v27 = sub_100720070(a1->m_pChildren);
if ( v27 )
{
v4 = 0;
v26 = 0;
v24 = 0;
v5 = 0;
v6 = 0;
v29 = 0;
while ( 1 )
{
while ( 1 )
{
v7 = (cocos2d::CCNode *)sub_1007200C0(a1->m_pChildren, v5);
v8 = ((__int64 (__fastcall *)(cocos2d::CCNode *))v7->getZOrder)(v7);
if ( v8 > v23 )
{
v8 = v24;
LOBYTE(v8) = v6 | ~(_BYTE)v24;
if ( (v6 & 1) == 0 )
{
v4 = v5;
v6 = 1;
}
if ( (v8 & 1) == 0 )
goto LABEL_16;
}
if ( v7 == a2 )
break;
if ( v27 == ++v5 )
goto LABEL_14;
}
if ( (v6 & 1) != 0 )
break;
LOBYTE(v8) = 1;
v24 = v8;
v29 = -1;
v26 = v5++;
if ( v27 == v5 )
{
LABEL_14:
v5 = v27;
if ( (v6 & 1) != 0 )
v5 = v4;
LABEL_16:
v9 = a1;
v10 = v26;
goto LABEL_19;
}
}
v10 = v5;
v5 = v4;
v9 = a1;
LABEL_19:
v11 = v29 + v5;
if ( v10 != v11 )
{
cocos2d::CCObject::retain(a2);
sub_100720230(v9->m_pChildren, v10, 1);
sub_1007201F0(v9->m_pChildren, a2, v11);
cocos2d::CCObject::release(a2);
b = a2[1].m_sAdditionalTransform.b;
m_pChildren = v9->m_pChildren;
v14 = 0.0;
if ( m_pChildren )
{
data = m_pChildren->data;
if ( data->num )
{
v28 = a2[1].m_sAdditionalTransform.b;
v25 = v9;
arr = data->arr;
v17 = (unsigned __int64)&arr[data->num - 1];
v18 = 0;
do
{
v19 = *arr;
if ( !*arr )
break;
v19[7].m_uOrderOfArrival = v18;
v18 += ((__int64 (__fastcall *)(cocos2d::CCObject *))v19->__vftable[18].update)(v19);
++arr;
}
while ( (unsigned __int64)arr <= v17 );
v9 = v25;
m_pChildren = v25->m_pChildren;
b = v28;
}
}
else
{
m_pChildren = nullptr;
}
if ( (unsigned int)sub_100720070(m_pChildren) )
{
v20 = 0;
while ( (cocos2d::CCNode *)sub_1007200C0(v9->m_pChildren, v20) != a2 )
{
if ( ++v20 >= (unsigned int)sub_100720070(v9->m_pChildren) )
{
v14 = 0.0;
goto LABEL_33;
}
}
v14 = a2[1].m_sAdditionalTransform.b;
}
LABEL_33:
m_pTextureAtlas = v9->m_pTextureAtlas;
v22 = ((__int64 (__fastcall *)(cocos2d::CCNode *))a2->__vftable[1].setGrid)(a2);
cocos2d::CCTextureAtlas::moveQuadsFromIndex(m_pTextureAtlas, LODWORD(b), v22, LODWORD(v14));
((void (__fastcall *)(cocos2d::CCNode *))a2->__vftable[1].visit)(a2);
}
}
}
((void (__fastcall *)(cocos2d::CCNode *, _QWORD))a2->_setZOrder)(a2, (unsigned int)v23);
}
}