//
// sub_100668190 from 0x100668190 to 0x100668230 (160 bytes)
//
// 0 xrefs:
//
// 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_100668190(unsigned int *a1, __int64 a2)
{
unsigned int v3; // eax
int v4; // r15d
unsigned __int64 v6; // r12
__int64 v7; // rcx
cocos2d::CCObject *v8; // rdi
__int64 v9; // rsi
__int64 result; // rax
v3 = *a1;
v4 = 0;
if ( *a1 )
{
if ( *(_DWORD *)a2 )
{
v6 = 0;
v4 = 0;
do
{
while ( 1 )
{
v7 = *((_QWORD *)a1 + 2);
v8 = *(cocos2d::CCObject **)(v7 + 8 * v6);
if ( *(_DWORD *)a2 )
{
v9 = 0;
while ( *(cocos2d::CCObject **)(*(_QWORD *)(a2 + 16) + 8 * v9) != v8 )
{
if ( *(_DWORD *)a2 == (_DWORD)++v9 )
goto LABEL_4;
}
if ( (_DWORD)v9 != -1 )
break;
}
LABEL_4:
*(_QWORD *)(v7 + 8LL * (unsigned int)(v6++ - v4)) = v8;
if ( v6 >= v3 )
goto LABEL_16;
}
if ( v8 )
{
cocos2d::CCObject::release(v8);
v3 = *a1;
}
++v4;
++v6;
}
while ( v6 < v3 );
}
}
else
{
v3 = 0;
}
LABEL_16:
result = v3 - v4;
*a1 = result;
return result;
}