//
// cocos2d::CCSpriteBatchNode::insertQuadFromSprite from 0x100157420 to 0x100157551 (305 bytes)
//
// 3 xrefs:
// > cocos2d::CCTMXLayer::setupTiles @ 0x10024412e
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x10024457c
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x10024512f
//
// 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:25:04 +0000
//
__int64 __fastcall cocos2d::CCSpriteBatchNode::insertQuadFromSprite(__int64 a1, __int64 a2, unsigned int a3)
{
int v4; // r12d
unsigned int v5; // r12d
__int128 v6; // xmm0
__int128 v7; // xmm1
__int128 v8; // xmm2
__int64 v9; // rcx
__int64 v10; // r8
__int64 v11; // r9
_OWORD v13[9]; // [rsp+0h] [rbp-90h] BYREF
while ( 1 )
{
if ( (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 328) + 88LL))(*(_QWORD *)(a1 + 328)) > a3 )
{
v4 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 328) + 88LL))(*(_QWORD *)(a1 + 328));
if ( v4 != (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 328) + 80LL))(*(_QWORD *)(a1 + 328)) )
break;
}
v5 = (4 * (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 328) + 88LL))(*(_QWORD *)(a1 + 328)) + 4) / 3;
if ( (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 328) + 88LL))(*(_QWORD *)(a1 + 328)) < v5 )
cocos2d::CCTextureAtlas::resizeCapacity(*(_QWORD *)(a1 + 328), v5);
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a2 + 1120LL))(a2, a1);
*(_DWORD *)(a2 + 360) = a3;
v13[5] = *(_OWORD *)(a2 + 540);
v13[4] = *(_OWORD *)(a2 + 524);
v6 = *(_OWORD *)(a2 + 460);
v7 = *(_OWORD *)(a2 + 476);
v8 = *(_OWORD *)(a2 + 492);
v13[3] = *(_OWORD *)(a2 + 508);
v13[2] = v8;
v13[1] = v7;
v13[0] = v6;
((void (__fastcall *)(_QWORD, _OWORD *, _QWORD, __int64, __int64, __int64))cocos2d::CCTextureAtlas::insertQuad)(
*(_QWORD *)(a1 + 328),
v13,
a3,
v9,
v10,
v11);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a2 + 1200LL))(a2, 1);
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 792LL))(a2);
}