//
// pugi::xml_node::first_element_by_path from 0xb56118 to 0xb56320 (520 bytes)
//
// 4 xrefs:
// > pugi::xml_node::first_element_by_path @ 0xb56220
// > pugi::xml_node::first_element_by_path @ 0xb562f8
// > pugi::xml_node::first_element_by_path @ 0xb56314
// > ??> @ 0x9f120
//
// 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
//
pugi::xml_node_struct *__fastcall pugi::xml_node::first_element_by_path(
pugi::xml_node *this,
const char *a2,
unsigned __int8 a3)
{
pugi::xml_node_struct *root; // x0
const char *v4; // x20
int v5; // w25
int v6; // w21
const char *v7; // x19
int v8; // w0
int v9; // t1
const char *v10; // x26
int v11; // t1
signed __int64 v12; // x19
__int64 v13; // x21
unsigned __int8 *v14; // x3
__int64 v15; // x0
int v17; // w1
int v18; // t1
pugi::xml_node v19; // [xsp+50h] [xbp+50h] BYREF
__int64 v20; // [xsp+58h] [xbp+58h] BYREF
pugi::xml_node v21; // [xsp+60h] [xbp+60h] BYREF
root = this->_root;
v4 = a2;
v19._root = root;
v5 = a3;
if ( !a2 )
return v19._root;
if ( !root )
return v19._root;
v6 = *(unsigned __int8 *)a2;
if ( !*a2 )
return v19._root;
if ( v6 == a3 )
{
v4 = a2 + 1;
v19._root = pugi::xml_node::root(&v19);
v17 = *(unsigned __int8 *)v4;
if ( v6 == v17 )
{
do
{
v18 = *(unsigned __int8 *)++v4;
v17 = v18;
}
while ( v6 == v18 );
}
if ( !v17 || v5 == v17 )
return v19._root;
v6 = v17;
}
v7 = v4;
do
{
v9 = *(unsigned __int8 *)++v7;
v8 = v9;
}
while ( v5 != v9 && v8 );
v10 = v7;
if ( v4 == v7 )
return v19._root;
if ( v5 == v8 )
{
do
v11 = *(unsigned __int8 *)++v10;
while ( v11 == v5 );
}
if ( v6 != 46 )
{
LABEL_12:
v12 = v7 - v4;
v13 = *((_QWORD *)v19._root + 4);
if ( !v13 )
{
LABEL_22:
pugi::xml_node::xml_node(&v21);
return v21._root;
}
while ( 1 )
{
v14 = *(unsigned __int8 **)(v13 + 16);
if ( v14 )
{
if ( v12 )
{
if ( *v14 != *(unsigned __int8 *)v4 )
goto LABEL_21;
v15 = 0;
while ( v12 != ++v15 )
{
if ( v14[v15] != (unsigned __int8)v4[v15] )
goto LABEL_21;
}
}
if ( !v14[v12] )
{
pugi::xml_node::xml_node(&v21, v13);
v20 = pugi::xml_node::first_element_by_path(&v21, v10, v5);
if ( pugi::xml_node::operator void (*)(pugi::xml_node***)(&v20) )
return (pugi::xml_node_struct *)v20;
}
}
LABEL_21:
v13 = *(_QWORD *)(v13 + 48);
if ( !v13 )
goto LABEL_22;
}
}
if ( v7 != v4 + 1 )
{
if ( v4[1] == 46 && v7 == v4 + 2 )
{
v21._root = pugi::xml_node::parent(&v19);
return (pugi::xml_node_struct *)pugi::xml_node::first_element_by_path(&v21, v10, v5);
}
goto LABEL_12;
}
return (pugi::xml_node_struct *)pugi::xml_node::first_element_by_path(&v19, v10, v5);
}