//
// sub_810608 from 0x810608 to 0x8106ac (164 bytes)
//
// 1 xrefs:
// > sub_81406C @ 0x814b1a
//
// 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:37 +0000
//
unsigned __int8 *__fastcall sub_810608(unsigned __int8 *a1, int a2, int a3, int a4)
{
unsigned __int8 *v5; // r4
int v6; // r0
unsigned int v7; // r0
_BYTE *v8; // r3
int v10; // t1
unsigned int v11; // r0
_BYTE *v12; // r3
int v13; // t1
_DWORD v14[3]; // [sp+4h] [bp-Ch] BYREF
v14[2] = a4;
v5 = a1;
v14[0] = 0;
v14[1] = 0;
while ( 1 )
{
while ( 1 )
{
v6 = *v5;
if ( (a7[v6] & 1) == 0 )
goto LABEL_3;
if ( v6 == 60 )
{
v7 = sub_80FCC2((int)v14, (int)v5);
do
{
v8 = (_BYTE *)v7;
if ( v7 <= (unsigned int)a1 )
break;
v10 = *(unsigned __int8 *)--v7;
}
while ( (a7[v10] & 8) != 0 );
*v8 = 0;
return v5 + 1;
}
if ( v6 != 38 )
break;
v5 = sub_810344(v5, v14);
}
if ( !*v5 )
break;
LABEL_3:
++v5;
}
v11 = sub_80FCC2((int)v14, (int)v5);
do
{
v12 = (_BYTE *)v11;
if ( v11 <= (unsigned int)a1 )
break;
v13 = *(unsigned __int8 *)--v11;
}
while ( (a7[v13] & 8) != 0 );
*v12 = 0;
return v5;
}