//
// sub_1007478F0 from 0x1007478f0 to 0x10074796a (122 bytes)
//
// 3 xrefs:
// > cocos2d::CCTMXLayer::setupTiles @ 0x100244141
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x10024458e
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x100245141
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:36:31 +0000
//
__int64 __fastcall sub_1007478F0(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;
}