//
// cocos2d::CCComponentContainer::removeAll from 0x1001652e4 to 0x100165454 (368 bytes)
//
// 1 xrefs:
// > ??> @ 0x10079bda0
//
// 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::CCComponentContainer::removeAll(cocos2d::CCComponentContainer *a1)
{
cocos2d::CCDictionary *m_pComponents; // x8
cocos2d::CCDictElement *m_pElements; // x20
char *prev; // x8
cocos2d::CCDictElement *next; // x21
cocos2d::CCDictionary *v6; // x9
cocos2d::CCDictElement **p_m_pElements; // x9
cocos2d::CCDictElement *v8; // x10
cocos2d::CCDictElement *v9; // t1
UT_hash_table *tbl; // x11
std::ptrdiff_t hho; // x12
cocos2d::CCDictElement *v12; // x11
cocos2d::CCDictElement **v13; // x12
_QWORD *m_szKey; // x9
__int64 v15; // x9
__int64 v16; // x8
UT_hash_handle *hh_prev; // x8
UT_hash_handle *hh_next; // x10
void *v19; // x0
m_pComponents = a1->m_pComponents;
if ( m_pComponents )
{
m_pElements = m_pComponents->m_pElements;
if ( !m_pElements )
{
LABEL_23:
cocos2d::CCNode::unscheduleUpdate(a1->m_pOwner);
return;
}
while ( 1 )
{
prev = (char *)m_pElements->hh.prev;
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( prev )
break;
v6 = a1->m_pComponents;
if ( next )
goto LABEL_8;
free(v6->m_pElements->hh.tbl->buckets);
free(a1->m_pComponents->m_pElements->hh.tbl);
a1->m_pComponents->m_pElements = nullptr;
LABEL_22:
((void (__fastcall *)(cocos2d::CCObject *))m_pElements->m_pObject->__vftable[1].~CCObject_0)(m_pElements->m_pObject);
sub_10012A620((__int64)m_pElements->m_pObject, 0);
cocos2d::CCObject::release(m_pElements->m_pObject);
v19 = (void *)nullsub_212(m_pElements);
operator delete(v19);
m_pElements = next;
if ( !next )
goto LABEL_23;
}
v6 = a1->m_pComponents;
LABEL_8:
v9 = v6->m_pElements;
p_m_pElements = &v6->m_pElements;
v8 = v9;
tbl = v9->hh.tbl;
hho = tbl->hho;
if ( m_pElements == (cocos2d::CCDictElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)&prev[hho];
v12 = (cocos2d::CCDictElement *)m_pElements->hh.next;
v13 = (cocos2d::CCDictElement **)&prev[hho + 16];
if ( prev )
{
m_szKey = v8->m_szKey;
}
else
{
v13 = p_m_pElements;
m_szKey = m_pElements->hh.next;
}
*v13 = v12;
v15 = m_szKey[34];
if ( v12 )
*(_QWORD *)&v12->m_szKey[*(_QWORD *)(v15 + 32) + 8] = prev;
v16 = *(_QWORD *)v15 + 16LL * ((*(_DWORD *)(v15 + 8) - 1) & m_pElements->hh.hashv);
--*(_DWORD *)(v16 + 8);
if ( *(cocos2d::CCDictElement **)v16 == (cocos2d::CCDictElement *)&m_pElements->hh )
*(_QWORD *)v16 = m_pElements->hh.hh_next;
hh_prev = m_pElements->hh.hh_prev;
hh_next = m_pElements->hh.hh_next;
if ( hh_prev )
hh_prev->hh_next = hh_next;
if ( hh_next )
hh_next->hh_prev = hh_prev;
--*(_DWORD *)(v15 + 16);
goto LABEL_22;
}
}