//
// sub_100982BC0 from 0x100982bc0 to 0x100982e99 (729 bytes)
//
// 1 xrefs:
// > sub_100982340 @ 0x100982746
//
// This function is hookable on this platform (idp: pc, 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:39:01 +0000
//
void __fastcall sub_100982BC0(__int64 a1)
{
int v1; // r14d
char v2; // al
int v3; // r15d
const char *v4; // rdx
char *v5; // rax
const char *CString; // r15
size_t v7; // rax
std::string::size_type v8; // r14
char *data; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v10; // r14
char *v11; // rax
std::string::pointer v12; // rdi
size_t v13; // r13
char *v14; // rbx
unsigned __int8 v15[16]; // [rsp+8h] [rbp-A8h] BYREF
void *__p; // [rsp+18h] [rbp-98h]
__int128 v17; // [rsp+20h] [rbp-90h] BYREF
void *v18; // [rsp+30h] [rbp-80h]
_BYTE v19[24]; // [rsp+38h] [rbp-78h] BYREF
__int128 v20; // [rsp+50h] [rbp-60h] BYREF
void *v21; // [rsp+60h] [rbp-50h]
std::string __dst; // [rsp+70h] [rbp-40h] BYREF
v1 = sub_1005BE030();
sub_1005BDF10((__int64)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
if ( !__dst.__r_.__value_.__l.__size_ )
goto LABEL_9;
v2 = *(_BYTE *)(__dst.__r_.__value_.__r.__words[2] + __dst.__r_.__value_.__l.__size_ - 1);
if ( v2 == 47 )
goto LABEL_9;
}
else
{
if ( !*(_BYTE *)&__dst.__r_.__value_.__s.0 )
goto LABEL_9;
v2 = *((_BYTE *)&__dst.__r_.__value_.__l.0 + (*(_BYTE *)&__dst.__r_.__value_.__l.0 >> 1));
if ( v2 == 47 )
goto LABEL_9;
}
if ( v2 != 92 )
std::string::append(&__dst, "/");
LABEL_9:
*(_WORD *)v15 = 0;
v3 = sub_100981DA0(&__dst, v1, v15, 1);
if ( (v15[0] & 1) != 0 )
{
operator delete(__p);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_11:
if ( v3 )
goto LABEL_12;
goto LABEL_21;
}
}
else if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_11;
}
operator delete(__dst.__r_.__value_.__l.__data_);
if ( v3 )
{
LABEL_12:
v4 = "s";
if ( v3 == 1 )
v4 = "";
v5 = sub_10088E820("Delete %i old backup%s?\nKeeps the newest %i for each level.", v3, v4, v1);
CString = (const char *)cocos2d::CCString::getCString((__int64)v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
{
v13 = 26;
if ( (v7 | 7) != 0x17 )
v13 = (v7 | 7) + 1;
data = (char *)operator new(v13);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v13 + 1;
__dst.__r_.__value_.__l.__size_ = v8;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = __dst.__r_.__value_.__s.__data_;
if ( !v7 )
{
__dst.__r_.__value_.__s.__data_[0] = 0;
v10 = __dst.__r_.__value_.__s.0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_18:
v21 = __dst.__r_.__value_.__l.__data_;
v20 = *(_OWORD *)&__dst.__r_.__value_.__l.0;
goto LABEL_30;
}
LABEL_29:
sub_10001AD30(&v20, __dst.__r_.__value_.__l.__data_, __dst.__r_.__value_.__l.__size_);
LABEL_30:
v14 = FLAlertLayer::create(
(int)a1 + 1016,
(int)"Prune Backups",
&v20,
(int)"Back",
(int)"Prune",
0,
380.0,
0.0,
1.0);
if ( (v20 & 1) != 0 )
operator delete(v21);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v14 + 72LL))(v14, 1);
(*(void (__fastcall **)(char *))(*(_QWORD *)v14 + 1312LL))(v14);
if ( (*(_BYTE *)&v10 & 1) != 0 )
{
v12 = __dst.__r_.__value_.__l.__data_;
goto LABEL_34;
}
return;
}
}
memmove(data, CString, v8);
data[v8] = 0;
v10 = __dst.__r_.__value_.__s.0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_18;
goto LABEL_29;
}
LABEL_21:
strcpy(v19, " Nothing to prune");
LOWORD(v17) = 0;
v11 = TextAlertPopup::create((__int128 *)v19, 0x96u, &v17, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v11, 100);
if ( (v17 & 1) != 0 )
operator delete(v18);
if ( (v19[0] & 1) != 0 )
{
v12 = *(std::string::pointer *)&v19[16];
LABEL_34:
operator delete(v12);
}
}