//
// sub_100981650 from 0x100981650 to 0x100981846 (502 bytes)
//
// 1 xrefs:
// > sub_10097E2F0 @ 0x10097ed1c
//
// 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:00 +0000
//
void __fastcall sub_100981650(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 v3; // rcx
unsigned __int64 v4; // r15
std::string *v5; // rax
__int64 v6; // rax
unsigned int v7; // edx
const std::string::value_type *v8; // rsi
std::string::size_type v9; // rdx
std::string *v10; // rax
std::string *v11; // rax
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v12; // r12
unsigned __int64 size; // r15
std::string::pointer data; // r14
__int64 v15; // rax
std::string v16; // [rsp+8h] [rbp-98h] BYREF
std::string v17; // [rsp+20h] [rbp-80h] BYREF
std::string v18; // [rsp+40h] [rbp-60h] BYREF
__int128 v19; // [rsp+60h] [rbp-40h] BYREF
void *__p; // [rsp+70h] [rbp-30h]
_BYTE v21[7]; // [rsp+78h] [rbp-28h]
v2 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
if ( v2 < 0 )
return;
v3 = *(_QWORD *)(a1 + 848);
if ( v2 >= (int)((unsigned __int64)(*(_QWORD *)(a1 + 856) - v3) >> 7) )
return;
*(_DWORD *)(a1 + 936) = v2;
v4 = (unsigned __int64)(unsigned int)v2 << 7;
std::operator+(&v16, "Delete the backup ", v3 + v4 + 48);
v5 = std::string::append(&v16, " from ");
v18 = *v5;
*(_OWORD *)&v5->__r_.__value_.__l.0 = 0;
v5->__r_.__value_.__r.__words[2] = 0;
v6 = *(_QWORD *)(a1 + 848);
v7 = *(unsigned __int8 *)(v6 + v4 + 72);
if ( (v7 & 1) != 0 )
{
v8 = *(const std::string::value_type **)(v6 + v4 + 88);
v9 = *(_QWORD *)(v6 + v4 + 80);
}
else
{
v9 = v7 >> 1;
v8 = (const std::string::value_type *)(v6 + v4 + 73);
}
v10 = std::string::append(&v18, v8, v9);
v17 = *v10;
*(_OWORD *)&v10->__r_.__value_.__l.0 = 0;
v10->__r_.__value_.__r.__words[2] = 0;
v11 = std::string::append(&v17, "?");
v12 = v11->__r_.__value_.__s.0;
*(_DWORD *)&v21[3] = HIDWORD(v11->__r_.__value_.__r.__words[0]);
*(_DWORD *)v21 = *(_DWORD *)((char *)&v11->__r_.__value_.__l.0 + 1);
size = v11->__r_.__value_.__l.__size_;
data = v11->__r_.__value_.__l.__data_;
*(_OWORD *)&v11->__r_.__value_.__l.0 = 0;
v11->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v17.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v17.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_8:
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_9;
LABEL_13:
operator delete(v16.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v12 & 1) == 0 )
goto LABEL_10;
LABEL_14:
sub_10001AD30(&v19, data, size);
goto LABEL_15;
}
}
else if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_8;
}
operator delete(v18.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_13;
LABEL_9:
if ( (*(_BYTE *)&v12 & 1) != 0 )
goto LABEL_14;
LABEL_10:
LOBYTE(v19) = v12;
*(_DWORD *)((char *)&v19 + 1) = *(_DWORD *)v21;
DWORD1(v19) = *(_DWORD *)&v21[3];
*((_QWORD *)&v19 + 1) = size;
__p = data;
LABEL_15:
v15 = sub_100493AB0(a1 + 776, (__int64)"Delete Backup", &v19, (__int64)"Cancel", (__int64)"Delete");
(*(void (__fastcall **)(__int64))(*(_QWORD *)v15 + 1312LL))(v15);
if ( (v19 & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)&v12 & 1) != 0 )
operator delete(data);
}