//
// sub_B4BCE4 from 0xb4bce4 to 0xb4bdb4 (208 bytes)
//
// 2 xrefs:
// > pugi::xml_node::append_attribute @ 0xb543ec
// > sub_B57FA0 @ 0xb58938
//
// 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
//
_QWORD *__fastcall sub_B4BCE4(__int64 *a1, __int64 *a2)
{
__int64 v3; // x2
__int64 v4; // x0
_QWORD *v5; // x1
__int64 v6; // x2
__int64 v7; // x3
_QWORD *result; // x0
__int64 v9; // [xsp+20h] [xbp+20h] BYREF
v3 = a2[1];
if ( (unsigned __int64)(v3 + 40) <= 0x8000 )
{
v4 = *a2;
a2[1] = v3 + 40;
v9 = v4;
v5 = (_QWORD *)(v4 + v3 + 48);
if ( v5 )
goto LABEL_3;
return nullptr;
}
v5 = sub_B4AD30((__int64)a2, 0x28u, &v9);
if ( !v5 )
return nullptr;
LABEL_3:
v5[1] = 0;
v5[2] = 0;
v5[3] = 0;
v5[4] = 0;
v6 = *a1;
*v5 = v9;
if ( v6 )
{
v7 = *(_QWORD *)(v6 + 24);
result = v5;
*(_QWORD *)(v7 + 32) = v5;
v5[3] = v7;
*(_QWORD *)(v6 + 24) = v5;
}
else
{
*a1 = (__int64)v5;
v5[3] = v5;
return v5;
}
return result;
}