//
// sub_F801D8 from 0xf801d8 to 0xf802fc (292 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:13:50 +0000
//
__int64 __fastcall sub_F801D8(unsigned __int8 *a1, unsigned __int8 *a2, unsigned __int64 a3)
{
unsigned __int64 v3; // x9
unsigned __int8 *v4; // x8
unsigned __int64 v5; // x13
unsigned __int64 v6; // x9
__int64 result; // x0
bool v8; // zf
unsigned __int64 v9; // x14
int *v10; // x9
unsigned __int64 v11; // x15
unsigned __int8 *v12; // x12
unsigned __int8 *v13; // x10
unsigned __int8 *v14; // x11
__int64 v15; // x16
_DWORD *v16; // x9
int v17; // w14
int v18; // t1
__int64 v19; // x13
__int64 v20; // x15
unsigned __int8 *v21; // x0
unsigned __int64 v22; // x16
int v23; // w17
int v24; // w18
__int64 v25; // x8
v3 = *a1;
if ( (v3 & 1) != 0 )
{
v5 = *((_QWORD *)a1 + 1);
v4 = *((unsigned __int8 **)a1 + 2);
}
else
{
v4 = a1 + 4;
v5 = v3 >> 1;
}
v6 = *a2;
result = -1;
v8 = (v6 & 1) == 0;
v9 = v6 >> 1;
if ( (v6 & 1) != 0 )
v10 = *((int **)a2 + 2);
else
v10 = (int *)(a2 + 4);
if ( v8 )
v11 = v9;
else
v11 = *((_QWORD *)a2 + 1);
if ( v5 >= a3 && v5 - a3 >= v11 )
{
if ( v11 )
{
v12 = &v4[4 * a3];
v13 = &v4[4 * v5];
v14 = v12;
if ( (v11 & 0x3FFFFFFFFFFFFFFFLL) != 0 )
{
v14 = &v4[4 * v5];
v15 = (__int64)(4 * v11) >> 2;
if ( (v13 - v12) >> 2 >= v15 && &v13[4 * (1 - v15)] != v12 )
{
v18 = *v10;
v16 = v10 + 1;
v17 = v18;
v19 = -(__int64)&v4[4 * (v5 - v15)];
v20 = 4 * v11 - 4;
v21 = &v4[4 * a3];
while ( 2 )
{
v12 += 4;
while ( *((_DWORD *)v12 - 1) != v17 )
{
v21 = v12;
v12 += 4;
if ( &v12[v19] == (unsigned __int8 *)byte_8 )
goto LABEL_28;
}
v22 = 0;
do
{
if ( v20 == v22 )
{
v14 = v21;
goto LABEL_28;
}
v23 = *(_DWORD *)&v12[v22];
v24 = v16[v22 / 4];
v22 += 4LL;
}
while ( v23 == v24 );
v21 = v12;
if ( &v12[v19] != (unsigned __int8 *)byte_4 )
continue;
break;
}
}
}
LABEL_28:
v25 = (v14 - v4) >> 2;
if ( v14 == v13 )
return -1;
else
return v25;
}
else
{
return a3;
}
}
return result;
}