//
// sub_97AF86 from 0x97af86 to 0x97b038 (178 bytes)
//
// 0 xrefs:
//
// 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:06:03 +0000
//
int __fastcall sub_97AF86(unsigned __int8 *a1, int a2, unsigned int a3)
{
unsigned int v4; // r1
unsigned int v6; // r6
unsigned __int8 *v7; // r8
unsigned int v8; // r0
unsigned __int8 *v9; // r12
int v10; // r1
int v11; // r2
int v12; // r6
unsigned __int8 *v13; // r1
int v14; // t1
int v15; // r4
unsigned __int8 *v16; // r3
int v17; // r5
unsigned __int8 *v18; // r1
bool v19; // zf
int v20; // r2
int v21; // r1
v4 = *a1;
if ( (v4 & 1) != 0 )
{
v7 = *((unsigned __int8 **)a1 + 2);
v6 = *((_DWORD *)a1 + 1);
}
else
{
v6 = v4 >> 1;
v7 = a1 + 4;
}
v8 = sub_99883C(a2);
if ( v6 < a3 )
a3 = v6;
if ( v6 - a3 > v8 )
v6 = a3 + v8;
v9 = &v7[4 * v6];
v10 = (int)(4 * v8) >> 2;
if ( (v8 & 0x3FFFFFFF) != 0 && (int)(4 * v6) >> 2 >= v10 )
{
v11 = a2 + 4 * v8;
v12 = (int)&v7[4 * v10 - 4];
v13 = v9;
LABEL_15:
while ( (unsigned __int8 *)v12 != v13 )
{
v14 = *((_DWORD *)v13 - 1);
v13 -= 4;
if ( v14 == *(_DWORD *)(v11 - 4) )
{
v15 = 0;
while ( 4 - 4 * v8 != v15 )
{
v16 = &v13[v15];
v17 = *(_DWORD *)(v11 - 8 + v15);
v15 -= 4;
if ( *((_DWORD *)v16 - 1) != v17 )
goto LABEL_15;
}
v18 = &v13[v15];
goto LABEL_17;
}
}
}
v18 = v9;
LABEL_17:
v19 = v18 == v9;
v20 = (v18 - v7) >> 2;
v21 = v20;
if ( v19 )
v21 = -1;
if ( !v8 )
return v20;
return v21;
}