//
// DS_Dictionary::saveRootSubDictToFile from 0x10015a7f0 to 0x10015add0 (1504 bytes)
//
// 0 xrefs:
//
// 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:25:06 +0000
//
__int64 __fastcall DS_Dictionary::saveRootSubDictToFile(__int64 a1, const std::string::value_type *a2)
{
const std::string::value_type *data; // rsi
const char *v4; // r14
char *v5; // rsi
char *v6; // rsi
const std::__fs::filesystem::path *v7; // r15
const std::__fs::filesystem::path *v8; // rdi
std::error_code *v9; // rdx
const char *v10; // r13
const std::__fs::filesystem::path *v11; // rdi
std::error_code *v12; // rdx
const std::__fs::filesystem::path *v13; // rdi
std::error_code *v14; // rsi
int v15; // eax
std::error_code *v16; // rdx
const std::__fs::filesystem::path *v17; // rsi
char *v18; // rsi
unsigned int v19; // ebx
FILE *v21; // rax
FILE *v22; // rax
std::string v23; // [rsp+10h] [rbp-510h] BYREF
std::string v24; // [rsp+28h] [rbp-4F8h] BYREF
std::string v25; // [rsp+40h] [rbp-4E0h] BYREF
_WORD v26[8]; // [rsp+58h] [rbp-4C8h] BYREF
char *v27; // [rsp+68h] [rbp-4B8h]
char v28; // [rsp+77h] [rbp-4A9h] BYREF
__int64 (__fastcall **v29)(); // [rsp+78h] [rbp-4A8h] BYREF
_BYTE v30[120]; // [rsp+80h] [rbp-4A0h] BYREF
FILE *v31; // [rsp+F8h] [rbp-428h]
int v32; // [rsp+208h] [rbp-318h]
int v33; // [rsp+20Ch] [rbp-314h]
std::ios_base v34; // [rsp+218h] [rbp-308h] BYREF
__int64 v35; // [rsp+2A0h] [rbp-280h]
int v36; // [rsp+2A8h] [rbp-278h]
_QWORD v37[2]; // [rsp+2B0h] [rbp-270h] BYREF
_BYTE __sb[120]; // [rsp+2C0h] [rbp-260h] BYREF
FILE *v39; // [rsp+338h] [rbp-1E8h]
int v40; // [rsp+448h] [rbp-D8h]
int v41; // [rsp+44Ch] [rbp-D4h]
std::ios_base v42; // [rsp+458h] [rbp-C8h] BYREF
__int64 v43; // [rsp+4E0h] [rbp-40h]
int v44; // [rsp+4E8h] [rbp-38h]
v26[0] = 0;
FileOperation::getFilePath(&v23);
std::string::append(&v23, a2);
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
data = v23.__r_.__value_.__l.__data_;
else
data = v23.__r_.__value_.__s.__data_;
std::string::assign((std::string *)v26, data);
v4 = (char *)v26 + 1;
v5 = (char *)v26 + 1;
if ( (v26[0] & 1) != 0 )
v5 = v27;
sub_10015AF20(&v25, v5, "2.dat");
v6 = (char *)v26 + 1;
if ( (v26[0] & 1) != 0 )
v6 = v27;
sub_10015AF20(&v24, v6, "3.dat");
v7 = (const std::__fs::filesystem::path *)((char *)&v24.__r_.__value_.__l.0 + 1);
v8 = (const std::__fs::filesystem::path *)((char *)&v24.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) != 0 )
v8 = (const std::__fs::filesystem::path *)v24.__r_.__value_.__l.__data_;
remove(v8, (std::error_code *)v6);
v10 = v25.__r_.__value_.__s.__data_;
v11 = (const std::__fs::filesystem::path *)((char *)&v25.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) != 0 )
{
v11 = (const std::__fs::filesystem::path *)v25.__r_.__value_.__l.__data_;
if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_12:
rename(v11, (const std::__fs::filesystem::path *)((char *)&v24.__r_.__value_.__l.0 + 1), v9);
v13 = (const std::__fs::filesystem::path *)((char *)v26 + 1);
if ( (v26[0] & 1) == 0 )
goto LABEL_13;
goto LABEL_37;
}
}
else if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_12;
}
rename(v11, (const std::__fs::filesystem::path *)v24.__r_.__value_.__l.__data_, v9);
v13 = (const std::__fs::filesystem::path *)((char *)v26 + 1);
if ( (v26[0] & 1) == 0 )
{
LABEL_13:
v14 = (std::error_code *)((char *)&v25.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_14;
goto LABEL_38;
}
LABEL_37:
v13 = (const std::__fs::filesystem::path *)v27;
v14 = (std::error_code *)((char *)&v25.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_14:
rename(v13, (const std::__fs::filesystem::path *)((char *)&v25.__r_.__value_.__l.0 + 1), v12);
if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_15;
goto LABEL_39;
}
LABEL_38:
v14 = (std::error_code *)v25.__r_.__value_.__l.__data_;
rename(v13, (const std::__fs::filesystem::path *)v25.__r_.__value_.__l.__data_, v12);
if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_15:
if ( v15 )
goto LABEL_16;
goto LABEL_40;
}
LABEL_39:
v7 = (const std::__fs::filesystem::path *)v24.__r_.__value_.__l.__data_;
if ( v15 )
{
LABEL_16:
v17 = (const std::__fs::filesystem::path *)((char *)&v25.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) != 0 )
v17 = (const std::__fs::filesystem::path *)v25.__r_.__value_.__l.__data_;
rename(v7, v17, v16);
v18 = (char *)v26 + 1;
if ( (v26[0] & 1) != 0 )
goto LABEL_19;
goto LABEL_20;
}
LABEL_40:
remove(v7, v14);
v18 = (char *)v26 + 1;
if ( (v26[0] & 1) != 0 )
LABEL_19:
v18 = v27;
LABEL_20:
v19 = sub_10071FA90(a1, v18, "\t", 4, 0);
if ( !(_BYTE)v19 )
{
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) != 0 )
v10 = v25.__r_.__value_.__l.__data_;
v42.__loc_ = nullptr;
v37[0] = &off_100AC75D0;
v42.__vftable = (std::ios_base_vtbl *)&off_100AC75F8;
v37[1] = 0;
std::ios_base::init(&v42, __sb);
v43 = 0;
v44 = -1;
v37[0] = &off_100AC7560;
v42.__vftable = (std::ios_base_vtbl *)off_100AC7588;
sub_100162D10(__sb);
if ( v39 || (v21 = fopen(v10, "r"), (v39 = v21) == nullptr) )
{
std::ios_base::clear(
(std::ios_base *)((char *)v37 + *(_QWORD *)(v37[0] - 24LL)),
*(_DWORD *)&__sb[*(_QWORD *)(v37[0] - 24LL) + 16] | 4);
}
else
{
v40 = 8;
if ( v41 == 34 )
{
setbuf(v21, nullptr);
v41 = 0;
}
}
if ( (v26[0] & 1) != 0 )
v4 = v27;
v34.__loc_ = nullptr;
v29 = (__int64 (__fastcall **)())&off_100AC7460;
v34.__vftable = (std::ios_base_vtbl *)&off_100AC7488;
std::ios_base::init(&v34, v30);
v35 = 0;
v36 = -1;
v29 = &off_100AC73F0;
v34.__vftable = (std::ios_base_vtbl *)off_100AC7418;
sub_100162D10(v30);
if ( v31 || (v22 = fopen(v4, "w"), (v31 = v22) == nullptr) )
{
std::ios_base::clear((std::ios_base *)&v30[(_QWORD)*(v29 - 3) - 8], *(_DWORD *)&v30[(_QWORD)*(v29 - 3) + 24] | 4);
}
else
{
v32 = 16;
if ( v33 == 34 )
{
setbuf(v22, nullptr);
v33 = 0;
}
}
sub_100162E50(&v28, *(_QWORD *)&__sb[*(_QWORD *)(v37[0] - 24LL) + 24], 0, *(_QWORD *)&v30[(_QWORD)*(v29 - 3) + 32]);
v29 = &off_100AC73F0;
v34.__vftable = (std::ios_base_vtbl *)off_100AC7418;
sub_100161420(v30);
std::ostream::~ostream(&v29, off_100AC7430);
std::ios::~ios(&v34);
v37[0] = &off_100AC7560;
v42.__vftable = (std::ios_base_vtbl *)off_100AC7588;
sub_100161420(__sb);
std::istream::~istream(v37, off_100AC75A0);
std::ios::~ios(&v42);
}
if ( (*(_BYTE *)&v24.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v24.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_32:
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_33;
LABEL_44:
operator delete(v23.__r_.__value_.__l.__data_);
if ( (v26[0] & 1) == 0 )
return v19;
LABEL_45:
operator delete(v27);
return v19;
}
}
else if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_32;
}
operator delete(v25.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_44;
LABEL_33:
if ( (v26[0] & 1) != 0 )
goto LABEL_45;
return v19;
}