//
// sub_18001AE70 from 0x18001ae70 to 0x18001b07a (522 bytes)
//
// 5 xrefs:
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d5d2
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d604
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001ddbb
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001dded
// > ??> @ 0x1801b8a94
//
// 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 11:21:26 +0000
//
// Hidden C++ exception states: #wind=3
_QWORD *__fastcall sub_18001AE70(_QWORD *a1, const char *a2, const char *a3, const char *a4)
{
size_t v8; // rax
size_t v9; // rax
size_t v10; // rax
unsigned __int64 v11; // rbx
__int64 v12; // r15
void **v13; // rdx
_QWORD *v14; // rsi
unsigned __int64 v15; // r8
unsigned __int64 v16; // rcx
char *v17; // rdi
__int64 v18; // rax
void **v19; // r9
void *v20; // rcx
void *v21; // rcx
void *Block[2]; // [rsp+40h] [rbp-29h] BYREF
__int64 v24; // [rsp+50h] [rbp-19h]
unsigned __int64 v25; // [rsp+58h] [rbp-11h]
void *v26[2]; // [rsp+60h] [rbp-9h] BYREF
unsigned __int64 v27; // [rsp+70h] [rbp+7h]
unsigned __int64 v28; // [rsp+78h] [rbp+Fh]
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 0;
v8 = strlen(a2);
sub_18000CEF0(a1, a2, v8);
*(_OWORD *)v26 = 0;
v27 = 0;
v28 = 0;
v9 = strlen(a3);
sub_18000CEF0(v26, a3, v9);
*(_OWORD *)Block = 0;
v24 = 0;
v25 = 0;
v10 = strlen(a4);
sub_18000CEF0(Block, a4, v10);
v11 = 0;
v12 = v24;
while ( 1 )
{
v13 = v26;
if ( v28 > 0xF )
v13 = (void **)v26[0];
v14 = a1;
if ( a1[3] > 0xFu )
v14 = (_QWORD *)*a1;
v15 = v27;
v16 = a1[2];
if ( v27 > v16 || v11 > v16 - v27 )
break;
if ( v27 )
{
v17 = (char *)v14 + v16;
v18 = sub_1800E4930((char *)v14 + v11, (char *)v14 + v16, v13);
if ( (char *)v18 == v17 )
break;
v11 = v18 - (_QWORD)v14;
v15 = v27;
}
if ( v11 == -1 )
break;
v19 = Block;
if ( v25 > 0xF )
v19 = (void **)Block[0];
sub_18001D2E0(a1, v11, v15, v19, v12);
v12 = v24;
v11 += v24;
}
if ( v25 > 0xF )
{
v20 = Block[0];
if ( v25 + 1 >= 0x1000 )
{
v20 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v20);
}
if ( v28 > 0xF )
{
v21 = v26[0];
if ( v28 + 1 >= 0x1000 )
{
v21 = *((void **)v26[0] - 1);
if ( (unsigned __int64)((char *)v26[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v21);
}
return a1;
}