//
// sub_B5CE3C from 0xb5ce3c to 0xb5cf00 (196 bytes)
//
// 5 xrefs:
// > pugi::xpath_node_set::first @ 0xb5e1cc
// > sub_B61A2C @ 0xb61b88
// > sub_B61A2C @ 0xb61c38
// > sub_B61A2C @ 0xb61ce8
// > sub_B61A2C @ 0xb6245c
//
// 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
//
__int64 __fastcall sub_B5CE3C(__int64 a1, pugi::xpath_node *a2, int a3)
{
pugi::xpath_node *v4; // x20
pugi::xpath_node *i; // x19
__int64 v7; // [xsp+38h] [xbp+38h] BYREF
v4 = (pugi::xpath_node *)a1;
if ( (pugi::xpath_node *)a1 == a2 )
goto LABEL_12;
if ( a3 == 1 )
return *(_QWORD *)v4;
if ( !a3 )
{
for ( i = (pugi::xpath_node *)(a1 + 16); a2 != i; i = (pugi::xpath_node *)((char *)i + 16) )
{
if ( sub_B5C9B8(i, v4) )
v4 = i;
}
return *(_QWORD *)v4;
}
if ( a3 != 2 )
{
LABEL_12:
pugi::xpath_node::xpath_node((pugi::xpath_node *)&v7);
return v7;
}
return *((_QWORD *)a2 - 2);
}