//
// sub_100183A60 from 0x100183a60 to 0x100183b87 (295 bytes)
//
// 3 xrefs:
// > DS_Dictionary::saveRootSubDictToFile @ 0x10017b77a
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x10017c42b
// > DS_Dictionary::copyFile @ 0x10017cb1e
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
_QWORD *__fastcall sub_100183A60(__int64 a1, _QWORD *a2, _QWORD *a3, _QWORD *a4)
{
_QWORD *v6; // r14
bool v7; // r12
int v8; // eax
unsigned __int8 *v9; // rax
unsigned __int8 v10; // al
unsigned __int8 *v11; // rcx
__int64 v12; // rax
v6 = a2;
if ( a2 )
goto LABEL_4;
LABEL_8:
v7 = 1;
LABEL_9:
v6 = nullptr;
while ( a3 && (a3[3] != a3[4] || (*(unsigned int (__fastcall **)(_QWORD *))(*a3 + 72LL))(a3) != -1) )
{
if ( !v7 )
return v6;
v9 = (unsigned __int8 *)v6[3];
if ( v9 != (unsigned __int8 *)v6[4] )
{
LABEL_15:
v10 = *v9;
if ( !a4 )
goto LABEL_23;
goto LABEL_20;
}
LABEL_19:
v10 = (*(__int64 (__fastcall **)(_QWORD *))(*v6 + 72LL))(v6);
if ( !a4 )
goto LABEL_23;
LABEL_20:
v11 = (unsigned __int8 *)a4[6];
if ( v11 != (unsigned __int8 *)a4[7] )
{
a4[6] = v11 + 1;
*v11 = v10;
goto LABEL_24;
}
if ( (*(unsigned int (__fastcall **)(_QWORD *, _QWORD))(*a4 + 104LL))(a4, v10) == -1 )
LABEL_23:
a4 = nullptr;
LABEL_24:
v12 = v6[3];
if ( v12 == v6[4] )
{
(*(void (__fastcall **)(_QWORD *))(*v6 + 80LL))(v6);
if ( !v6 )
goto LABEL_8;
}
else
{
v6[3] = v12 + 1;
if ( !v6 )
goto LABEL_8;
}
LABEL_4:
if ( v6[3] == v6[4] )
{
v8 = (*(__int64 (__fastcall **)(_QWORD *))(*v6 + 72LL))(v6);
v7 = v8 == -1;
if ( v8 == -1 )
goto LABEL_9;
}
else
{
v7 = 0;
}
}
if ( !v7 )
{
a3 = nullptr;
v9 = (unsigned __int8 *)v6[3];
if ( v9 != (unsigned __int8 *)v6[4] )
goto LABEL_15;
goto LABEL_19;
}
return v6;
}