//
// sub_100667FC0 from 0x100667fc0 to 0x100668023 (99 bytes)
//
// 1 xrefs:
// > sub_1007202B0 @ 0x1007202b9
//
// 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
//
__int64 __fastcall sub_100667FC0(unsigned int *a1, __int64 a2)
{
unsigned int v2; // ecx
__int64 v3; // rdx
__int64 v4; // rbx
unsigned int v5; // ecx
__int64 result; // rax
v2 = *a1;
if ( *a1 )
{
v3 = *((_QWORD *)a1 + 2);
v4 = 0;
while ( *(_QWORD *)(v3 + 8 * v4) != a2 )
{
if ( v2 == (_DWORD)++v4 )
return result;
}
if ( (_DWORD)v4 != -1 )
{
if ( *(_QWORD *)(v3 + 8 * v4) )
{
cocos2d::CCObject::release(*(cocos2d::CCObject **)(v3 + 8 * v4));
v3 = *((_QWORD *)a1 + 2);
v2 = *a1;
}
v5 = v2 - 1;
*a1 = v5;
result = *(_QWORD *)(v3 + 8LL * v5);
*(_QWORD *)(v3 + 8 * v4) = result;
}
}
return result;
}