//
// sub_819E88 from 0x819e88 to 0x81a22e (934 bytes)
//
// 2 xrefs:
// > sub_81A290 @ 0x81a296
// > sub_81A290 @ 0x81a2e0
//
// 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:44 +0000
//
int *__fastcall sub_819E88(int a1, int a2)
{
int v2; // r5
int v4; // r3
int v5; // r7
char v6; // r6
int *result; // r0
char v8; // r3
int v9; // r3
_BYTE **v10; // r10
int v11; // r1
const char *v12; // r1
int v13; // r3
char v14; // r10
int *v15; // r7
int *v16; // r0
int *v17; // r4
int *v18; // r8
int *v19; // r0
int *v20; // r6
int v21; // r1
int v22; // r7
int v23; // r0
int v24; // r1
int v25; // [sp+4h] [bp-18h]
_BYTE *v26; // [sp+Ch] [bp-10h] BYREF
int v27; // [sp+10h] [bp-Ch]
v2 = a1;
if ( a2 && *(_BYTE *)(a2 + 1) != 1 )
{
v12 = "Step has to be applied to node set";
goto LABEL_40;
}
v4 = *(_DWORD *)(a1 + 20);
switch ( v4 )
{
case 22:
v5 = 1;
sub_80F84C((unsigned __int8 **)(a1 + 4));
v6 = 2;
goto LABEL_13;
case 23:
sub_80F84C((unsigned __int8 **)(a1 + 4));
result = sub_8101B8((int **)v2);
if ( !result )
return result;
*(_BYTE *)result = 57;
*((_BYTE *)result + 1) = 1;
v8 = 12;
goto LABEL_11;
case 24:
sub_80F84C((unsigned __int8 **)(a1 + 4));
result = sub_8101B8((int **)v2);
if ( !result )
return result;
*(_BYTE *)result = 57;
*((_BYTE *)result + 1) = 1;
v8 = 9;
LABEL_11:
*((_BYTE *)result + 2) = v8;
result[1] = a2;
*((_BYTE *)result + 3) = 2;
result[2] = 0;
result[3] = 0;
result[4] = 0;
return result;
}
v5 = 0;
v6 = 3;
LABEL_13:
v26 = nullptr;
v27 = 0;
v9 = *(_DWORD *)(v2 + 20);
if ( v9 != 20 )
{
if ( v9 == 9 )
{
LABEL_44:
v14 = 7;
sub_80F84C((unsigned __int8 **)(v2 + 4));
goto LABEL_46;
}
goto LABEL_39;
}
v10 = (_BYTE **)(v2 + 12);
v11 = *(_DWORD *)(v2 + 16);
v26 = *(_BYTE **)(v2 + 12);
v27 = v11;
sub_80F84C((unsigned __int8 **)(v2 + 4));
if ( *(_DWORD *)(v2 + 20) != 25 )
goto LABEL_76;
if ( v5 )
{
a1 = v2;
v12 = "Two axis specifiers in one step";
goto LABEL_40;
}
switch ( *v26 )
{
case 'a':
if ( sub_80F83C((int *)&v26, (int)"ancestor") )
{
v6 = 0;
}
else if ( sub_80F83C((int *)&v26, (int)"ancestor-or-self") )
{
v6 = 1;
}
else
{
if ( !sub_80F83C((int *)&v26, (int)"attribute") )
{
LABEL_61:
a1 = v2;
v12 = "Unknown axis";
goto LABEL_40;
}
v6 = 2;
}
break;
case 'c':
if ( !sub_80F83C((int *)&v26, (int)"child") )
goto LABEL_61;
v6 = 3;
break;
case 'd':
if ( sub_80F83C((int *)&v26, (int)"descendant") )
{
v6 = 4;
}
else
{
if ( !sub_80F83C((int *)&v26, (int)"descendant-or-self") )
goto LABEL_61;
v6 = 5;
}
break;
case 'f':
if ( sub_80F83C((int *)&v26, (int)"following") )
{
v6 = 6;
}
else
{
if ( !sub_80F83C((int *)&v26, (int)"following-sibling") )
goto LABEL_61;
v6 = 7;
}
break;
case 'n':
if ( !sub_80F83C((int *)&v26, (int)"namespace") )
goto LABEL_61;
v6 = 8;
break;
case 'p':
if ( sub_80F83C((int *)&v26, (int)"parent") )
{
v6 = 9;
}
else if ( sub_80F83C((int *)&v26, (int)"preceding") )
{
v6 = 10;
}
else
{
if ( !sub_80F83C((int *)&v26, (int)"preceding-sibling") )
goto LABEL_61;
v6 = 11;
}
break;
case 's':
if ( !sub_80F83C((int *)&v26, (int)"self") )
goto LABEL_61;
v6 = 12;
break;
default:
goto LABEL_61;
}
sub_80F84C((unsigned __int8 **)(v2 + 4));
v13 = *(_DWORD *)(v2 + 20);
if ( v13 == 9 )
{
v26 = nullptr;
v27 = 0;
goto LABEL_44;
}
if ( v13 != 20 )
{
LABEL_39:
a1 = v2;
v12 = "Unrecognized node test";
goto LABEL_40;
}
v21 = *(_DWORD *)(v2 + 16);
v26 = *v10;
v27 = v21;
sub_80F84C((unsigned __int8 **)(v2 + 4));
LABEL_76:
if ( *(_DWORD *)(v2 + 20) == 12 )
{
sub_80F84C((unsigned __int8 **)(v2 + 4));
v22 = *(_DWORD *)(v2 + 20);
if ( v22 != 13 )
{
if ( sub_80F83C((int *)&v26, (int)"processing-instruction") )
{
if ( v22 == 14 )
{
v24 = *(_DWORD *)(v2 + 16);
v26 = *v10;
v27 = v24;
sub_80F84C((unsigned __int8 **)(v2 + 4));
if ( *(_DWORD *)(v2 + 20) == 13 )
{
v14 = 6;
sub_80F84C((unsigned __int8 **)(v2 + 4));
goto LABEL_46;
}
a1 = v2;
v12 = "Unmatched brace near processing-instruction()";
}
else
{
a1 = v2;
v12 = "Only literals are allowed as arguments to processing-instruction()";
}
}
else
{
a1 = v2;
v12 = "Unmatched brace near node type test";
}
LABEL_40:
sub_810198(a1, (int)v12);
}
sub_80F84C((unsigned __int8 **)(v2 + 4));
v23 = sub_810AF0((int *)&v26);
v14 = v23;
if ( !v23 )
{
a1 = v2;
v12 = "Unrecognized node type";
goto LABEL_40;
}
v26 = nullptr;
v27 = 0;
}
else if ( v27 - (int)v26 > 2 && *(_BYTE *)(v27 - 2) == 58 && *(_BYTE *)(v27 - 1) == 42 )
{
v14 = 8;
--v27;
}
else
{
v14 = 1;
}
LABEL_46:
v15 = sub_811A50((int **)v2, (int)&v26);
v16 = sub_8101B8((int **)v2);
v17 = v16;
if ( v16 )
{
*((_BYTE *)v16 + 2) = v6;
*(_BYTE *)v16 = 57;
*((_BYTE *)v16 + 3) = v14;
*((_BYTE *)v16 + 1) = 1;
v16[1] = a2;
v16[2] = 0;
v16[3] = 0;
v16[4] = (int)v15;
}
v18 = nullptr;
while ( *(_DWORD *)(v2 + 20) == 18 )
{
sub_80F84C((unsigned __int8 **)(v2 + 4));
v25 = sub_819E00((int **)v2);
v19 = sub_8101B8((int **)v2);
v20 = v19;
if ( v19 )
{
*(_BYTE *)v19 = 16;
*((_BYTE *)v19 + 1) = 1;
*((_BYTE *)v19 + 2) = 0;
*((_BYTE *)v19 + 3) = 0;
v19[1] = v25;
v19[2] = 0;
v19[3] = 0;
}
if ( *(_DWORD *)(v2 + 20) != 19 )
{
a1 = v2;
v12 = "Unmatched square brace";
goto LABEL_40;
}
sub_80F84C((unsigned __int8 **)(v2 + 4));
if ( v18 )
v18[3] = (int)v20;
else
v17[2] = (int)v20;
v18 = v20;
}
return v17;
}