//
// sub_100589544 from 0x100589544 to 0x100589658 (276 bytes)
//
// 1 xrefs:
// > sub_10058A138 @ 0x10058b0b8
//
// 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:08:34 +0000
//
__int64 __fastcall sub_100589544(__int64 a1)
{
__int64 v1; // x8
__int64 v2; // x9
int v3; // w10
int v4; // w10
_DWORD *v5; // x11
int v6; // w12
int v7; // w9
v1 = *(_QWORD *)(a1 + 8);
switch ( *(_BYTE *)(a1 + 297) )
{
case 0:
v2 = *(int *)(a1 + 272);
v3 = byte_1009DAE58[v2];
goto LABEL_8;
case 1:
LODWORD(v2) = *(_DWORD *)(a1 + 272);
v3 = (128 - (int)v2) >> 1;
goto LABEL_8;
case 2:
LODWORD(v2) = *(_DWORD *)(a1 + 272);
if ( (int)v2 >= 128 )
{
v4 = (-64 * *(unsigned __int8 *)(a1 + 277)) >> 5;
*(_DWORD *)(v1 + 84) = v4;
v5 = (_DWORD *)(v1 + 84);
LABEL_9:
v6 = *(_DWORD *)(v1 + 72);
if ( v6 + v4 >= 65 )
*v5 = 64 - v6;
goto LABEL_14;
}
v3 = 64;
LABEL_8:
v4 = (v3 * *(unsigned __int8 *)(a1 + 277)) >> 5;
*(_DWORD *)(v1 + 84) = v4;
v5 = (_DWORD *)(v1 + 84);
if ( (v2 & 0x80000000) == 0 )
goto LABEL_9;
if ( (((unsigned __int16)*(_DWORD *)(v1 + 72) - (_WORD)v4) & 0x8000) != 0 )
v4 = *(_DWORD *)(v1 + 72);
*(_DWORD *)(v1 + 84) = -v4;
LABEL_14:
v7 = v2 + *(unsigned __int8 *)(a1 + 276);
if ( v7 > 255 )
v7 -= 256;
*(_DWORD *)(a1 + 272) = v7;
*(_BYTE *)(v1 + 60) |= 4u;
return 0;
case 3:
v2 = *(int *)(a1 + 272);
v3 = byte_1009DAE58[v2];
goto LABEL_8;
default:
v3 = *(_DWORD *)(v1 + 84);
LODWORD(v2) = *(_DWORD *)(a1 + 272);
goto LABEL_8;
}
}