//
// sub_B5CF00 from 0xb5cf00 to 0xb5d24c (844 bytes)
//
// 2 xrefs:
// > sub_B61A2C @ 0xb61bfc
// > sub_B61A2C @ 0xb61c48
//
// 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
//
char *__fastcall sub_B5CF00(pugi::xpath_node *a1)
{
pugi::xml_node_struct *v2; // x25
char *v3; // x21
char *v4; // x0
signed __int64 v5; // x20
char *v6; // x0
char *v7; // x1
const char *v8; // x3
int v9; // w2
int v10; // t1
__int64 v12; // x1
char *v13; // x20
char *v14; // x0
signed __int64 v15; // x21
char *v16; // x0
char *v17; // x1
const char *v18; // x3
int v19; // w2
int v20; // t1
__int64 v21; // x1
__int64 v22; // [xsp+58h] [xbp+58h] BYREF
pugi::xml_attribute v23; // [xsp+60h] [xbp+60h] BYREF
pugi::xml_node v24; // [xsp+68h] [xbp+68h] BYREF
pugi::xml_attribute v25; // [xsp+70h] [xbp+70h] BYREF
v22 = pugi::xpath_node::attribute(a1);
if ( !pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v22) )
{
v23._attr = pugi::xpath_node::node(a1);
v13 = pugi::xml_node::name((pugi::xml_node *)&v23);
v14 = strchr(v13, 58);
v15 = v14 - v13;
if ( !v14 )
{
v13 = nullptr;
v15 = 0;
}
for ( v24._root = v23._attr; ; v24._root = pugi::xml_node::parent(&v24) )
{
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&v24) )
return &byte_F288A0;
if ( v24._root )
{
v25._attr = pugi::xml_node::first_attribute(&v24);
if ( pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
break;
}
LABEL_36:
pugi::xml_attribute::xml_attribute(&v25);
LABEL_43:
if ( pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
return pugi::xml_attribute::value(&v25);
}
while ( 1 )
{
v16 = pugi::xml_attribute::name(&v25);
if ( *v16 == 120 )
{
v17 = v16;
v18 = "xmlns";
while ( 1 )
{
v20 = *(unsigned __int8 *)++v18;
v19 = v20;
++v17;
if ( !v20 )
break;
if ( (unsigned __int8)*v17 != v19 )
goto LABEL_35;
}
if ( v13 )
{
if ( v16[5] == 58 )
{
if ( v15 )
{
if ( v16[6] != *v13 )
goto LABEL_35;
v21 = 0;
while ( ++v21 != v15 )
{
if ( v16[v21 + 6] != v13[v21] )
goto LABEL_35;
}
}
if ( !v16[v15 + 6] )
goto LABEL_43;
}
}
else if ( !v16[5] )
{
goto LABEL_43;
}
}
LABEL_35:
v25._attr = pugi::xml_attribute::next_attribute(&v25);
if ( !pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
goto LABEL_36;
}
}
v23._attr = (pugi::xml_attribute_struct *)pugi::xpath_node::attribute(a1);
v2 = pugi::xpath_node::parent((pugi::xml_node *)a1);
v3 = pugi::xml_attribute::name(&v23);
v4 = strchr(v3, 58);
if ( !v4 )
return &byte_F288A0;
v5 = v4 - v3;
v24._root = v2;
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&v24) )
return &byte_F288A0;
while ( v24._root )
{
v25._attr = pugi::xml_node::first_attribute(&v24);
if ( !pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
break;
while ( 1 )
{
v6 = pugi::xml_attribute::name(&v25);
if ( *v6 != 120 )
goto LABEL_11;
v7 = v6;
v8 = "xmlns";
while ( 1 )
{
v10 = *(unsigned __int8 *)++v8;
v9 = v10;
++v7;
if ( !v10 )
break;
if ( (unsigned __int8)*v7 != v9 )
goto LABEL_11;
}
if ( v6[5] != 58 )
goto LABEL_11;
if ( !v5 )
break;
if ( v6[6] == *v3 )
{
v12 = 0;
while ( v5 != ++v12 )
{
if ( v6[v12 + 6] != v3[v12] )
goto LABEL_11;
}
break;
}
LABEL_11:
v25._attr = pugi::xml_attribute::next_attribute(&v25);
if ( !pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
goto LABEL_12;
}
if ( v6[v5 + 6] )
goto LABEL_11;
if ( pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
return pugi::xml_attribute::value(&v25);
LABEL_21:
v24._root = pugi::xml_node::parent(&v24);
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&v24) )
return &byte_F288A0;
}
LABEL_12:
pugi::xml_attribute::xml_attribute(&v25);
if ( !pugi::xml_attribute::operator void (*)(pugi::xml_attribute***)(&v25) )
goto LABEL_21;
return pugi::xml_attribute::value(&v25);
}