//
// sub_980AC4 from 0x980ac4 to 0x980b80 (188 bytes)
//
// 5 xrefs:
// > sub_9804C0 @ 0x980570
// > sub_9804C0 @ 0x9805fe
// > sub_9804C0 @ 0x980608
// > sub_9804C0 @ 0x980612
// > __cxa_call_unexpected @ 0x98097c
//
// 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:07 +0000
//
int __fastcall sub_980AC4(_BYTE **a1, int a2, int a3)
{
char v4; // r5
char *v5; // r1
int result; // r0
int v7; // t1
int v8; // t1
int v9; // r2
char v10; // t1
int v11; // t1
int v12; // t1
bool v13; // zf
char *v14; // [sp+4h] [bp-14h] BYREF
v4 = a2;
if ( a2 == 255 )
return 0;
v5 = *a1;
v14 = *a1;
switch ( v4 & 0xF )
{
case 0:
case 3:
case 0xB:
v7 = *(_DWORD *)v5;
v5 += 4;
result = v7;
goto LABEL_12;
case 1:
v9 = 0;
result = 0;
do
{
v10 = *v5++;
result |= (v10 & 0x7F) << v9;
v9 += 7;
}
while ( v10 < 0 );
goto LABEL_12;
case 2:
v11 = *(unsigned __int16 *)v5;
v5 += 2;
result = v11;
goto LABEL_12;
case 4:
case 0xC:
v8 = *(_DWORD *)v5;
v5 += 8;
result = v8;
goto LABEL_12;
case 9:
result = sub_980BF4(&v14, v5, a3);
goto LABEL_13;
case 0xA:
v12 = *(__int16 *)v5;
v5 += 2;
result = v12;
LABEL_12:
v14 = v5;
LABEL_13:
if ( (v4 & 0x70) == 0 )
goto LABEL_17;
if ( (v4 & 0x70) != 0x10 )
abort();
if ( result )
{
result += (int)*a1;
LABEL_17:
v13 = (v4 & 0x80) == 0;
if ( v4 < 0 )
v13 = result == 0;
if ( !v13 )
result = *(_DWORD *)result;
}
else
{
result = 0;
}
*a1 = v14;
break;
default:
abort();
return result;
}
return result;
}