//
// sub_6036D4 from 0x6036d4 to 0x603810 (316 bytes)
//
// 5 xrefs:
// > sub_6036D4 @ 0x603786
// > pugi::xml_node::append_copy @ 0x603af2
// > pugi::xml_node::prepend_copy @ 0x603b3e
// > pugi::xml_node::insert_copy_after @ 0x603b8e
// > pugi::xml_node::insert_copy_before @ 0x603bde
//
// 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 sub_6036D4(pugi::xml_node *a1, pugi::xml_node *a2, _DWORD *a3))()
{
void (*result)(); // r0
char *v7; // r0
pugi::xml_attribute_struct *v8; // r1
pugi::xml_node_struct *v9; // r1
pugi::xml_attribute_struct *v10; // r0
pugi::xml_attribute_struct *v11; // r2
char *v12; // r0
pugi::xml_attribute_struct *v13; // r1
pugi::xml_node_struct *v14; // r1
pugi::xml_node_struct *v15; // r0
pugi::xml_node_struct *v16; // r2
char *v17; // r0
char *v18; // r0
char *v19; // r0
pugi::xml_attribute_struct *v20; // r1
pugi::xml_attribute_struct *v21; // r0
pugi::xml_attribute_struct *v22; // r2
char *v23; // r0
pugi::xml_attribute_struct *v24; // r1
pugi::xml_attribute v25; // [sp+4h] [bp-10h] BYREF
pugi::xml_attribute v26; // [sp+8h] [bp-Ch] BYREF
result = (void (*)())((char *)pugi::xml_node::type(a2) - 2);
switch ( (unsigned int)result )
{
case 0u:
v7 = (char *)pugi::xml_node::name(a2);
pugi::xml_node::set_name(a1, v7);
for ( v25._attr = pugi::xml_node::first_attribute(a2, v8);
pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)((void (**)())&v25);
v25._attr = pugi::xml_attribute::next_attribute(&v25, v13) )
{
v10 = (pugi::xml_attribute_struct *)pugi::xml_attribute::name(&v25);
v26._attr = pugi::xml_node::append_attribute(a1, v10, v11);
v12 = (char *)pugi::xml_attribute::value(&v25);
pugi::xml_attribute::set_value(&v26, v12);
}
for ( v25._attr = pugi::xml_node::first_child(a2, v9);
;
v25._attr = pugi::xml_node::next_sibling((pugi::xml_node *)&v25, v14) )
{
result = pugi::xml_node::operator void (*)(pugi::xml_node***)((void (**)())&v25);
if ( !result )
break;
if ( !pugi::xml_node::operator==(&v25, a3) )
{
v15 = pugi::xml_node::type((pugi::xml_node *)&v25);
v26._attr = pugi::xml_node::append_child((pugi::xml_node_struct *)a1, v15, v16);
sub_6036D4(&v26, &v25, a3);
}
}
break;
case 1u:
case 2u:
case 3u:
case 6u:
goto LABEL_11;
case 4u:
v17 = (char *)pugi::xml_node::name(a2);
pugi::xml_node::set_name(a1, v17);
LABEL_11:
v18 = (char *)pugi::xml_node::value(a2);
result = (void (*)())pugi::xml_node::set_value(a1, v18);
break;
case 5u:
v19 = (char *)pugi::xml_node::name(a2);
pugi::xml_node::set_name(a1, v19);
for ( v25._attr = pugi::xml_node::first_attribute(a2, v20);
;
v25._attr = pugi::xml_attribute::next_attribute(&v25, v24) )
{
result = pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)((void (**)())&v25);
if ( !result )
break;
v21 = (pugi::xml_attribute_struct *)pugi::xml_attribute::name(&v25);
v26._attr = pugi::xml_node::append_attribute(a1, v21, v22);
v23 = (char *)pugi::xml_attribute::value(&v25);
pugi::xml_attribute::set_value(&v26, v23);
}
break;
default:
return result;
}
return result;
}