//
// cocos2d::CCTMXLayer::atlasIndexForNewZ from 0xb38a84 to 0xb38ad8 (84 bytes)
//
// 2 xrefs:
// > cocos2d::CCTMXLayer::insertTileForGID @ 0xb39568
// > ??> @ 0xb9820
//
// 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 cocos2d::CCTMXLayer::atlasIndexForNewZ(cocos2d::CCTMXLayer *a1, int a2)
{
__int64 v2; // x2
unsigned int result; // w0
_QWORD *v4; // x3
__int64 *v5; // x3
unsigned int v6; // w2
__int64 v7; // t1
v2 = *(_QWORD *)&a1[1].m_fSkewY;
result = *(_DWORD *)v2;
if ( *(_DWORD *)v2 )
{
v4 = *(_QWORD **)(v2 + 16);
if ( a2 < (int)*v4 )
{
return 0;
}
else
{
v5 = v4 + 1;
v6 = 0;
while ( ++v6 != result )
{
v7 = *v5++;
if ( (int)v7 > a2 )
return v6;
}
}
}
return result;
}