//
// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x100177a70 to 0x100177bf9 (393 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x100177ced
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x100177f19
//
// 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
//
unsigned int __fastcall cocos2d::CCSpriteBatchNode::atlasIndexForChild(
cocos2d::CCSpriteBatchNode *a1,
cocos2d::CCSprite *a2,
int a3)
{
__int64 v5; // rax
__int64 v6; // rbx
int v7; // r13d
cocos2d::CCSpriteBatchNode *v8; // rax
cocos2d::CCSpriteBatchNode *v9; // r12
__int64 v10; // rsi
_DWORD *v11; // rbx
__int64 i; // rax
__int64 v13; // r14
__int64 j; // rax
__int64 v15; // r14
v5 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getParent)(a2);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 472LL))(v5);
v7 = sub_100720090(v6, a2);
v8 = (cocos2d::CCSpriteBatchNode *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getParent)(a2);
v9 = v8;
v10 = (unsigned int)(v7 - 1);
if ( (unsigned int)v10 > 0xFFFFFFFD )
{
v11 = nullptr;
if ( v8 != a1 )
goto LABEL_3;
}
else
{
v11 = (_DWORD *)sub_1007200C0(v6, v10);
if ( v9 != a1 )
{
LABEL_3:
if ( v7 )
{
if ( (int)(a3 & (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 104LL))(v11)) >= 0
&& (int)(a3 | (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 104LL))(v11)) < 0 )
{
v11 = (_DWORD *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getParent)(a2);
}
else
{
for ( i = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 472LL))(v11);
i;
i = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 472LL))(v11) )
{
v13 = i;
if ( !(unsigned int)sub_100720070(i) )
break;
v11 = (_DWORD *)sub_1007200E0(v13);
}
}
return v11[90] + 1;
}
return *(_DWORD *)(((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getParent)(a2) + 360) + (a3 >= 0);
}
}
if ( v7 )
{
for ( j = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 472LL))(v11);
j;
j = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 472LL))(v11) )
{
v15 = j;
if ( !(unsigned int)sub_100720070(j) )
break;
v11 = (_DWORD *)sub_1007200E0(v15);
}
return v11[90] + 1;
}
return 0;
}