//
// sub_180016B60 from 0x180016b60 to 0x180016c7a (282 bytes)
//
// 4 xrefs:
// > DS_Dictionary::copyFile @ 0x180019716
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d7a4
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001dec2
// > ??> @ 0x1801ae5b4
//
// 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_180016B60(__int64 a1, __int64 a2, int a3, unsigned int a4, int a5)
{
if ( a5 )
{
*(_QWORD *)a1 = &unk_1800E70B0;
std::ios::ios(a1 + 168);
}
std::ostream::ostream(a1, a1 + 8, 0, 0);
*(_QWORD *)(*(int *)(*(_QWORD *)a1 + 4LL) + a1) = &std::ofstream::`vftable';
*(_DWORD *)(*(int *)(*(_QWORD *)a1 + 4LL) + a1 - 4) = *(_DWORD *)(*(_QWORD *)a1 + 4LL) - 168;
std::streambuf::streambuf(a1 + 8);
*(_QWORD *)(a1 + 8) = &std::filebuf::`vftable';
*(_BYTE *)(a1 + 132) = 0;
*(_BYTE *)(a1 + 121) = 0;
std::streambuf::_Init(a1 + 8);
*(_QWORD *)(a1 + 136) = 0;
*(_QWORD *)(a1 + 124) = qword_1801A8360;
*(_QWORD *)(a1 + 112) = 0;
if ( !sub_18001C230(a1 + 8, a2, a3 | 2u, a4) )
std::ios::setstate(a1 + *(int *)(*(_QWORD *)a1 + 4LL), 2, 0);
return a1;
}