//
// sub_18009D8A0 from 0x18009d8a0 to 0x18009d911 (113 bytes)
//
// 4 xrefs:
// > cocos2d::CCArray::fastRemoveObject @ 0x180006eb4
// > ??> @ 0x18013efa0
// > ??> @ 0x18013efb0
// > ??> @ 0x1801b7428
//
// 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_18009D8A0(unsigned int *a1, __int64 a2)
{
unsigned int v2; // r9d
_QWORD *v4; // rcx
__int64 result; // rax
_QWORD *v6; // r8
__int64 v7; // rdi
cocos2d::CCObject *v8; // rcx
__int64 v9; // rcx
v2 = *a1;
v4 = *((_QWORD **)a1 + 2);
result = 0;
v6 = v4;
if ( v2 )
{
while ( *v6 != a2 )
{
result = (unsigned int)(result + 1);
++v6;
if ( (unsigned int)result >= v2 )
return result;
}
if ( (_DWORD)result != -1 )
{
v7 = 8 * result;
v8 = (cocos2d::CCObject *)v4[result];
if ( v8 )
cocos2d::CCObject::release(v8);
--*a1;
v9 = *((_QWORD *)a1 + 2);
result = *(_QWORD *)(v9 + 8LL * *a1);
*(_QWORD *)(v9 + v7) = result;
}
}
return result;
}