//
// sub_82B70 from 0x82b70 to 0x82c08 (152 bytes)
//
// 1 xrefs:
// > sub_83348 @ 0x835a8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_82B70(int a1)
{
int v2; // r1
int v3; // r5
int v4; // r2
unsigned int v5; // r0
int v6; // r2
int v7; // r3
signed int v8; // r0
char v9; // r0
v2 = *(unsigned __int8 *)(a1 + 234);
v3 = *(_DWORD *)(a1 + 4);
v4 = (*(unsigned __int8 *)(a1 + 262) >> 4) & 3;
v5 = 255;
switch ( v4 )
{
case 0:
v5 = byte_E8004[v2 & 0x1F];
break;
case 1:
v5 = (8 * v2) ^ ((unsigned int)(char)v2 >> 7);
goto LABEL_5;
case 2:
break;
case 3:
LOBYTE(v5) = sub_4F410((int *)(*(_DWORD *)a1 + 2460));
LOBYTE(v2) = *(_BYTE *)(a1 + 234);
LABEL_5:
v5 = (unsigned __int8)v5;
break;
}
v6 = *(unsigned __int8 *)(a1 + 236);
v7 = *(_DWORD *)(v3 + 44);
v8 = (v6 * v5) >> 6;
if ( (v2 & 0x80u) != 0 )
{
if ( (__int16)v7 < v8 )
v8 = *(_DWORD *)(v3 + 44);
v8 = -v8;
}
else if ( v8 + v7 > 64 )
{
v8 = 64 - v7;
}
*(_DWORD *)(v3 + 52) = v8;
v9 = v2 + v6;
if ( (char)(v2 + v6) > 31 )
v9 -= 64;
*(_BYTE *)(a1 + 234) = v9;
*(_BYTE *)(v3 + 36) |= 2u;
return 0;
}