//
// sub_1006683C0 from 0x1006683c0 to 0x10066843a (122 bytes)
//
// 3 xrefs:
// > cocos2d::CCTMXLayer::setupTiles @ 0x10025a1b1
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x10025a5fe
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x10025b1b1
//
// 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_1006683C0(int *a1, __int64 a2, unsigned int a3)
{
int v5; // r12d
int v6; // esi
__int64 v7; // rsi
__int64 result; // rax
v5 = *a1;
v6 = a1[1];
if ( *a1 + 1 == v6 )
{
v7 = (unsigned int)(2 * v6);
a1[1] = v7;
*((_QWORD *)a1 + 2) = realloc(*((void **)a1 + 2), 8 * v7);
}
if ( v5 != a3 )
memmove(
(void *)(*((_QWORD *)a1 + 2) + 8LL * (a3 + 1)),
(const void *)(*((_QWORD *)a1 + 2) + 8LL * a3),
8LL * (v5 - a3));
++*a1;
result = *((_QWORD *)a1 + 2);
*(_QWORD *)(result + 8LL * a3) = a2;
return result;
}