//
// cocos2d::CCParticleBatchNode::addChildHelper from 0x1003c8d40 to 0x1003c8e67 (295 bytes)
//
// 1 xrefs:
// > cocos2d::CCParticleBatchNode::addChild @ 0x1003c8ce0
//
// 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
//
unsigned int __fastcall cocos2d::CCParticleBatchNode::addChildHelper(
cocos2d::CCParticleBatchNode *a1,
cocos2d::CCParticleSystem *a2,
int a3,
int a4)
{
cocos2d::CCArray *m_pChildren; // rdi
unsigned int v8; // eax
unsigned int v9; // r12d
unsigned int v10; // r13d
__int64 v11; // rax
cocos2d::CCArray *v12; // r12
unsigned int v14; // [rsp+0h] [rbp-2Ch]
((void (__fastcall *)(cocos2d::CCParticleSystem *))a2->getParent)(a2);
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
{
v14 = a4;
v8 = sub_100720070(m_pChildren);
if ( v8 )
goto LABEL_3;
LABEL_8:
v10 = 0;
goto LABEL_9;
}
v12 = (cocos2d::CCArray *)operator new(0x40u);
sub_10071F890(v12);
a1->m_pChildren = v12;
sub_10071F950(v12, 4);
v14 = a4;
v8 = sub_100720070(a1->m_pChildren);
if ( !v8 )
goto LABEL_8;
LABEL_3:
v9 = v8;
v10 = 0;
while ( 1 )
{
v11 = sub_1007200C0(a1->m_pChildren, v10);
if ( (*(int (__fastcall **)(__int64))(*(_QWORD *)v11 + 104LL))(v11) > a3 )
break;
if ( v9 == ++v10 )
{
v10 = v9;
break;
}
}
LABEL_9:
sub_1007201F0(a1->m_pChildren, a2, v10);
((void (__fastcall *)(cocos2d::CCParticleSystem *, _QWORD))a2->setTag)(a2, v14);
((void (__fastcall *)(cocos2d::CCParticleSystem *, _QWORD))a2->_setZOrder)(a2, (unsigned int)a3);
((void (__fastcall *)(cocos2d::CCParticleSystem *, cocos2d::CCParticleBatchNode *))a2->setParent)(a2, a1);
if ( a1->m_bRunning )
{
((void (__fastcall *)(cocos2d::CCParticleSystem *))a2->onEnter)(a2);
((void (__fastcall *)(cocos2d::CCParticleSystem *))a2->onEnterTransitionDidFinish)(a2);
}
return v10;
}