//
// sub_54328C from 0x54328c to 0x5434ea (606 bytes)
//
// 2 xrefs:
// > LocalLevelManager::exportLevelsToFile @ 0x543ec0
// > LocalLevelManager::exportLevelsToFile @ 0x5440ba
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:52:20 +0000
//
unsigned int *__fastcall sub_54328C(unsigned int *a1, int a2)
{
int v3; // r3
unsigned __int8 *v4; // r2
int v5; // r3
char *v6; // r3
int v7; // r1
int v8; // t1
_BYTE *v9; // r9
size_t v10; // r3
_BYTE *v11; // r8
int v12; // r0
size_t v13; // r2
char *v14; // lr
size_t v15; // r3
int v16; // r3
int v17; // r3
int v18; // r3
size_t v19; // r3
int *v20; // r3
int v22; // r3
int v23; // [sp+Ch] [bp-20h] BYREF
int v24; // [sp+10h] [bp-1Ch]
unsigned __int8 *v25; // [sp+14h] [bp-18h]
int v26; // [sp+18h] [bp-14h] BYREF
size_t v27; // [sp+1Ch] [bp-10h]
int *v28; // [sp+20h] [bp-Ch]
_BYTE v29[4]; // [sp+28h] [bp-4h] BYREF
std::string::basic_string(&v23, a2);
v3 = (unsigned __int8)v23;
if ( (v23 & 1) != 0 )
{
if ( v24 )
{
LABEL_3:
v4 = v25;
v5 = v24;
goto LABEL_7;
}
}
else if ( (unsigned __int8)v23 >> 1 )
{
goto LABEL_6;
}
std::string::assign(&v23, "level");
v3 = (unsigned __int8)v23;
if ( (v23 & 1) != 0 )
goto LABEL_3;
LABEL_6:
v5 = v3 >> 1;
v4 = (unsigned __int8 *)&v23 + 1;
LABEL_7:
v6 = (char *)&v4[v5];
while ( v4 != (unsigned __int8 *)v6 )
{
v8 = *v4++;
v7 = v8;
if ( v8 == 92 || v7 == 47 || v7 == 58 || (v7 & 0xF7) == 0x22 || (v7 & 0xBF) == 0x3C || (unsigned int)(v7 - 62) <= 1 )
*(v4 - 1) = 95;
}
std::string::basic_string(&v26, (int)&v23);
if ( (v26 & 1) != 0 )
{
v9 = v28;
v10 = v27;
}
else
{
v10 = (int)(unsigned __int8)v26 >> 1;
v9 = (char *)&v26 + 1;
}
v11 = &v9[v10];
while ( v9 != v11 )
{
*v9 = toupper((unsigned __int8)*v9);
++v9;
}
while ( 1 )
{
v12 = v26 & 1;
if ( v12 )
{
v13 = v27;
if ( !v27 )
goto LABEL_28;
v14 = (char *)v28;
}
else
{
v13 = (int)(unsigned __int8)v26 >> 1;
if ( !v13 )
goto LABEL_29;
v14 = (char *)&v26 + 1;
}
if ( v14[v13 - 1] != 32 )
break;
if ( v12 )
{
--v27;
*((_BYTE *)v28 + v27) = 0;
}
else
{
v22 = ((int)(unsigned __int8)v26 >> 1) - 1;
LOBYTE(v26) = 2 * v22;
v29[v22 - 15] = 0;
}
}
if ( v12 )
{
LABEL_28:
v15 = v27;
goto LABEL_30;
}
LABEL_29:
v15 = (int)(unsigned __int8)v26 >> 1;
LABEL_30:
if ( v15 == 3 && !std::string::compare((unsigned __int8 *)&v26, 0, 0xFFFFFFFF, "CON", 3u) )
goto LABEL_67;
v16 = (unsigned __int8)v26;
if ( (v26 & 1) != 0 )
{
if ( v27 != 3 )
goto LABEL_36;
}
else if ( (int)(unsigned __int8)v26 >> 1 != 3 )
{
LABEL_46:
if ( v16 >> 1 != 3 )
{
v17 = (unsigned __int8)v26;
LABEL_51:
if ( v17 >> 1 != 3 )
{
v18 = (unsigned __int8)v26;
goto LABEL_53;
}
goto LABEL_48;
}
goto LABEL_42;
}
if ( !std::string::compare((unsigned __int8 *)&v26, 0, 0xFFFFFFFF, "PRN", 3u) )
{
LABEL_67:
std::string::insert(&v23, 0, "_", 1u);
goto LABEL_62;
}
v16 = (unsigned __int8)v26;
if ( (v26 & 1) == 0 )
goto LABEL_46;
LABEL_36:
if ( v27 != 3 )
goto LABEL_44;
LABEL_42:
if ( !std::string::compare((unsigned __int8 *)&v26, 0, 0xFFFFFFFF, "AUX", 3u) )
goto LABEL_67;
v17 = (unsigned __int8)v26;
if ( (v26 & 1) == 0 )
goto LABEL_51;
LABEL_44:
if ( v27 != 3 )
{
LABEL_50:
v19 = v27;
goto LABEL_54;
}
LABEL_48:
if ( !std::string::compare((unsigned __int8 *)&v26, 0, 0xFFFFFFFF, "NUL", 3u) )
goto LABEL_67;
v18 = (unsigned __int8)v26;
if ( (v26 & 1) != 0 )
goto LABEL_50;
LABEL_53:
v19 = v18 >> 1;
LABEL_54:
if ( v19 == 4
&& (!std::string::compare((unsigned __int8 *)&v26, 0, 3u, "COM", 3u)
|| !std::string::compare((unsigned __int8 *)&v26, 0, 3u, "LPT", 3u)) )
{
v20 = (v26 & 1) != 0 ? v28 : (int *)((char *)&v26 + 1);
if ( (unsigned int)*((unsigned __int8 *)v20 + 3) - 48 <= 9 )
goto LABEL_67;
}
LABEL_62:
std::operator+(a1, (unsigned __int8 *)&v23, ".gdlvl");
std::string::~string((int)&v26);
std::string::~string((int)&v23);
return a1;
}