//
// sub_8163F8 from 0x8163f8 to 0x816440 (72 bytes)
//
// 5 xrefs:
// > pugi::xpath_node_set::first @ 0x816c34
// > sub_8183A0 @ 0x818452
// > sub_8183A0 @ 0x8184a2
// > sub_8183A0 @ 0x8184e4
// > sub_8183A0 @ 0x8189be
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:01:42 +0000
//
void (**__fastcall sub_8163F8(void (**a1)(), void (**a2)(), int a3, int a4))()
{
void (**v5)(); // r4
void (*v7)(); // r0
void (*v8)(); // r1
void (**i)(); // r6
v5 = a2;
if ( a2 == (void (**)())a3 )
goto LABEL_13;
if ( a4 == 1 )
{
LABEL_11:
v7 = *v5;
v8 = v5[1];
goto LABEL_12;
}
if ( !a4 )
{
for ( i = a2 + 2; i != (void (**)())a3; i += 2 )
{
if ( sub_816170(i, v5, a3) )
v5 = i;
}
goto LABEL_11;
}
if ( a4 != 2 )
{
LABEL_13:
pugi::xpath_node::xpath_node((pugi::xpath_node *)a1);
return a1;
}
v7 = *(void (**)())(a3 - 8);
v8 = *(void (**)())(a3 - 4);
LABEL_12:
*a1 = v7;
a1[1] = v8;
return a1;
}