//
// sub_86A90 from 0x86a90 to 0x86b46 (182 bytes)
//
// 2 xrefs:
// > sub_86DAC @ 0x87332
// > sub_874A4 @ 0x879a2
//
// 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 11:41:20 +0000
//
int __fastcall sub_86A90(int a1, _BYTE *a2)
{
int v2; // r6
int v3; // r0
int v4; // r0
int v5; // r5
int v6; // r4
int v7; // r0
int v8; // r0
int v9; // r0
v2 = *(_DWORD *)(a1 + 4);
switch ( a2[1223] )
{
case 0:
v3 = byte_E8024[*(_DWORD *)(v2 + 156)];
break;
case 1:
v3 = -64;
if ( *(int *)(v2 + 156) < 128 )
v3 = 64;
break;
case 2:
v4 = *(_DWORD *)(v2 + 156) + 128;
goto LABEL_9;
case 3:
v4 = 384 - *(_DWORD *)(v2 + 156);
LABEL_9:
v3 = (int)(((v4 + ((unsigned int)(v4 >> 31) >> 24)) & 0xFFFFFF00) - v4 + 128) >> 1;
break;
default:
v3 = 0;
break;
}
v5 = (unsigned __int8)a2[1224];
v6 = *(_DWORD *)(v2 + 160);
v7 = v3 * (unsigned __int8)a2[1225];
if ( a2[1224] )
v7 = v7 * v6 / v5;
else
v5 = 0;
if ( v6 < v5 )
v5 = v6 + 1;
*(_DWORD *)(v2 + 160) = v5;
*(_DWORD *)(v2 + 56) += v7 >> 6;
v8 = (unsigned __int8)a2[1226];
*(_BYTE *)(v2 + 36) |= 1u;
v9 = v8 + *(_DWORD *)(v2 + 156);
if ( v9 > 255 )
v9 -= 256;
*(_DWORD *)(v2 + 156) = v9;
return 0;
}