//
// LocalLevelManager::saveFinished from 0x914270 to 0x9145ac (828 bytes)
//
// 2 xrefs:
// > ??> @ 0xee930
// > ??> @ 0x1467438
//
// 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:57:18 +0000
//
__int64 __fastcall LocalLevelManager::saveFinished(LocalLevelManager *this, char a2)
{
__int64 v4; // x0
__int64 v5; // x20
__int64 v6; // x0
__int64 v7; // x22
__int64 v8; // x20
const char *v9; // x0
__int64 v10; // x20
__int64 i; // x0
__int64 v12; // x0
__int64 v13; // x2
__int64 v14; // x3
char v15; // w0
__int64 v16; // x2
__int64 v17; // x3
size_t v18; // x2
int v19; // w4
__int64 v20; // x1
const char *v21; // x0
char *v22; // x1
unsigned __int8 *v23; // x1
unsigned __int8 *v24; // x0
unsigned __int8 *v25; // x2
int v26; // t1
__int64 v27; // [xsp+48h] [xbp+48h] BYREF
__int64 v28; // [xsp+50h] [xbp+50h]
void *v29; // [xsp+58h] [xbp+58h]
__int64 v30; // [xsp+60h] [xbp+60h] BYREF
__int64 v31; // [xsp+68h] [xbp+68h]
void *v32; // [xsp+70h] [xbp+70h]
if ( !a2 )
return _stack_chk_guard;
v4 = GameLevelManager::sharedState(_stack_chk_guard);
GameLevelManager::prunePlatformerJournalKeys(v4, (__int64 *)this + 55);
v5 = *((_QWORD *)this + 55);
while ( 1 )
{
v6 = *((_QWORD *)this + 56);
if ( v5 == v6 )
break;
while ( 1 )
{
*((_QWORD *)this + 56) = v6 - 32;
if ( (*(_BYTE *)(v6 - 32) & 1) == 0 )
break;
operator delete(*(void **)(v6 - 16));
v6 = *((_QWORD *)this + 56);
if ( v5 == v6 )
goto LABEL_7;
}
}
LABEL_7:
v7 = *((_QWORD *)this + 53);
v8 = *((_QWORD *)this + 52);
if ( v8 != v7 )
{
do
{
v9 = (const char *)(v8 + 1);
if ( (*(_BYTE *)v8 & 1) != 0 )
v9 = *(const char **)(v8 + 16);
v8 += 24;
remove(v9);
}
while ( v7 != v8 );
v10 = *((_QWORD *)this + 52);
for ( i = *((_QWORD *)this + 53); i != v10; i = *((_QWORD *)this + 53) )
{
v12 = i - 24;
*((_QWORD *)this + 53) = v12;
std::string::~string(v12);
}
}
v27 = 0;
v28 = 0;
v29 = nullptr;
v30 = 0;
v31 = 0;
v32 = nullptr;
std::mutex::lock((LocalLevelManager *)((char *)this + 464));
std::string::reserve(&v27, 0);
v13 = *((_QWORD *)this + 66);
v14 = *((_QWORD *)this + 67);
v29 = *((void **)this + 68);
*((_QWORD *)this + 66) = 0;
v15 = v30;
*((_QWORD *)this + 67) = 0;
*((_QWORD *)this + 68) = 0;
v27 = v13;
v28 = v14;
if ( (v15 & 1) != 0 )
{
*(_BYTE *)v32 = 0;
v31 = 0;
}
else
{
LOWORD(v30) = 0;
}
std::string::reserve(&v30, 0);
v32 = *((void **)this + 71);
v16 = *((_QWORD *)this + 69);
v17 = *((_QWORD *)this + 70);
*((_QWORD *)this + 69) = 0;
*((_QWORD *)this + 70) = 0;
*((_QWORD *)this + 71) = 0;
v30 = v16;
v31 = v17;
if ( (*((_BYTE *)this + 528) & 1) != 0 )
{
**((_BYTE **)this + 68) = 0;
*((_QWORD *)this + 67) = 0;
}
else
{
*((_BYTE *)this + 529) = 0;
*((_BYTE *)this + 528) = 0;
}
if ( (*((_BYTE *)this + 552) & 1) != 0 )
{
**((_BYTE **)this + 71) = 0;
*((_QWORD *)this + 70) = 0;
}
else
{
*((_BYTE *)this + 553) = 0;
*((_BYTE *)this + 552) = 0;
}
v18 = *((_BYTE *)this + 504) >> 1;
if ( (*((_BYTE *)this + 504) & 1) != 0 )
v18 = *((_QWORD *)this + 64);
v19 = v27 & 1;
v20 = (unsigned __int8)v27 >> 1;
if ( v19 )
v20 = v28;
if ( v18 == v20 )
{
if ( (*((_BYTE *)this + 504) & 1) != 0 )
{
v22 = (char *)&v27 + 1;
if ( v19 )
v22 = (char *)v29;
if ( !v18 || !memcmp(*((const void **)this + 65), v22, v18) )
{
**((_BYTE **)this + 65) = 0;
*((_QWORD *)this + 64) = 0;
}
}
else
{
if ( v19 )
v23 = (unsigned __int8 *)v29;
else
v23 = (unsigned __int8 *)&v27 + 1;
if ( v18 )
{
if ( *((unsigned __int8 *)this + 505) != *v23 )
goto LABEL_24;
v24 = (unsigned __int8 *)this + 506;
v25 = (unsigned __int8 *)this + v18 + 505;
while ( 1 )
{
++v23;
if ( v24 == v25 )
break;
v26 = *v24++;
if ( *v23 != v26 )
goto LABEL_24;
}
}
*((_BYTE *)this + 505) = 0;
*((_BYTE *)this + 504) = 0;
}
}
LABEL_24:
std::mutex::unlock((LocalLevelManager *)((char *)this + 464));
if ( (v30 & 1) == 0 )
{
if ( !((int)(unsigned __int8)v30 >> 1) )
goto LABEL_28;
v21 = (char *)&v30 + 1;
goto LABEL_27;
}
if ( v31 )
{
v21 = (const char *)v32;
LABEL_27:
remove(v21);
if ( (v30 & 1) == 0 )
goto LABEL_28;
}
operator delete(v32);
LABEL_28:
if ( (v27 & 1) != 0 )
operator delete(v29);
return _stack_chk_guard;
}