//
// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x100156e20 to 0x100156fa9 (393 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x10015709d
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x1001572c9
//
// 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::atlasIndexForChild(__int64 a1, __int64 a2, int a3)
{
__int64 v5; // rax
__int64 v6; // rbx
int v7; // r13d
__int64 v8; // rax
__int64 v9; // r12
__int64 v10; // rsi
_DWORD *v11; // rbx
__int64 i; // rax
__int64 v13; // r14
__int64 j; // rax
__int64 v15; // r14
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 512LL))(a2);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 488LL))(v5);
v7 = sub_1007FEFB0(v6, a2);
v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 512LL))(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_1007FEFE0(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 **)(__int64))(*(_QWORD *)a2 + 512LL))(a2);
}
else
{
for ( i = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 488LL))(v11);
i;
i = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 488LL))(v11) )
{
v13 = i;
if ( !(unsigned int)sub_1007FEF90(i) )
break;
v11 = (_DWORD *)sub_1007FF000(v13);
}
}
return (unsigned int)(v11[90] + 1);
}
return (unsigned int)(*(_DWORD *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 512LL))(a2) + 360)
+ (a3 >= 0));
}
}
if ( v7 )
{
for ( j = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 488LL))(v11);
j;
j = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v11 + 488LL))(v11) )
{
v15 = j;
if ( !(unsigned int)sub_1007FEF90(j) )
break;
v11 = (_DWORD *)sub_1007FF000(v15);
}
return (unsigned int)(v11[90] + 1);
}
return 0;
}