//
// sub_1005A782C from 0x1005a782c to 0x1005a796c (320 bytes)
//
// 4 xrefs:
// > sub_1005A7BBC @ 0x1005a7cec
// > sub_1005A7BBC @ 0x1005a7d2c
// > sub_1005A8710 @ 0x1005a887c
// > sub_1005A8710 @ 0x1005a88a8
//
// 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 11:09:05 +0000
//
__int64 __fastcall sub_1005A782C(
__int64 a1,
int *a2,
__int64 a3,
int a4,
__int64 a5,
char a6,
int a7,
int a8,
unsigned __int8 a9,
char a10)
{
int v10; // w10
int v11; // w9
int v12; // w13
int v13; // w16
int v14; // w15
__int64 v16; // x17
int v17; // w16
int v18; // w15
int v19; // w17
int v20; // w0
int v21; // w16
int v22; // w17
v10 = a2[1];
if ( v10 >= a4 )
{
v14 = a2[2];
v11 = *a2;
LABEL_23:
a2[3] = v14 >> 16;
*a2 = v11 + 1;
goto LABEL_24;
}
v11 = *a2;
if ( *a2 && v11 != *(unsigned __int16 *)(a5 + 4LL * v10) )
{
v14 = a2[2] + a2[4];
a2[2] = v14;
goto LABEL_23;
}
v12 = 2 * a7;
while ( 1 )
{
if ( (a6 & 4) != 0 && v10 == a8 )
{
v11 = *(unsigned __int16 *)(a5 + 2LL * v12);
*a2 = v11;
a2[1] = a7;
v16 = v12;
v17 = 2 * a7;
v10 = a7;
}
else
{
v17 = 2 * v10;
v16 = 2 * v10;
}
v18 = *(unsigned __int16 *)(a5 + 2LL * (v17 | 1));
if ( v10 == a4 - 1 )
{
a2[3] = v18;
*((_BYTE *)a2 + 20) = 1;
goto LABEL_24;
}
v19 = *(unsigned __int16 *)(a5 + 2 * v16);
v20 = *(unsigned __int16 *)(a5 + 2LL * (v17 + 2));
v21 = *(unsigned __int16 *)(a5 + 2LL * (v17 + 3));
if ( (a6 & 2) != 0 && v10 == a9 && !*(_BYTE *)(a3 + 188) )
break;
v22 = v20 - v19;
if ( v22 )
v13 = ((v21 - v18) << 16) / v22;
else
v13 = 0;
v14 = v18 << 16;
a2[4] = v13;
a2[1] = ++v10;
a2[2] = v14;
if ( v11 != *(unsigned __int16 *)(a5 + 4LL * v10) || v10 >= a4 )
goto LABEL_23;
}
a2[3] = v18;
LABEL_24:
*(_BYTE *)(a3 + 60) |= a10;
return 0;
}