//
// sub_F89B6C from 0xf89b6c to 0xf89c90 (292 bytes)
//
// 9 xrefs:
// > sub_F891EC @ 0xf892b8
// > sub_F891EC @ 0xf89368
// > sub_F891EC @ 0xf89378
// > sub_F891EC @ 0xf89388
// > sub_F891EC @ 0xf894f4
// > sub_F891EC @ 0xf8961c
// > __cxa_call_unexpected @ 0xf89890
// > __cxa_call_unexpected @ 0xf899cc
// > __cxa_call_unexpected @ 0xf89ab8
//
// 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 13:13:55 +0000
//
unsigned __int64 __fastcall sub_F89B6C(unsigned __int16 **a1, unsigned __int8 a2)
{
unsigned __int16 *v2; // x11
unsigned __int64 v3; // x8
unsigned __int16 *v4; // x10
__int64 v5; // x12
char v6; // t1
unsigned __int64 v7; // x12
__int64 v8; // x8
char v9; // w13
char v10; // t1
bool v11; // w15
__int64 v12; // x12
unsigned __int64 result; // x0
if ( a2 != 255 )
{
v2 = *a1;
switch ( a2 & 0xF )
{
case 0:
case 4:
case 0xC:
v4 = v2 + 4;
v3 = *(_QWORD *)v2;
break;
case 1:
v5 = 0;
v3 = 0;
v4 = *a1;
do
{
v6 = *(_BYTE *)v4;
v4 = (unsigned __int16 *)((char *)v4 + 1);
v3 |= (unsigned __int64)(v6 & 0x7F) << v5;
v5 += 7;
}
while ( v6 < 0 );
break;
case 2:
v4 = v2 + 1;
v3 = *v2;
break;
case 3:
v4 = v2 + 2;
v3 = *(unsigned int *)v2;
break;
case 9:
v7 = 0;
v8 = 0;
v4 = *a1;
do
{
v10 = *(_BYTE *)v4;
v4 = (unsigned __int16 *)((char *)v4 + 1);
v9 = v10;
v8 |= (unsigned __int64)(v10 & 0x7F) << v7;
v7 += 7LL;
}
while ( v10 < 0 );
v11 = v7 < 0x40;
v12 = -1LL << v7;
if ( (*(_DWORD *)&v11 & ((unsigned __int8)(v9 & 0x40) >> 6)) == 0 )
v12 = 0;
v3 = v8 | v12;
break;
case 0xA:
v4 = v2 + 1;
v3 = (__int16)*v2;
break;
case 0xB:
v4 = v2 + 2;
v3 = *(int *)v2;
break;
default:
abort();
return result;
}
if ( (a2 & 0x70) != 0 )
{
if ( (a2 & 0x70) != 0x10 )
abort();
if ( !v3 )
goto LABEL_24;
v3 += (unsigned __int64)v2;
}
if ( (a2 & 0x80) != 0 && v3 )
v3 = *(_QWORD *)v3;
LABEL_24:
*a1 = v4;
return v3;
}
return 0;
}