//
// LevelEditorLayer::~LevelEditorLayer from 0x798848 to 0x79901c (2004 bytes)
//
// 5 xrefs:
// > `non-virtual thunk to'LevelEditorLayer::~LevelEditorLayer @ 0x799020
// > LevelEditorLayer::~LevelEditorLayer @ 0x799034
// > ??> @ 0xd18c0
// > ??> @ 0xee4c8
// > ??> @ 0x14359a8
//
// 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 12:53:35 +0000
//
// Alternative name is '_ZN16LevelEditorLayerD2Ev'
void __fastcall LevelEditorLayer::~LevelEditorLayer(LevelEditorLayer *this)
{
__int64 v1; // x2
LocalLevelManager *v3; // x0
std::mutex *v4; // x20
LocalLevelManager *v5; // x0
unsigned __int8 *v6; // x2
__int64 v7; // x0
__int64 v8; // x1
_BOOL4 v9; // w22
cocos2d::CCObject *v11; // x0
cocos2d::CCObject *v12; // x0
cocos2d::CCObject *v13; // x0
cocos2d::CCObject *v14; // x0
cocos2d::CCObject *v15; // x0
cocos2d::CCObject *v16; // x0
cocos2d::CCObject *v17; // x0
cocos2d::CCObject *v18; // x0
cocos2d::CCObject *v19; // x0
cocos2d::CCObject *v20; // x0
cocos2d::CCObject *v21; // x0
cocos2d::CCObject *v22; // x0
cocos2d::CCObject *v23; // x0
cocos2d::CCObject *v24; // x0
cocos2d::CCObject *v25; // x0
cocos2d::CCObject *v26; // x0
cocos2d::CCObject *v27; // x0
cocos2d::CCObject *v28; // x0
cocos2d::CCObject *v29; // x0
cocos2d::CCObject *v30; // x0
cocos2d::CCObject *v31; // x0
cocos2d::CCObject *v32; // x0
cocos2d::CCObject *v33; // x0
cocos2d::CCObject *v34; // x0
cocos2d::CCObject *v35; // x0
unsigned __int64 v36; // x0
void **v37; // x22
void **i; // x20
void *v39; // t1
void **v40; // x22
void **v41; // x20
void *v42; // t1
__int64 v43; // x2
__int64 v44; // x1
void **v45; // x3
GameManager *v46; // x0
void *v47; // x0
char *v48; // x0
char *v49; // x3
char *v50; // x0
char *v51; // x3
_QWORD *v52; // x0
_QWORD *v53; // x22
void *v54; // x0
char *v55; // x0
char *v56; // x2
char *v57; // x0
char *v58; // x2
char *v59; // x0
char *v60; // x2
void *v61; // x0
void *v62; // x0
void *v63; // x0
char *v64; // x0
char *v65; // x2
void *v66; // x0
void *v67; // x0
void *v68; // x0
char *v69; // x0
char *v70; // x2
_QWORD *v71; // x22
_QWORD *v72; // x2
char *v73; // x0
char *v74; // x3
char *v75; // x0
char *v76; // x2
char *v77; // x0
char *v78; // x2
char *v79; // x0
char *v80; // x2
char *v81; // x0
char *v82; // x2
__int64 v83; // x22
unsigned __int8 v84; // w1
int v85; // w4
size_t v86; // x2
unsigned __int8 v87; // w1
int v88; // w7
__int64 v89; // x3
unsigned __int8 *v90; // x3
unsigned __int8 *v91; // x1
unsigned __int8 *v92; // x2
int v93; // t1
unsigned __int8 *v94; // x2
GameToolbox *v95; // x0
__int64 v96; // x1
LocalLevelManager *SaveDirectory; // x0
__int64 v98; // x0
void *v99; // x1
size_t v100; // x2
__int64 v101; // x0
__int64 v102; // x3
char v103; // w1
char *v104; // x0
LocalLevelManager *v105; // x0
__int64 v106; // x0
_QWORD v107[2]; // [xsp+38h] [xbp+38h] BYREF
char *filename; // [xsp+48h] [xbp+48h]
_BYTE v109[16]; // [xsp+50h] [xbp+50h] BYREF
void *v110; // [xsp+60h] [xbp+60h]
__int64 v111; // [xsp+68h] [xbp+68h]
v1 = _stack_chk_guard;
*(_QWORD *)this = &off_14359A0;
*((_QWORD *)this + 1749) = &off_1436138;
*((_QWORD *)this + 40) = off_1436008;
*((_QWORD *)this + 41) = &off_1436078;
*((_QWORD *)this + 42) = off_1436090;
*((_QWORD *)this + 43) = off_14360B0;
*((_QWORD *)this + 44) = off_14360D8;
*((_QWORD *)this + 51) = off_1436108;
v111 = v1;
v3 = (LocalLevelManager *)LevelEditorLayer::waitForAutoSave(this);
v4 = (std::mutex *)(LocalLevelManager::sharedState(v3) + 464);
v5 = (LocalLevelManager *)std::mutex::lock(v4);
v6 = (unsigned __int8 *)(LocalLevelManager::sharedState(v5) + 528);
v7 = *v6;
v8 = (unsigned __int8)v7 >> 1;
if ( (v7 & 1) != 0 )
v8 = *((_QWORD *)v6 + 1);
if ( !v8 )
goto LABEL_4;
v83 = LocalLevelManager::sharedState((LocalLevelManager *)v7);
v7 = LocalLevelManager::sharedState((LocalLevelManager *)v83);
v84 = *(_BYTE *)(v83 + 528);
v85 = v84 & 1;
v86 = v84 >> 1;
if ( (v84 & 1) != 0 )
v86 = *(_QWORD *)(v83 + 536);
v87 = *(_BYTE *)(v7 + 504);
v88 = v87 & 1;
v89 = v87 >> 1;
if ( (v87 & 1) != 0 )
v89 = *(_QWORD *)(v7 + 512);
if ( v86 != v89 )
goto LABEL_4;
v90 = (unsigned __int8 *)(v83 + 529);
if ( v85 )
v90 = *(unsigned __int8 **)(v83 + 544);
v91 = (unsigned __int8 *)(v7 + 505);
if ( v88 )
v91 = *(unsigned __int8 **)(v7 + 520);
if ( !v85 )
{
if ( !v86 )
{
LABEL_161:
v9 = 1;
goto LABEL_5;
}
v7 = *v91;
if ( *v90 == (_DWORD)v7 )
{
v7 = (__int64)(v90 + 1);
v92 = &v90[v86];
do
{
++v91;
if ( (unsigned __int8 *)v7 == v92 )
goto LABEL_161;
v93 = *(unsigned __int8 *)v7++;
}
while ( *v91 == v93 );
}
LABEL_4:
v9 = 0;
goto LABEL_5;
}
v9 = 1;
if ( v86 )
{
v7 = memcmp(v90, v91, v86);
v9 = v7 == 0;
}
LABEL_5:
if ( !atomic_load((unsigned __int8 *)(LocalLevelManager::sharedState((LocalLevelManager *)v7) + 577)) )
{
v94 = (unsigned __int8 *)(LocalLevelManager::sharedState(nullptr) + 504);
v95 = (GameToolbox *)*v94;
v96 = (unsigned __int8)v95 >> 1;
if ( ((unsigned __int8)v95 & 1) != 0 )
v96 = *((_QWORD *)v94 + 1);
if ( v96 && !v9 )
{
SaveDirectory = (LocalLevelManager *)GameToolbox::getSaveDirectory(v95, (__int64)v109);
v98 = LocalLevelManager::sharedState(SaveDirectory);
if ( (*(_BYTE *)(v98 + 504) & 1) != 0 )
{
v99 = *(void **)(v98 + 520);
v100 = *(_QWORD *)(v98 + 512);
}
else
{
v99 = (void *)(v98 + 505);
v100 = *(_BYTE *)(v98 + 504) >> 1;
}
v101 = std::string::append((__int64)v109, v99, v100);
v102 = *(_QWORD *)(v101 + 8);
v107[0] = *(_QWORD *)v101;
v107[1] = v102;
filename = *(char **)(v101 + 16);
*(_QWORD *)v101 = 0;
*(_QWORD *)(v101 + 8) = 0;
v103 = v109[0];
*(_QWORD *)(v101 + 16) = 0;
if ( (v103 & 1) != 0 )
operator delete(v110);
v104 = (char *)v107 + 1;
if ( (v107[0] & 1) != 0 )
v104 = filename;
v105 = (LocalLevelManager *)remove(v104);
v106 = LocalLevelManager::sharedState(v105);
if ( (*(_BYTE *)(v106 + 504) & 1) != 0 )
{
**(_BYTE **)(v106 + 520) = 0;
*(_QWORD *)(v106 + 512) = 0;
}
else
{
*(_BYTE *)(v106 + 505) = 0;
*(_BYTE *)(v106 + 504) = 0;
}
if ( (v107[0] & 1) != 0 )
operator delete(filename);
}
}
std::mutex::unlock(v4);
v11 = *((cocos2d::CCObject **)this + 1782);
if ( v11 )
cocos2d::CCObject::release(v11);
v12 = *((cocos2d::CCObject **)this + 1783);
if ( v12 )
cocos2d::CCObject::release(v12);
v13 = *((cocos2d::CCObject **)this + 242);
if ( v13 )
cocos2d::CCObject::release(v13);
v14 = *((cocos2d::CCObject **)this + 409);
if ( v14 )
cocos2d::CCObject::release(v14);
v15 = *((cocos2d::CCObject **)this + 1777);
if ( v15 )
cocos2d::CCObject::release(v15);
v16 = *((cocos2d::CCObject **)this + 408);
if ( v16 )
cocos2d::CCObject::release(v16);
v17 = *((cocos2d::CCObject **)this + 1554);
if ( v17 )
cocos2d::CCObject::release(v17);
v18 = *((cocos2d::CCObject **)this + 1765);
if ( v18 )
cocos2d::CCObject::release(v18);
v19 = *((cocos2d::CCObject **)this + 1766);
if ( v19 )
cocos2d::CCObject::release(v19);
v20 = *((cocos2d::CCObject **)this + 1754);
if ( v20 )
cocos2d::CCObject::release(v20);
v21 = *((cocos2d::CCObject **)this + 1755);
if ( v21 )
cocos2d::CCObject::release(v21);
v22 = *((cocos2d::CCObject **)this + 1756);
if ( v22 )
cocos2d::CCObject::release(v22);
v23 = *((cocos2d::CCObject **)this + 1757);
if ( v23 )
cocos2d::CCObject::release(v23);
v24 = *((cocos2d::CCObject **)this + 1759);
if ( v24 )
cocos2d::CCObject::release(v24);
v25 = *((cocos2d::CCObject **)this + 1764);
if ( v25 )
cocos2d::CCObject::release(v25);
v26 = *((cocos2d::CCObject **)this + 1758);
if ( v26 )
cocos2d::CCObject::release(v26);
v27 = *((cocos2d::CCObject **)this + 1763);
if ( v27 )
cocos2d::CCObject::release(v27);
v28 = *((cocos2d::CCObject **)this + 1772);
if ( v28 )
cocos2d::CCObject::release(v28);
v29 = *((cocos2d::CCObject **)this + 1797);
if ( v29 )
cocos2d::CCObject::release(v29);
v30 = *((cocos2d::CCObject **)this + 1774);
if ( v30 )
cocos2d::CCObject::release(v30);
v31 = *((cocos2d::CCObject **)this + 1775);
if ( v31 )
cocos2d::CCObject::release(v31);
v32 = *((cocos2d::CCObject **)this + 1767);
if ( v32 )
cocos2d::CCObject::release(v32);
v33 = *((cocos2d::CCObject **)this + 1768);
if ( v33 )
cocos2d::CCObject::release(v33);
v34 = *((cocos2d::CCObject **)this + 1760);
if ( v34 )
cocos2d::CCObject::release(v34);
v35 = *((cocos2d::CCObject **)this + 1761);
if ( v35 )
cocos2d::CCObject::release(v35);
v36 = *((_QWORD *)this + 1762);
if ( v36 )
v36 = cocos2d::CCObject::release((cocos2d::CCObject *)v36);
v37 = *((void ***)this + 1857);
for ( i = *((void ***)this + 1856); v37 != i; ++i )
{
v39 = *i;
operator delete(v39);
}
v40 = *((void ***)this + 1860);
v41 = *((void ***)this + 1859);
if ( v41 == v40 )
{
v43 = *((_QWORD *)this + 1856);
v45 = *((void ***)this + 1860);
v44 = *((_QWORD *)this + 1857);
if ( v43 == v44 )
goto LABEL_66;
goto LABEL_63;
}
do
{
v42 = *v41++;
operator delete(v42);
}
while ( v40 != v41 );
v43 = *((_QWORD *)this + 1856);
v44 = *((_QWORD *)this + 1857);
v45 = *((void ***)this + 1859);
v40 = *((void ***)this + 1860);
if ( v43 != v44 )
{
LABEL_63:
v36 = v44 + 8 * ~((unsigned __int64)(v44 - 8 - v43) >> 3);
*((_QWORD *)this + 1857) = v36;
}
if ( v40 != v45 )
{
v36 = ~((unsigned __int64)((char *)(v40 - 1) - (char *)v45) >> 3);
*((_QWORD *)this + 1860) = &v40[v36];
}
LABEL_66:
v46 = (GameManager *)GameManager::sharedState((GameManager *)v36);
*((_QWORD *)v46 + 69) = 0;
*(_BYTE *)(GameManager::sharedState(v46) + 706) = 0;
if ( (*((_BYTE *)this + 15088) & 1) != 0 )
operator delete(*((void **)this + 1888));
if ( (*((_BYTE *)this + 15064) & 1) != 0 )
operator delete(*((void **)this + 1885));
sub_7886CC(*((_QWORD **)this + 1879));
v47 = *((void **)this + 1877);
*((_QWORD *)this + 1877) = 0;
if ( v47 )
operator delete(v47);
v48 = *((char **)this + 1874);
if ( v48 )
{
v49 = *((char **)this + 1875);
if ( v48 != v49 )
*((_QWORD *)this + 1875) = &v49[-48
* ((0xAAAAAAAAAAAAAABLL * ((unsigned __int64)(v49 - 48 - v48) >> 4))
& 0xFFFFFFFFFFFFFFFLL)
- 48];
operator delete(v48);
}
v50 = *((char **)this + 1871);
if ( v50 )
{
v51 = *((char **)this + 1872);
if ( v50 != v51 )
*((_QWORD *)this + 1872) = &v51[-48
* ((0xAAAAAAAAAAAAAABLL * ((unsigned __int64)(v51 - 48 - v50) >> 4))
& 0xFFFFFFFFFFFFFFFLL)
- 48];
operator delete(v50);
}
v52 = *((_QWORD **)this + 1864);
if ( v52 )
{
do
{
v53 = (_QWORD *)*v52;
operator delete(v52);
v52 = v53;
}
while ( v53 );
}
v54 = *((void **)this + 1862);
*((_QWORD *)this + 1862) = 0;
if ( v54 )
operator delete(v54);
v55 = *((char **)this + 1859);
if ( v55 )
{
v56 = *((char **)this + 1860);
if ( v55 != v56 )
*((_QWORD *)this + 1860) = &v56[8 * ~((unsigned __int64)(v56 - 8 - v55) >> 3)];
operator delete(v55);
}
v57 = *((char **)this + 1856);
if ( v57 )
{
v58 = *((char **)this + 1857);
if ( v57 != v58 )
*((_QWORD *)this + 1857) = &v58[8 * ~((unsigned __int64)(v58 - 8 - v57) >> 3)];
operator delete(v57);
}
v59 = *((char **)this + 1833);
if ( v59 )
{
v60 = *((char **)this + 1834);
if ( v59 != v60 )
*((_QWORD *)this + 1834) = &v60[4 * ~((unsigned __int64)(v60 - 4 - v59) >> 2)];
operator delete(v59);
}
v61 = *((void **)this + 1830);
if ( v61 )
{
if ( v61 != *((void **)this + 1831) )
*((_QWORD *)this + 1831) = v61;
operator delete(v61);
}
v62 = *((void **)this + 1827);
if ( v62 )
operator delete(v62);
v63 = *((void **)this + 1824);
if ( v63 )
operator delete(v63);
v64 = *((char **)this + 1820);
if ( v64 )
{
v65 = *((char **)this + 1821);
if ( v64 != v65 )
*((_QWORD *)this + 1821) = &v65[8 * ~((unsigned __int64)(v65 - 8 - v64) >> 3)];
operator delete(v64);
}
v66 = *((void **)this + 1816);
if ( v66 )
operator delete(v66);
v67 = *((void **)this + 1813);
if ( v67 )
operator delete(v67);
v68 = *((void **)this + 1810);
if ( v68 )
operator delete(v68);
v69 = *((char **)this + 1807);
if ( v69 )
{
v70 = *((char **)this + 1808);
if ( v69 != v70 )
*((_QWORD *)this + 1808) = &v70[8 * ~((unsigned __int64)(v70 - 8 - v69) >> 3)];
operator delete(v69);
}
v71 = *((_QWORD **)this + 1804);
if ( v71 )
{
v72 = *((_QWORD **)this + 1805);
if ( v71 != v72 )
{
do
{
*((_QWORD *)this + 1805) = v72 - 3;
v73 = (char *)*(v72 - 3);
if ( v73 )
{
v74 = (char *)*(v72 - 2);
if ( v73 != v74 )
*(v72 - 2) = &v74[8 * ~((unsigned __int64)(v74 - 8 - v73) >> 3)];
operator delete(v73);
}
v72 = *((_QWORD **)this + 1805);
}
while ( v71 != v72 );
v72 = *((_QWORD **)this + 1804);
}
operator delete(v72);
}
v75 = *((char **)this + 1801);
if ( v75 )
{
v76 = *((char **)this + 1802);
if ( v75 != v76 )
*((_QWORD *)this + 1802) = &v76[8 * ~((unsigned __int64)(v76 - 8 - v75) >> 3)];
operator delete(v75);
}
v77 = *((char **)this + 1798);
if ( v77 )
{
v78 = *((char **)this + 1799);
if ( v77 != v78 )
*((_QWORD *)this + 1799) = &v78[8 * ~((unsigned __int64)(v78 - 8 - v77) >> 3)];
operator delete(v77);
}
v79 = *((char **)this + 1794);
if ( v79 )
{
v80 = *((char **)this + 1795);
if ( v79 != v80 )
*((_QWORD *)this + 1795) = &v80[8 * ~((unsigned __int64)(v80 - 8 - v79) >> 3)];
operator delete(v79);
}
v81 = *((char **)this + 1791);
if ( v81 )
{
v82 = *((char **)this + 1792);
if ( v81 != v82 )
*((_QWORD *)this + 1792) = &v82[8 * ~((unsigned __int64)(v82 - 8 - v81) >> 3)];
operator delete(v81);
}
if ( (*((_BYTE *)this + 14304) & 1) != 0 )
operator delete(*((void **)this + 1790));
GJBaseGameLayer::~GJBaseGameLayer(this);
}