//
// sub_100530FA8 from 0x100530fa8 to 0x100531494 (1260 bytes)
//
// 5 xrefs:
// > sub_100530498 @ 0x1005304f4
// > sub_1005325F0 @ 0x100532630
// > sub_100532E54 @ 0x100532e94
// > sub_1005331C8 @ 0x100533214
// > AutoBackupOptionsPopup::FLAlert_Clicked @ 0x10053371c
//
// 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 11:07:21 +0000
//
void __fastcall sub_100530FA8(const void **a1, __int64 *a2, const void **a3)
{
__int64 i; // x22
__int64 v6; // x23
unsigned __int8 v7; // w25
void **v8; // x23
unsigned __int64 j; // x26
void **v10; // x23
_BOOL4 v11; // w0
_BOOL4 v12; // w24
std::error_code *v13; // x1
const std::__fs::filesystem::path *v14; // x0
bool v15; // w0
bool v16; // w24
unsigned __int64 v17; // x8
std::string *p_str; // x9
std::string::size_type size; // x24
std::string *v20; // x8
std::string::size_type v21; // x9
unsigned __int64 v22; // x9
std::string *p_a; // x10
__int64 v24; // x11
int v25; // w12
int v26; // w27
_BYTE *v27; // x8
_BYTE *v28; // x8
_BYTE *v29; // x8
std::string __a; // [xsp+20h] [xbp-140h] BYREF
std::string __str; // [xsp+38h] [xbp-128h] BYREF
void *__p[2]; // [xsp+50h] [xbp-110h] BYREF
_QWORD v34[4]; // [xsp+60h] [xbp-100h] BYREF
__int128 v35; // [xsp+80h] [xbp-E0h] BYREF
void *v36[2]; // [xsp+90h] [xbp-D0h] BYREF
__int128 v37; // [xsp+A0h] [xbp-C0h] BYREF
void *v38[2]; // [xsp+B0h] [xbp-B0h] BYREF
__int128 v39; // [xsp+C0h] [xbp-A0h]
_QWORD *v40; // [xsp+D0h] [xbp-90h] BYREF
_QWORD *v41; // [xsp+D8h] [xbp-88h]
__int64 v42; // [xsp+E0h] [xbp-80h]
void **v43; // [xsp+E8h] [xbp-78h] BYREF
void **v44; // [xsp+F0h] [xbp-70h]
__int64 v45; // [xsp+F8h] [xbp-68h]
std::allocator v46; // [xsp+107h] [xbp-59h] BYREF
v6 = *a2;
for ( i = a2[1]; i != v6; sub_100535810(a2, i) )
i -= 128;
a2[1] = v6;
v43 = nullptr;
v44 = nullptr;
v45 = 0;
v40 = nullptr;
v41 = nullptr;
v42 = 0;
sub_10004E838((__int64)a1, &v43, a3, (__int64)&v40);
v7 = atomic_load((unsigned __int8 *)(LocalLevelManager::sharedState() + 601));
v8 = v43;
if ( v44 != v43 )
{
for ( j = 0; j < 0xAAAAAAAAAAAAAAABLL * (v44 - v43); ++j )
{
sub_100009900(__p, ".gdlvl.tmp");
v10 = &v8[3 * j];
v11 = sub_10004B4E0((__int64 **)v10, __p);
v12 = v11;
if ( SHIBYTE(v34[0]) < 0 )
{
operator delete(__p[0]);
if ( v12 )
{
LABEL_8:
if ( (v7 & 1) == 0 )
{
sub_10011E060(a1, (const void **)v10, (__int64)__p);
if ( v34[0] >= 0 )
v14 = (const std::__fs::filesystem::path *)__p;
else
v14 = (const std::__fs::filesystem::path *)__p[0];
remove(v14, v13);
goto LABEL_71;
}
goto LABEL_73;
}
}
else if ( v11 )
{
goto LABEL_8;
}
sub_100009900(__p, ".gdlvl");
v15 = sub_10004B4E0((__int64 **)v10, __p);
v16 = v15;
if ( SHIBYTE(v34[0]) < 0 )
{
operator delete(__p[0]);
if ( v16 )
{
LABEL_18:
*(_OWORD *)v38 = 0u;
v39 = 0u;
*(_OWORD *)v36 = 0u;
v37 = 0u;
v35 = 0u;
*(_OWORD *)__p = 0u;
memset(v34, 0, sizeof(v34));
std::string::operator=((std::string *)__p, (const std::string *)v10);
v17 = *((char *)v10 + 23);
if ( (v17 & 0x8000000000000000LL) != 0 )
v17 = (unsigned __int64)v10[1];
std::string::basic_string(&__str, (const std::string *)v10, 0, v17 - 6, (std::allocator *)&__a);
if ( (SHIBYTE(__str.__r_.__value_.__r.__words[2]) & 0x8000000000000000LL) != 0 )
{
size = __str.__r_.__value_.__l.__size_;
if ( __str.__r_.__value_.__l.__size_ > 0x24 )
{
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
goto LABEL_25;
}
}
else if ( (unsigned int)SHIBYTE(__str.__r_.__value_.__r.__words[2]) > 0x24 )
{
p_str = &__str;
size = SHIBYTE(__str.__r_.__value_.__r.__words[2]);
LABEL_25:
if ( p_str->__r_.__value_.__s.__data_[16] == 95 )
{
v20 = &__str;
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v20 = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( v20->__r_.__value_.__s.__data_[size - 20] == 95 )
{
std::string::basic_string(&__a, &__str, size - 19, 0xFFFFFFFFFFFFFFFFLL, &v46);
v21 = HIBYTE(__a.__r_.__value_.__r.__words[2]);
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v21 = __a.__r_.__value_.__l.__size_;
if ( v21 == 19 )
{
v22 = 0;
p_a = (std::string *)__a.__r_.__value_.__r.__words[0];
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_a = &__a;
do
{
v24 = (unsigned __int8)p_a->__r_.__value_.__s.__data_[v22];
if ( v22 <= 0x10 && ((1LL << v22) & 0x12490) != 0 )
{
if ( v22 == 10 )
v25 = 95;
else
v25 = 45;
if ( v25 != (char)v24 )
goto LABEL_43;
}
else if ( (_DefaultRuneLocale.__runetype[v24] & 0x400) == 0 )
{
goto LABEL_43;
}
++v22;
}
while ( v22 != 19 );
v26 = 1;
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
{
LABEL_59:
operator delete(__a.__r_.__value_.__l.__data_);
if ( !v26 )
goto LABEL_60;
LABEL_45:
std::string::basic_string(&__a, &__str, 0, 0x10u, &v46);
if ( SHIBYTE(v34[3]) < 0 )
operator delete((void *)v34[1]);
*(std::string *)&v34[1] = __a;
std::string::basic_string(&__a, &__str, 0x11u, size - 37, &v46);
if ( SHIBYTE(v36[0]) < 0 )
operator delete((void *)v35);
v35 = *(_OWORD *)&__a.__r_.__value_.__l.__data_;
v36[0] = (void *)__a.__r_.__value_.__r.__words[2];
std::string::basic_string(&__a, &__str, size - 19, 0xFFFFFFFFFFFFFFFFLL, &v46);
if ( SBYTE7(v39) < 0 )
operator delete(v38[0]);
*(_OWORD *)v38 = *(_OWORD *)&__a.__r_.__value_.__l.__data_;
*(_QWORD *)&v39 = *((_QWORD *)&__a.__r_.__value_.__l + 2);
std::string::operator=((std::string *)&v36[1], (const std::string *)v38);
v27 = (char *)&v37 + 2;
if ( v37 < 0 )
v27 = (char *)v36[1] + 10;
*v27 = 32;
v28 = (char *)&v37 + 5;
if ( v37 < 0 )
v28 = (char *)v36[1] + 13;
*v28 = 58;
v29 = (char *)&v37 + 8;
if ( v37 < 0 )
v29 = (char *)v36[1] + 16;
*v29 = 58;
LABEL_61:
*((_QWORD *)&v39 + 1) = v40[j];
sub_100531E30(a2, __p);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( SBYTE7(v39) < 0 )
operator delete(v38[0]);
if ( SHIBYTE(v37) < 0 )
operator delete(v36[1]);
if ( SHIBYTE(v36[0]) < 0 )
operator delete((void *)v35);
if ( SHIBYTE(v34[3]) < 0 )
operator delete((void *)v34[1]);
LABEL_71:
if ( SHIBYTE(v34[0]) < 0 )
operator delete(__p[0]);
goto LABEL_73;
}
}
else
{
LABEL_43:
v26 = 0;
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
goto LABEL_59;
}
if ( !v26 )
goto LABEL_60;
goto LABEL_45;
}
}
}
LABEL_60:
std::string::operator=((std::string *)&v35, &__str);
goto LABEL_61;
}
}
else if ( v15 )
{
goto LABEL_18;
}
LABEL_73:
v8 = v43;
}
}
sub_100535E18();
if ( v40 )
{
v41 = v40;
operator delete(v40);
}
__p[0] = &v43;
sub_100018250((void ***)__p);
}