//
// pugi::xml_document::save_string from 0x180085310 to 0x1800853cd (189 bytes)
//
// 4 xrefs:
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d687
// > DS_Dictionary::saveRootSubDictToString @ 0x18001e284
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b55b0
//
// 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=1
__int64 __fastcall pugi::xml_document::save_string(__int64 *a1, __int64 a2, __int64 a3, unsigned int a4, int a5)
{
void *v6; // rcx
void **v8; // [rsp+40h] [rbp-38h] BYREF
void *Block[2]; // [rsp+48h] [rbp-30h] BYREF
__m128i si128; // [rsp+58h] [rbp-20h]
v8 = &xml_string_writer::`vftable';
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Block[0]) = 0;
pugi::xml_document::save(a1, (__int64)&v8, a3, a4, a5);
sub_180016C80(a2, (__int64)Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v6 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v6 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v6 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v6);
}
return a2;
}