//
// cocos2d::CCTMXMapInfo::endElement from 0xdadf60 to 0xdae2a8 (840 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'cocos2d::CCTMXMapInfo::endElement @ 0xdae2ac
// > ??> @ 0x5f2d8
// > ??> @ 0x15313e8
//
// This function is hookable on this platform (idp: arm, 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 13:08:36 +0000
//
__int64 __fastcall cocos2d::CCTMXMapInfo::endElement(cocos2d::CCTMXMapInfo *this, void *a2, const char *a3)
{
size_t v4; // x0
int v5; // w22
int v6; // w23
__int64 v7; // x19
__int64 v8; // x4
int v9; // w4
__int64 v10; // x1
char *v11; // x22
cocos2d::CCArray *v12; // x0
__int64 Object; // x24
size_t v14; // x0
const unsigned __int8 *v15; // x1
cocos2d *v16; // x0
unsigned int v17; // w19
cocos2d::ZipUtils *v18; // x0
int v20; // w19
__int64 v21; // [xsp+0h] [xbp+0h] BYREF
void *v22; // [xsp+48h] [xbp+48h]
unsigned int v23; // [xsp+5Ch] [xbp+5Ch]
cocos2d::ZipUtils *v24; // [xsp+60h] [xbp+60h] BYREF
cocos2d::ZipUtils *v25; // [xsp+68h] [xbp+68h] BYREF
float v26[2]; // [xsp+70h] [xbp+70h] BYREF
__int64 v27; // [xsp+78h] [xbp+78h] BYREF
__int64 v28; // [xsp+80h] [xbp+80h]
void *v29; // [xsp+88h] [xbp+88h]
__int64 v30; // [xsp+90h] [xbp+90h] BYREF
const unsigned __int8 *v31; // [xsp+98h] [xbp+98h]
void *v32; // [xsp+A0h] [xbp+A0h]
v22 = (void *)a3;
v27 = 0;
v28 = 0;
v29 = nullptr;
v4 = strlen(a3);
std::string::__init(&v27, v22, v4);
v5 = (unsigned __int8)v27;
v6 = v27 & 1;
if ( v6 )
{
v7 = v28;
if ( v28 != 4 )
{
LABEL_3:
if ( v7 != 3 )
{
if ( v7 != 5 )
goto LABEL_5;
goto LABEL_40;
}
if ( (unsigned int)std::string::compare((__int64)&v27, 0, 0xFFFFFFFFFFFFFFFFLL, "map", 3u) )
goto LABEL_6;
*((_DWORD *)this + 28) = 0;
LABEL_29:
if ( v6 )
goto LABEL_30;
return _stack_chk_guard;
}
}
else
{
v9 = (int)(unsigned __int8)v27 >> 1;
if ( v9 != 4 )
goto LABEL_22;
}
if ( !(unsigned int)std::string::compare((__int64)&v27, 0, 0xFFFFFFFFFFFFFFFFLL, "data", 4u)
&& (*((_DWORD *)this + 30) & 2) != 0 )
{
v10 = *(_QWORD *)this;
*((_BYTE *)this + 124) = 0;
v11 = (char *)this + 185;
v12 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCTMXMapInfo *))(v10 + 80))(this);
Object = cocos2d::CCArray::lastObject(v12);
if ( (*((_BYTE *)this + 184) & 1) != 0 )
v11 = *((char **)this + 25);
v30 = 0;
v31 = nullptr;
v32 = nullptr;
v14 = strlen(v11);
std::string::__init(&v30, v11, v14);
if ( (v30 & 1) != 0 )
{
v16 = (cocos2d *)v32;
v15 = v31;
}
else
{
v15 = (const unsigned __int8 *)((unsigned __int8)v30 >> 1);
v16 = (cocos2d *)((char *)&v30 + 1);
}
v17 = base64Decode(v16, v15, (void **)&v24, 0);
v18 = v24;
if ( !v24 )
goto LABEL_36;
if ( (*((_DWORD *)this + 30) & 0xC) != 0 )
{
cocos2d::CCSize::CCSize(v26, (const cocos2d::CCSize *)(Object + 88));
cocos2d::ZipUtils::ccInflateMemoryWithHint(
v24,
(unsigned __int8 *)v17,
(void **)&v25,
(unsigned __int8 **)(unsigned int)(int)(float)((float)(v26[0] * v26[1]) * 4.0));
v23 = (unsigned int)&v21 + 92;
if ( v24 )
operator delete[](v24);
v18 = v25;
v24 = nullptr;
if ( !v25 )
{
LABEL_36:
if ( (v30 & 1) != 0 )
operator delete(v32);
if ( (v27 & 1) != 0 )
goto LABEL_30;
return _stack_chk_guard;
}
}
*(_QWORD *)(Object + 96) = v18;
std::string::assign((__int64 *)this + 23, &byte_11B8890);
if ( (v30 & 1) != 0 )
operator delete(v32);
v6 = v27 & 1;
goto LABEL_19;
}
v9 = v5 >> 1;
if ( v6 )
{
v7 = v28;
goto LABEL_3;
}
LABEL_22:
v20 = v9;
if ( v9 == 3 )
{
if ( (unsigned int)std::string::compare((__int64)&v27, 0, 0xFFFFFFFFFFFFFFFFLL, "map", 3u) )
goto LABEL_25;
*((_DWORD *)this + 28) = 0;
goto LABEL_29;
}
if ( v9 != 5 )
goto LABEL_24;
LABEL_40:
if ( !(unsigned int)std::string::compare((__int64)&v27, 0, 0xFFFFFFFFFFFFFFFFLL, "layer", 5u) )
goto LABEL_28;
v20 = v5 >> 1;
if ( !v6 )
{
LABEL_24:
if ( v20 == 11 )
{
LABEL_43:
if ( (unsigned int)std::string::compare((__int64)&v27, 0, 0xFFFFFFFFFFFFFFFFLL, "objectgroup", 0xBu) )
{
v20 = v5 >> 1;
if ( v6 )
{
v8 = v28;
goto LABEL_26;
}
goto LABEL_25;
}
LABEL_28:
*((_DWORD *)this + 28) = 0;
goto LABEL_29;
}
LABEL_25:
v8 = v20;
goto LABEL_26;
}
v7 = v28;
LABEL_5:
if ( v7 == 11 )
goto LABEL_43;
LABEL_6:
v8 = v7;
LABEL_26:
if ( v8 == 6 && !(unsigned int)std::string::compare((__int64)&v27, 0, 0xFFFFFFFFFFFFFFFFLL, "object", 6u) )
goto LABEL_28;
LABEL_19:
if ( v6 )
LABEL_30:
operator delete(v29);
return _stack_chk_guard;
}