//
// cocos2d::CCParticleBatchNode::reorderChild from 0x180063f10 to 0x180064127 (535 bytes)
//
// 5 xrefs:
// > ??> @ 0x1801007f0
// > ??> @ 0x180142d0c
// > ??> @ 0x180142d54
// > ??> @ 0x18014cf68
// > ??> @ 0x1801bda2c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:21:52 +0000
//
void __fastcall cocos2d::CCParticleBatchNode::reorderChild(cocos2d::CCArray **this, struct cocos2d::CCNode *a2, int a3)
{
unsigned int v5; // ebx
char v6; // bp
char v7; // r12
int v8; // r13d
unsigned int v9; // r14d
unsigned int v10; // r15d
unsigned int v11; // eax
struct cocos2d::CCNode *v12; // r14
__int64 v13; // r8
unsigned int v14; // r14d
unsigned int v15; // ebp
unsigned int v16; // ebx
cocos2d::CCTextureAtlas *v17; // rbx
unsigned int v18; // eax
unsigned int v19; // [rsp+70h] [rbp+8h]
unsigned int v20; // [rsp+78h] [rbp+10h]
v5 = 0;
_RTDynamicCast(a2, 0, &cocos2d::CCNode `RTTI Type Descriptor', &cocos2d::CCParticleSystem `RTTI Type Descriptor', 0);
cocos2d::CCArray::containsObject(*(this + 26), a2);
if ( a3 != (*(unsigned int (__fastcall **)(struct cocos2d::CCNode *))(*(_QWORD *)a2 + 96LL))(a2) )
{
if ( (unsigned int)cocos2d::CCArray::count(*(this + 26)) > 1 )
{
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v10 = 0;
v19 = 0;
v11 = cocos2d::CCArray::count(*(this + 26));
v20 = v11;
if ( v11 )
{
do
{
v12 = cocos2d::CCArray::stringAtIndex(*(this + 26), v5);
if ( (*(int (__fastcall **)(struct cocos2d::CCNode *))(*(_QWORD *)v12 + 96LL))(v12) > a3 && !v6 )
{
v10 = v5;
v6 = 1;
if ( v7 )
{
v9 = v19;
goto LABEL_15;
}
}
if ( a2 == v12 )
{
v19 = v5;
v7 = 1;
if ( v6 )
{
v9 = v5;
goto LABEL_15;
}
v8 = -1;
}
v11 = v20;
++v5;
}
while ( v5 < v20 );
v9 = v19;
if ( v6 )
goto LABEL_15;
}
v10 = v11;
LABEL_15:
if ( v9 != v8 + v10 )
{
cocos2d::CCObject::retain(a2);
LOBYTE(v13) = 1;
cocos2d::CCArray::removeObjectAtIndex(*(this + 26), v9, v13);
cocos2d::CCArray::insertObject(*(this + 26), a2);
cocos2d::CCObject::release(a2);
v14 = *((_DWORD *)a2 + 112);
cocos2d::CCParticleBatchNode::updateAllAtlasIndexes((cocos2d::CCParticleBatchNode *)this);
v15 = 0;
v16 = 0;
if ( (unsigned int)cocos2d::CCArray::count(*(this + 26)) )
{
while ( cocos2d::CCArray::stringAtIndex(*(this + 26), v16) != a2 )
{
if ( ++v16 >= (unsigned int)cocos2d::CCArray::count(*(this + 26)) )
goto LABEL_21;
}
v15 = *((_DWORD *)a2 + 112);
}
LABEL_21:
v17 = *(this + 41);
v18 = (*(__int64 (__fastcall **)(struct cocos2d::CCNode *))(*(_QWORD *)a2 + 1488LL))(a2);
cocos2d::CCTextureAtlas::moveQuadsFromIndex(v17, v14, v18, v15);
(*(void (__fastcall **)(struct cocos2d::CCNode *))(*(_QWORD *)a2 + 1592LL))(a2);
}
}
(*(void (__fastcall **)(struct cocos2d::CCNode *, _QWORD))(*(_QWORD *)a2 + 88LL))(a2, (unsigned int)a3);
}
}