//
// pugi::xml_document::destroy from 0x180080a80 to 0x180080b08 (136 bytes)
//
// 12 xrefs:
// > pugi::xml_document::~xml_document @ 0x18007f414
// > pugi::xml_document::load @ 0x180081230
// > pugi::xml_document::load @ 0x180081290
// > pugi::xml_document::load_buffer @ 0x180081330
// > pugi::xml_document::load_buffer_inplace @ 0x180081610
// > pugi::xml_document::load_buffer_inplace_own @ 0x1800816a0
// > pugi::xml_document::load_file @ 0x180081730
// > pugi::xml_document::load_file @ 0x1800817a0
// > pugi::xml_document::reset @ 0x1800847bf
// > pugi::xml_document::reset @ 0x180084cb9
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b519c
//
// 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
//
void __fastcall pugi::xml_document::destroy(pugi::xml_document *this)
{
pugi::char_t *buffer; // rcx
__int64 i; // rbx
__int64 v4; // rcx
__int64 v5; // rbx
buffer = this->_buffer;
if ( buffer )
{
off_1801A2FA8(buffer);
this->_buffer = nullptr;
}
for ( i = *((_QWORD *)this->_root + 11); i; i = *(_QWORD *)(i + 8) )
{
if ( *(_QWORD *)i )
off_1801A2FA8(*(void **)i);
}
v4 = *(_QWORD *)((*(_QWORD *)this->_root & 0xFFFFFFFFFFFFFFE0uLL) + 0x18);
if ( v4 )
{
do
{
v5 = *(_QWORD *)(v4 + 24);
off_1801A2FA8(*(void **)(v4 + 8));
v4 = v5;
}
while ( v5 );
}
this->_root = nullptr;
}