//
// sub_DB96D8 from 0xdb96d8 to 0xdb98bc (484 bytes)
//
// 4 xrefs:
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0xdb9978
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0xdb999c
// > DS_Dictionary::saveRootSubDictToFile @ 0xdb9f2c
// > DS_Dictionary::saveRootSubDictToFile @ 0xdb9f50
//
// 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 13:08:43 +0000
//
__int64 *__usercall sub_DB96D8@(char *a1@, char *a2@, __int64 *a3@)
{
__int64 v6; // x1
size_t v7; // x0
size_t v8; // x0
size_t i; // x0
unsigned __int8 v10; // w3
char *v11; // x26
unsigned __int64 v12; // x1
unsigned __int8 *v13; // x2
unsigned __int64 v14; // x3
size_t v16; // x19
size_t v17; // x2
char *v18; // x3
size_t v19; // x4
__int64 v20; // x0
char *v21; // x20
__int64 v22; // x0
__int64 v23; // [xsp+58h] [xbp+58h] BYREF
size_t v24; // [xsp+60h] [xbp+60h]
void *v25; // [xsp+68h] [xbp+68h]
__int64 v26; // [xsp+70h] [xbp+70h] BYREF
size_t v27; // [xsp+78h] [xbp+78h]
void *v28; // [xsp+80h] [xbp+80h]
__int64 v29; // [xsp+88h] [xbp+88h]
a3[1] = 0;
v6 = _stack_chk_guard;
a3[2] = 0;
*a3 = 0;
v29 = v6;
v7 = strlen(a1);
std::string::__init(a3, a1, v7);
v23 = 0;
v24 = 0;
v25 = nullptr;
std::string::__init(&v23, ".dat", 4u);
v26 = 0;
v27 = 0;
v28 = nullptr;
v8 = strlen(a2);
std::string::__init(&v26, a2, v8);
for ( i = 0; ; i = v20 + v16 )
{
if ( (*(_BYTE *)a3 & 1) != 0 )
{
v10 = v23;
v11 = (char *)a3[2];
v12 = a3[1];
if ( (v23 & 1) != 0 )
goto LABEL_4;
}
else
{
v10 = v23;
v11 = (char *)a3 + 1;
v12 = *(_BYTE *)a3 >> 1;
if ( (v23 & 1) != 0 )
{
LABEL_4:
v13 = (unsigned __int8 *)v25;
v14 = v24;
if ( i > v12 )
goto LABEL_5;
goto LABEL_12;
}
}
v14 = v10 >> 1;
v13 = (unsigned __int8 *)&v23 + 1;
if ( i > v12 )
goto LABEL_5;
LABEL_12:
if ( v12 - i < v14 )
goto LABEL_5;
v16 = i;
if ( v14 )
break;
LABEL_14:
if ( v16 == -1 )
goto LABEL_5;
v17 = (unsigned __int8)v23 >> 1;
if ( (v23 & 1) != 0 )
v17 = v24;
if ( (v26 & 1) != 0 )
{
v18 = (char *)v28;
v19 = v27;
}
else
{
v19 = (unsigned __int8)v26 >> 1;
v18 = (char *)&v26 + 1;
}
std::string::replace(a3, v16, v17, v18, v19);
v20 = (unsigned __int8)v26 >> 1;
if ( (v26 & 1) != 0 )
v20 = v27;
}
v21 = &v11[v12];
v22 = std::__search(
(__int64)&v11[i],
(__int64)&v11[v12],
v13,
&v13[v14],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v21 != (char *)v22 )
{
v16 = v22 - (_QWORD)v11;
goto LABEL_14;
}
LABEL_5:
if ( (v26 & 1) != 0 )
operator delete(v28);
if ( (v23 & 1) != 0 )
operator delete(v25);
return a3;
}