//
// sub_819030 from 0x819030 to 0x8190d2 (162 bytes)
//
// 2 xrefs:
// > sub_816CF0 @ 0x816de4
// > sub_8190D8 @ 0x8190f8
//
// 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_819030(int result, int a2, unsigned __int8 *a3, int **a4)
{
double v4; // d0
int v6; // r8
unsigned int v7; // r9
int v8; // r3
int *v9; // r4
_DWORD *v10; // r7
int *v11; // r5
int v12; // r0
int v13; // r1
bool v14; // zf
int v15; // r1
int v17; // [sp+4h] [bp-20h]
_DWORD v18[4]; // [sp+Ch] [bp-18h] BYREF
v6 = result;
v7 = 1;
v8 = *(_DWORD *)(result + 4);
v9 = (int *)(v8 + 8 * a2);
v10 = v9 + 2;
v17 = ((*(_DWORD *)(result + 8) - v8) >> 3) - a2;
while ( 1 )
{
v11 = v10 - 2;
if ( *(_DWORD **)(v6 + 8) == v10 - 2 )
break;
v12 = *v11;
v13 = *(v10 - 1);
v14 = a3[1] == 2;
v18[2] = v7;
v18[0] = v12;
v18[1] = v13;
v18[3] = v17;
if ( v14 )
{
result = sub_818068(COERCE_DOUBLE(__PAIR64__(v18, (unsigned int)a3)), a4);
if ( v4 != (double)v7 )
goto LABEL_9;
LABEL_8:
result = *v11;
v15 = *(v10 - 1);
*v9 = *v11;
v9[1] = v15;
v9 += 2;
goto LABEL_9;
}
result = sub_8179AC(a3, (pugi::xpath_node *)v18, a4);
if ( result )
goto LABEL_8;
LABEL_9:
++v7;
v10 += 2;
}
*(_DWORD *)(v6 + 8) = v9;
return result;
}