//
// cocos2d::CCSpriteBatchNode::insertChild from 0x1800919e0 to 0x180091c74 (660 bytes)
//
// 4 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x180091b9c
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x180091c48
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c02e8
//
// 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 11:22:08 +0000
//
void __fastcall cocos2d::CCSpriteBatchNode::insertChild(
cocos2d::CCTextureAtlas **this,
struct cocos2d::CCSprite *a2,
unsigned int a3)
{
__int64 v6; // rax
__int64 v7; // rdx
__int64 v8; // rdi
int v9; // ebx
cocos2d::CCTextureAtlas *v10; // rcx
__int128 v11; // xmm1
__int128 v12; // xmm0
__int128 v13; // xmm1
__int128 v14; // xmm0
__int128 v15; // xmm1
__int64 v16; // rbx
__int64 j; // r8
__int64 v18; // rdx
struct cocos2d::CCSprite **v19; // rdi
__int64 v20; // rbx
unsigned __int64 k; // rsi
struct cocos2d::CCSprite *v22; // rbx
int v23; // eax
unsigned int v24; // eax
struct cocos2d::CCSprite **v25; // rdi
__int64 v26; // rbx
unsigned __int64 i; // rsi
struct cocos2d::CCSprite *v28; // rbx
int v29; // eax
unsigned int v30; // eax
_OWORD v31[6]; // [rsp+20h] [rbp-98h] BYREF
(*(void (__fastcall **)(struct cocos2d::CCSprite *, cocos2d::CCTextureAtlas **))(*(_QWORD *)a2 + 968LL))(a2, this);
v6 = *(_QWORD *)a2;
LOBYTE(v7) = 1;
*((_DWORD *)a2 + 90) = a3;
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v6 + 1048))(a2, v7);
if ( *((_BYTE *)a2 + 559) )
{
if ( (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2) )
{
if ( **(_DWORD **)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2) + 56) )
{
v25 = *(struct cocos2d::CCSprite ***)(*(_QWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
+ 16LL);
v26 = *(_QWORD *)(*(_QWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
+ 16LL);
for ( i = v26
+ 8
* (**(unsigned int **)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
- 1LL); (unsigned __int64)v25 <= i; ++v25 )
{
v28 = *v25;
if ( !*v25 )
break;
v29 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v28 + 96LL))(*v25);
v30 = cocos2d::CCSpriteBatchNode::atlasIndexForChild((cocos2d::CCSpriteBatchNode *)this, v28, v29);
cocos2d::CCSpriteBatchNode::insertChild((cocos2d::CCSpriteBatchNode *)this, v28, v30);
}
}
}
}
else
{
v8 = (__int64)*(this + 41);
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 72LL))(v8);
if ( v9 == (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v8 + 80LL))(v8) )
cocos2d::CCSpriteBatchNode::increaseAtlasCapacity((cocos2d::CCSpriteBatchNode *)this);
v10 = *(this + 41);
v11 = *(_OWORD *)((char *)a2 + 476);
v31[0] = *(_OWORD *)((char *)a2 + 460);
v12 = *(_OWORD *)((char *)a2 + 492);
v31[1] = v11;
v13 = *(_OWORD *)((char *)a2 + 508);
v31[2] = v12;
v14 = *(_OWORD *)((char *)a2 + 524);
v31[3] = v13;
v15 = *(_OWORD *)((char *)a2 + 540);
v31[4] = v14;
v31[5] = v15;
cocos2d::CCTextureAtlas::insertQuad(v10, (struct cocos2d::_ccV3F_C4B_T2F_Quad *)v31, a3);
v16 = *((_QWORD *)*(this + 43) + 7);
sub_1800A1840(v16, a2, a3);
for ( j = a3 + 1; (unsigned int)j < *(_DWORD *)v16; ++*(_DWORD *)(v18 + 360) )
{
v18 = *(_QWORD *)(*(_QWORD *)(v16 + 16) + 8 * j);
j = (unsigned int)(j + 1);
}
if ( (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2) )
{
if ( **(_DWORD **)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2) + 56) )
{
v19 = *(struct cocos2d::CCSprite ***)(*(_QWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
+ 16LL);
v20 = *(_QWORD *)(*(_QWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
+ 16LL);
for ( k = v20
+ 8
* (**(unsigned int **)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
- 1LL); (unsigned __int64)v19 <= k; ++v19 )
{
v22 = *v19;
if ( !*v19 )
break;
v23 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v22 + 96LL))(*v19);
v24 = cocos2d::CCSpriteBatchNode::atlasIndexForChild((cocos2d::CCSpriteBatchNode *)this, v22, v23);
cocos2d::CCSpriteBatchNode::insertChild((cocos2d::CCSpriteBatchNode *)this, v22, v24);
}
}
}
}
}