//
// sub_10097DE50 from 0x10097de50 to 0x10097e1c3 (883 bytes)
//
// 1 xrefs:
// > sub_10097D570 @ 0x10097db63
//
// 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:38:58 +0000
//
void __fastcall sub_10097DE50(__int64 a1)
{
int v1; // ebx
__int64 v2; // rax
__int64 v3; // rcx
__int64 v4; // rcx
__int64 v5; // rcx
__int64 v6; // rcx
unsigned int v7; // r13d
size_t v8; // r13
const void *v9; // rbx
__int64 **v10; // r15
unsigned int v11; // r12d
size_t v12; // r12
__int64 *v13; // rsi
size_t v14; // r14
int v15; // eax
bool v16; // cl
int v17; // eax
bool v18; // cl
const char *v19; // r14
const char *v20; // rcx
char *v21; // rax
const char *CString; // r14
size_t v23; // rax
size_t v24; // r15
char *v25; // r12
char v26; // r14
size_t v27; // r13
char *v28; // rbx
const void *v29; // [rsp+10h] [rbp-C0h]
__int64 v30; // [rsp+18h] [rbp-B8h]
__int64 v31; // [rsp+20h] [rbp-B0h]
__int64 **v32; // [rsp+28h] [rbp-A8h]
__int64 v33; // [rsp+30h] [rbp-A0h]
__int64 v34; // [rsp+38h] [rbp-98h]
void *v35[2]; // [rsp+48h] [rbp-88h] BYREF
void *__p; // [rsp+58h] [rbp-78h]
__int128 v37; // [rsp+60h] [rbp-70h] BYREF
void *v38; // [rsp+70h] [rbp-60h]
__int128 __dst; // [rsp+80h] [rbp-50h] BYREF
void *v40; // [rsp+90h] [rbp-40h]
__int64 v41; // [rsp+98h] [rbp-38h]
int v42; // [rsp+A4h] [rbp-2Ch]
v42 = *(_DWORD *)(a1 + 960);
if ( !v42 )
return;
v1 = a1;
v2 = *(_QWORD *)(a1 + 848);
v3 = *(_QWORD *)(a1 + 856);
v41 = 0;
v4 = v3 - v2;
if ( v4 )
{
v32 = *(__int64 ***)(a1 + 952);
if ( v32 )
{
v34 = (v4 >> 7 == 0) + (v4 >> 7);
v5 = 0;
v41 = 0;
v33 = v2;
while ( 1 )
{
v30 = v5;
v6 = v5 << 7;
v7 = *(unsigned __int8 *)(v2 + v6);
if ( (v7 & 1) != 0 )
{
v8 = *(_QWORD *)(v2 + v6 + 8);
v9 = *(const void **)(v2 + v6 + 16);
}
else
{
v8 = v7 >> 1;
v9 = (const void *)(v2 + v6 + 1);
}
v31 = v2 + v6;
v10 = v32;
v29 = v9;
while ( 1 )
{
v11 = *((unsigned __int8 *)v10 + 32);
if ( (v11 & 1) != 0 )
{
v12 = (size_t)v10[5];
v13 = v10[6];
}
else
{
v12 = v11 >> 1;
v13 = (__int64 *)((char *)v10 + 33);
}
v14 = v8;
if ( v12 < v8 )
v14 = v12;
v15 = memcmp(v9, v13, v14);
v16 = v8 < v12;
if ( v15 )
v16 = v15 < 0;
if ( v16 )
goto LABEL_11;
v17 = memcmp(v13, v9, v14);
v18 = v12 < v8;
if ( v17 )
v18 = v17 < 0;
if ( !v18 )
break;
++v10;
LABEL_11:
v10 = (__int64 **)*v10;
v9 = v29;
if ( !v10 )
goto LABEL_6;
}
v41 += *(_QWORD *)(v31 + 120);
LABEL_6:
v5 = v30 + 1;
v2 = v33;
if ( v30 + 1 == v34 )
{
v1 = a1;
break;
}
}
}
}
v19 = "s";
if ( v42 == 1 )
v19 = "";
sub_1006494B0(v35);
if ( ((__int64)v35[0] & 1) != 0 )
v20 = (const char *)__p;
else
v20 = (char *)v35 + 1;
v21 = sub_10088E820("Delete %i selected backup%s (%s)?\nThis cannot be undone.", v42, v19, v20);
CString = (const char *)cocos2d::CCString::getCString((__int64)v21);
v23 = strlen(CString);
if ( v23 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v24 = v23;
if ( v23 >= 0x17 )
{
v27 = 26;
if ( (v23 | 7) != 0x17 )
v27 = (v23 | 7) + 1;
v25 = (char *)operator new(v27);
v40 = v25;
*(_QWORD *)&__dst = v27 | 1;
*((_QWORD *)&__dst + 1) = v24;
LABEL_40:
memmove(v25, CString, v24);
v25[v24] = 0;
if ( ((__int64)v35[0] & 1) == 0 )
goto LABEL_35;
goto LABEL_34;
}
LOBYTE(__dst) = 2 * v23;
v25 = (char *)&__dst + 1;
if ( v23 )
goto LABEL_40;
BYTE1(__dst) = 0;
if ( ((__int64)v35[0] & 1) != 0 )
LABEL_34:
operator delete(__p);
LABEL_35:
v26 = __dst;
if ( (__dst & 1) != 0 )
{
sub_10001AD30(&v37, v40, *((unsigned __int64 *)&__dst + 1));
}
else
{
v38 = v40;
v37 = __dst;
}
v28 = FLAlertLayer::create(v1 + 776, (int)"Delete Backups", &v37, (int)"Cancel", (int)"Delete", 0, 380.0, 0.0, 1.0);
if ( (v37 & 1) != 0 )
operator delete(v38);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v28 + 72LL))(v28, 3);
(*(void (__fastcall **)(char *))(*(_QWORD *)v28 + 1312LL))(v28);
if ( (v26 & 1) != 0 )
operator delete(v40);
}