//
// sub_100667720 from 0x100667720 to 0x100667780 (96 bytes)
//
// 1 xrefs:
// > cocos2d::CCArray::addObjectNew @ 0x1007201e9
//
// 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_100667720(unsigned int *a1, cocos2d::CCObject *a2)
{
unsigned int v3; // esi
void *v4; // rax
__int64 v5; // rsi
__int64 v6; // rcx
__int64 result; // rax
v3 = a1[1];
if ( v3 < *a1 + 1 )
{
v4 = *((void **)a1 + 2);
do
{
v5 = 2 * v3;
a1[1] = v5;
v4 = realloc(v4, 8 * v5);
*((_QWORD *)a1 + 2) = v4;
v3 = a1[1];
}
while ( v3 < *a1 + 1 );
}
cocos2d::CCObject::retain(a2);
v6 = *a1;
*(_QWORD *)(*((_QWORD *)a1 + 2) + 8 * v6) = a2;
a2->m_uIndexInArray = v6;
result = (unsigned int)(v6 + 1);
*a1 = result;
return result;
}