//
// cocos2d::CCComponentContainer::remove from 0xda00e0 to 0xda0300 (544 bytes)
//
// 2 xrefs:
// > ??> @ 0xd9450
// > ??> @ 0x152fa58
//
// This function is hookable on this platform (idp: arm, 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 13:08:29 +0000
//
__int64 __fastcall cocos2d::CCComponentContainer::remove(cocos2d::CCComponentContainer *this, cocos2d::CCComponent *a2)
{
__int64 v2; // x2
__int64 v3; // x2
__int64 v4; // x19
__int64 v5; // x3
__int64 v9; // x1
__int64 v10; // x3
__int64 v11; // x4
__int64 v12; // x5
__int64 v13; // x2
__int64 v14; // x3
__int64 v15; // x1
__int64 v16; // x2
__int64 v17; // x1
__int64 v18; // x1
__int64 v19; // x1
v2 = *((_QWORD *)this + 1);
if ( !v2 )
return 0;
v3 = *(_QWORD *)(v2 + 56);
if ( !v3 )
return 1;
v4 = *(_QWORD *)(v3 + 288);
if ( *(cocos2d::CCComponent **)(v3 + 264) != a2 )
{
if ( v4 )
{
while ( 1 )
{
v5 = *(_QWORD *)(v4 + 288);
if ( *(cocos2d::CCComponent **)(v4 + 264) == a2 )
break;
v4 = *(_QWORD *)(v4 + 288);
if ( !v5 )
return 1;
}
goto LABEL_9;
}
return 1;
}
v4 = v3;
LABEL_9:
(*(void (__fastcall **)(cocos2d::CCComponent *))(*(_QWORD *)a2 + 96LL))(a2);
cocos2d::CCComponent::setOwner((__int64)a2, nullptr);
v9 = *(_QWORD *)(v4 + 280);
if ( *(_OWORD *)(v4 + 280) == 0 )
{
free(**(void ***)(*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) + 272LL));
free(*(void **)(*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) + 272LL));
*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) = 0;
}
else
{
v10 = *((_QWORD *)this + 1);
v11 = *(_QWORD *)(*(_QWORD *)(v10 + 56) + 272LL);
v12 = *(_QWORD *)(v11 + 32);
if ( *(_QWORD *)(v11 + 24) - v12 == v4 )
{
*(_QWORD *)(v11 + 24) = v9 + v12;
v9 = *(_QWORD *)(v4 + 280);
v10 = *((_QWORD *)this + 1);
}
if ( v9 )
*(_QWORD *)(v9 + *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v10 + 56) + 272LL) + 32LL) + 16) = *(_QWORD *)(v4 + 288);
else
*(_QWORD *)(v10 + 56) = *(_QWORD *)(v4 + 288);
v13 = *(_QWORD *)(v4 + 288);
if ( v13 )
*(_QWORD *)(v13 + *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) + 272LL) + 32LL) + 8) = *(_QWORD *)(v4 + 280);
v14 = *(_QWORD *)(*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) + 272LL);
v15 = 16LL * ((unsigned int)(*(_DWORD *)(v14 + 8) - 1) & *(_DWORD *)(v4 + 324));
--*(_DWORD *)(*(_QWORD *)v14 + v15 + 8);
v16 = **(_QWORD **)(*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) + 272LL);
if ( *(_QWORD *)(v16 + v15) == v4 + 272 )
*(_QWORD *)(v16 + v15) = *(_QWORD *)(v4 + 304);
v17 = *(_QWORD *)(v4 + 296);
if ( v17 )
*(_QWORD *)(v17 + 32) = *(_QWORD *)(v4 + 304);
v18 = *(_QWORD *)(v4 + 304);
if ( v18 )
*(_QWORD *)(v18 + 24) = *(_QWORD *)(v4 + 296);
v19 = *(_QWORD *)(*(_QWORD *)(*((_QWORD *)this + 1) + 56LL) + 272LL);
--*(_DWORD *)(v19 + 16);
}
cocos2d::CCObject::release(*(_DWORD **)(v4 + 264));
cocos2d::CCDictElement::~CCDictElement((cocos2d::CCDictElement *)v4);
operator delete((void *)v4);
return 1;
}