//
// sub_18009E210 from 0x18009e210 to 0x18009e29e (142 bytes)
//
// 3 xrefs:
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x1800abf1c
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x1800ac576
// > ??> @ 0x1801b7578
//
// 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_18009E210(int *a1, __int64 a2, unsigned int a3)
{
int v3; // eax
int v5; // ecx
unsigned int v6; // ebp
__int64 v7; // r14
unsigned int v9; // eax
void *v10; // rcx
__int64 result; // rax
v3 = *a1;
v5 = a1[1];
v6 = v3 - a3;
v7 = a3;
if ( v3 + 1 == v5 )
{
v9 = 2 * v5;
v10 = *((void **)a1 + 2);
a1[1] = v9;
*((_QWORD *)a1 + 2) = realloc(v10, 8LL * v9);
}
if ( v6 )
memmove(
(void *)(*((_QWORD *)a1 + 2) + 8LL * (unsigned int)(v7 + 1)),
(const void *)(*((_QWORD *)a1 + 2) + 8 * v7),
8LL * v6);
result = *((_QWORD *)a1 + 2);
++*a1;
*(_QWORD *)(result + 8 * v7) = a2;
return result;
}