//
// cocos2d::CCTileMapAtlas::calculateItemsToRender from 0x1002110b0 to 0x100211196 (230 bytes)
//
// 0 xrefs:
//
// 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:26:58 +0000
//
__int64 __fastcall cocos2d::CCTileMapAtlas::calculateItemsToRender(__int64 a1)
{
__int64 v1; // rdx
__int64 result; // rax
__int64 v3; // rcx
_BYTE *v4; // rdx
int v5; // r10d
_BYTE *v6; // r11
__int64 i; // rbx
__int64 v8; // r14
_BYTE *v9; // r15
*(_DWORD *)(a1 + 424) = 0;
v1 = *(_QWORD *)(a1 + 408);
result = *(__int16 *)(v1 + 6);
if ( result > 0 )
{
v3 = *(__int16 *)(v1 + 8);
if ( v3 > 0 )
{
v4 = *(_BYTE **)(v1 + 16);
v5 = 0;
v6 = v4;
for ( i = 0; i != result; ++i )
{
if ( (_WORD)v3 == 1 )
{
v8 = 0;
}
else
{
v9 = v6;
v8 = 0;
do
{
if ( *v9 )
*(_DWORD *)(a1 + 424) = ++v5;
if ( v9[3 * result] )
*(_DWORD *)(a1 + 424) = ++v5;
v8 += 2;
v9 += 6 * result;
}
while ( (v3 & 0x7FFE) != v8 );
}
if ( (v3 & 1) != 0 )
{
if ( v4[3 * i + 3 * result * v8] )
*(_DWORD *)(a1 + 424) = ++v5;
}
v6 += 3;
}
}
}
return result;
}