//
// cocos2d::ccCArrayInsertValueAtIndex from 0xb21980 to 0xb21a0c (140 bytes)
//
// 3 xrefs:
// > cocos2d::CCTMXLayer::insertTileForGID @ 0xb3958c
// > cocos2d::CCTMXLayer::appendTileForGID @ 0xb398a0
// > ??> @ 0xb6400
//
// 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 cocos2d::ccCArrayInsertValueAtIndex(__int64 a1, __int64 a2, unsigned int a3)
{
unsigned int v4; // w21
__int64 v6; // x20
__int64 v7; // x1
__int64 result; // x0
unsigned int v9; // [xsp+38h] [xbp+38h]
v4 = *(_DWORD *)a1 - a3;
if ( *(_DWORD *)a1 + 1 == *(_DWORD *)(a1 + 4) )
{
v9 = a3;
cocos2d::ccCArrayDoubleCapacity(a1);
a3 = v9;
}
v6 = 8LL * a3;
if ( v4 )
memmove((void *)(*(_QWORD *)(a1 + 16) + 8LL * (a3 + 1)), (const void *)(*(_QWORD *)(a1 + 16) + v6), 8LL * v4);
v7 = *(_QWORD *)(a1 + 16);
result = (unsigned int)(*(_DWORD *)a1 + 1);
*(_DWORD *)a1 = result;
*(_QWORD *)(v7 + v6) = a2;
return result;
}