//
// cocos2d::CCTMXTiledMap::buildWithMapInfo from 0x100519600 to 0x1005197cb (459 bytes)
//
// 4 xrefs:
// > cocos2d::CCTMXTiledMap::create @ 0x100519381
// > cocos2d::CCTMXTiledMap::initWithTMXFile @ 0x100519494
// > cocos2d::CCTMXTiledMap::createWithXML @ 0x100519555
// > cocos2d::CCTMXTiledMap::initWithXML @ 0x1005195e8
//
// 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:31:41 +0000
//
unsigned int *__fastcall cocos2d::CCTMXTiledMap::buildWithMapInfo(unsigned int *a1, __int64 a2)
{
__int64 v2; // r13
_DWORD *v4; // rdi
__int64 v5; // rax
_DWORD *v6; // rdi
__int64 v7; // rax
_DWORD *v8; // rdi
__int64 TileProperties; // rax
unsigned int *result; // rax
unsigned int *v11; // r15
unsigned int *v12; // rdi
__int64 *v13; // r12
unsigned __int64 v14; // rbx
unsigned int v15; // r15d
__int64 v16; // rsi
__int64 v17; // r13
unsigned __int64 *v18; // r13
_QWORD *v19; // rax
__m128 v20; // xmm1
unsigned __int64 v21; // [rsp+0h] [rbp-40h]
double v23[6]; // [rsp+10h] [rbp-30h] BYREF
v2 = a2;
sub_100278660(a1 + 79, (_QWORD *)(a2 + 68));
sub_100278660(a1 + 81, (_QWORD *)(a2 + 76));
a1[83] = *(_DWORD *)(a2 + 64);
v4 = *((_DWORD **)a1 + 42);
if ( v4 )
cocos2d::CCObject::release(v4);
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 112LL))(a2);
*((_QWORD *)a1 + 42) = v5;
if ( v5 )
cocos2d::CCObject::retain(v5);
v6 = *((_DWORD **)a1 + 43);
if ( v6 )
cocos2d::CCObject::release(v6);
v7 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 128LL))(a2);
*((_QWORD *)a1 + 43) = v7;
if ( v7 )
cocos2d::CCObject::retain(v7);
v8 = *((_DWORD **)a1 + 44);
if ( v8 )
cocos2d::CCObject::release(v8);
TileProperties = cocos2d::CCTMXMapInfo::getTileProperties(a2);
*((_QWORD *)a1 + 44) = TileProperties;
if ( TileProperties )
cocos2d::CCObject::retain(TileProperties);
result = (unsigned int *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 80LL))(a2);
if ( result )
{
v11 = result;
v12 = result;
result = (unsigned int *)sub_1007FEF90(result);
if ( (_DWORD)result )
{
result = *((unsigned int **)v11 + 7);
if ( *result )
{
v13 = *((__int64 **)result + 2);
v14 = (unsigned __int64)&v13[*result - 1];
v15 = 0;
v21 = v14;
do
{
v16 = *v13;
if ( !*v13 )
break;
if ( *(_BYTE *)(v16 + 104) == 1 )
{
v17 = cocos2d::CCTMXTiledMap::parseLayer(v12, v16, v2);
(*(void (__fastcall **)(unsigned int *, __int64, _QWORD, _QWORD))(*(_QWORD *)a1 + 472LL))(a1, v17, v15, v15);
v18 = (unsigned __int64 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v17 + 328LL))(v17);
v19 = (_QWORD *)(*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)a1 + 328LL))(a1);
sub_100278630(v23, v19);
v20 = (__m128)*v18;
v2 = a2;
_mm_storel_ps(v23, _mm_max_ps(v20, (__m128)*(unsigned __int64 *)&v23[0]));
v12 = a1;
result = (unsigned int *)(*(__int64 (__fastcall **)(unsigned int *, double *))(*(_QWORD *)a1 + 320LL))(
a1,
v23);
v14 = v21;
++v15;
}
++v13;
}
while ( (unsigned __int64)v13 <= v14 );
}
}
}
return result;
}