//
// cocos2d::CCSpriteBatchNode::updateAtlasIndex from 0x1800924e0 to 0x18009269b (443 bytes)
//
// 8 xrefs:
// > cocos2d::CCSpriteBatchNode::sortAllChildren @ 0x1800923a0
// > cocos2d::CCSpriteBatchNode::updateAtlasIndex @ 0x180092552
// > cocos2d::CCSpriteBatchNode::updateAtlasIndex @ 0x18009261a
// > ??> @ 0x180146bf4
// > ??> @ 0x180146c04
// > ??> @ 0x180146c18
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c03fc
//
// 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::updateAtlasIndex(
cocos2d::CCSpriteBatchNode *this,
struct cocos2d::CCSprite *a2,
int *a3)
{
__int64 v6; // rax
char v7; // cl
__int64 v8; // rdi
unsigned int *v9; // rdx
__int64 v10; // rcx
struct cocos2d::CCSprite **v11; // rdi
struct cocos2d::CCSprite **i; // rsi
char v13; // bp
int v14; // edx
unsigned int *v15; // rsi
__int64 v16; // rax
struct cocos2d::CCSprite **v17; // rsi
struct cocos2d::CCSprite **j; // r12
struct cocos2d::CCSprite *v19; // rdi
int v20; // edx
int v21; // edx
int v22; // edx
v6 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2);
v7 = *((_BYTE *)a2 + 559);
v8 = v6;
if ( v6 && (v9 = *(unsigned int **)(v6 + 56), *v9) )
{
if ( v7 )
{
v10 = *v9;
if ( (_DWORD)v10 )
{
v11 = *((struct cocos2d::CCSprite ***)v9 + 2);
for ( i = &v11[v10 - 1]; v11 <= i; ++v11 )
{
if ( !*v11 )
break;
cocos2d::CCSpriteBatchNode::updateAtlasIndex(this, *v11, a3);
}
}
}
else
{
v13 = 1;
if ( (*(int (__fastcall **)(_QWORD))(***((_QWORD ***)v9 + 2) + 96LL))(**((_QWORD **)v9 + 2)) >= 0 )
{
v14 = *((_DWORD *)a2 + 90);
*((_DWORD *)a2 + 90) = *a3;
if ( v14 != *a3 )
cocos2d::CCSpriteBatchNode::swap(this, v14, *a3);
++*a3;
v13 = 0;
}
v15 = *(unsigned int **)(v8 + 56);
v16 = *v15;
if ( (_DWORD)v16 )
{
v17 = *((struct cocos2d::CCSprite ***)v15 + 2);
for ( j = &v17[v16 - 1]; v17 <= j; ++v17 )
{
v19 = *v17;
if ( !*v17 )
break;
if ( v13 && (*(int (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v19 + 96LL))(*v17) >= 0 )
{
v20 = *((_DWORD *)a2 + 90);
*((_DWORD *)a2 + 90) = *a3;
if ( v20 != *a3 )
cocos2d::CCSpriteBatchNode::swap(this, v20, *a3);
++*a3;
v13 = 0;
}
cocos2d::CCSpriteBatchNode::updateAtlasIndex(this, v19, a3);
}
}
if ( v13 )
{
v21 = *((_DWORD *)a2 + 90);
*((_DWORD *)a2 + 90) = *a3;
if ( v21 != *a3 )
cocos2d::CCSpriteBatchNode::swap(this, v21, *a3);
++*a3;
}
}
}
else if ( !v7 )
{
v22 = *((_DWORD *)a2 + 90);
*((_DWORD *)a2 + 90) = *a3;
if ( v22 != *a3 )
cocos2d::CCSpriteBatchNode::swap(this, v22, *a3);
++*a3;
}
}