//
// sub_180016A40 from 0x180016a40 to 0x180016b5a (282 bytes)
//
// 4 xrefs:
// > DS_Dictionary::copyFile @ 0x1800196f6
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d770
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001de8e
// > ??> @ 0x1801ae5a8
//
// 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
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall sub_180016A40(__int64 a1, __int64 a2, int a3, unsigned int a4, int a5)
{
if ( a5 )
{
*(_QWORD *)a1 = &unk_1800E7098;
std::ios::ios(a1 + 176);
}
std::istream::istream(a1, a1 + 16, 0, 0);
*(_QWORD *)(*(int *)(*(_QWORD *)a1 + 4LL) + a1) = &std::ifstream::`vftable';
*(_DWORD *)(*(int *)(*(_QWORD *)a1 + 4LL) + a1 - 4) = *(_DWORD *)(*(_QWORD *)a1 + 4LL) - 176;
std::streambuf::streambuf(a1 + 16);
*(_QWORD *)(a1 + 16) = &std::filebuf::`vftable';
*(_BYTE *)(a1 + 140) = 0;
*(_BYTE *)(a1 + 129) = 0;
std::streambuf::_Init(a1 + 16);
*(_QWORD *)(a1 + 144) = 0;
*(_QWORD *)(a1 + 132) = qword_1801A8360;
*(_QWORD *)(a1 + 120) = 0;
if ( !sub_18001C230(a1 + 16, a2, a3 | 1u, a4) )
std::ios::setstate(a1 + *(int *)(*(_QWORD *)a1 + 4LL), 2, 0);
return a1;
}