//
// pugi::xml_node::insert_attribute_before from 0xdc82ec to 0xdc847c (400 bytes)
//
// 2 xrefs:
// > pugi::xml_node::insert_copy_before @ 0xdc8864
// > ??> @ 0xc6c58
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:08:53 +0000
//
__int64 *__fastcall pugi::xml_node::insert_attribute_before(
pugi::xml_node *this,
char *a2,
const pugi::xml_attribute *a3)
{
__int64 *result; // x0
__int64 i; // x1
__int64 *v8; // x0
__int64 v9; // x2
__int64 v10; // x1
_QWORD *v11; // x1
__int64 v12; // x0
__int64 *v13; // x1
__int64 *v14; // [xsp+48h] [xbp+48h] BYREF
__int64 v15; // [xsp+50h] [xbp+50h] BYREF
if ( (unsigned int)pugi::xml_node::type(this) != 2 && (unsigned int)pugi::xml_node::type(this) != 7 )
goto LABEL_3;
if ( pugi::xml_attribute::empty(a3) )
goto LABEL_3;
for ( i = *(_QWORD *)a3; *(_QWORD *)(*(_QWORD *)(i + 24) + 32LL); i = *(_QWORD *)(i + 24) )
;
if ( *(_QWORD *)(*(_QWORD *)this + 56LL) != i )
goto LABEL_3;
v8 = *(__int64 **)(**(_QWORD **)this & 0xFFFFFFFFFFFFFFE0LL);
v9 = v8[1];
if ( (unsigned __int64)(v9 + 40) > 0x8000 )
{
v11 = sub_DBE65C((__int64)v8, 0x28u, &v15);
}
else
{
v10 = *v8;
v8[1] = v9 + 40;
v15 = v10;
v11 = (_QWORD *)(v10 + v9 + 48);
}
if ( v11 )
{
*v11 = v15;
v11[1] = 0;
v11[2] = 0;
v11[3] = 0;
v11[4] = 0;
}
pugi::xml_attribute::xml_attribute(&v14, (__int64)v11);
if ( !pugi::xml_attribute::operator!(&v14) )
{
pugi::xml_attribute::set_name(&v14, a2);
v12 = *(_QWORD *)(*(_QWORD *)a3 + 24LL);
v13 = v14;
if ( *(_QWORD *)(v12 + 32) )
*(_QWORD *)(v12 + 32) = v14;
else
*(_QWORD *)(*(_QWORD *)this + 56LL) = v14;
result = v14;
v13[3] = *(_QWORD *)(*(_QWORD *)a3 + 24LL);
v13[4] = *(_QWORD *)a3;
*(_QWORD *)(*(_QWORD *)a3 + 24LL) = v13;
}
else
{
LABEL_3:
pugi::xml_attribute::xml_attribute(&v15);
return (__int64 *)v15;
}
return result;
}