//
// sub_1800418B0 from 0x1800418b0 to 0x180041987 (215 bytes)
//
// 6 xrefs:
// > sub_18003FD60 @ 0x180040047
// > sub_18003FD60 @ 0x1800403a9
// > sub_18003FD60 @ 0x180040497
// > sub_180040CB0 @ 0x1800410da
// > sub_180040CB0 @ 0x1800410f6
// > ??> @ 0x1801f7f8c
//
// 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
//
__int64 __fastcall sub_1800418B0(__int64 a1)
{
char v1; // r8
__int64 v3; // r11
unsigned __int8 v4; // r9
int v5; // eax
_DWORD *v6; // r8
int v7; // edx
unsigned int v8; // eax
unsigned int v9; // ecx
unsigned __int8 v10; // cl
unsigned int v11; // ecx
int v12; // eax
v1 = *(_BYTE *)(a1 + 262);
v3 = *(_QWORD *)(a1 + 8);
v4 = v1 & 0x1F;
if ( (*(_BYTE *)(a1 + 294) & 3) != 0 )
{
switch ( *(_BYTE *)(a1 + 294) & 3 )
{
case 1:
v10 = ~(8 * v4);
if ( v1 >= 0 )
v10 = 8 * v4;
v5 = v10;
break;
case 2:
v5 = 255;
break;
case 3:
v6 = (_DWORD *)(*(_QWORD *)a1 + 3088LL);
v7 = *v6 ^ (*v6 << 11);
*v6 = *(_DWORD *)(*(_QWORD *)a1 + 3092LL);
v6[1] = v6[2];
v8 = v6[3];
v6[2] = v8;
v9 = v7 ^ v8 ^ ((v7 ^ (v8 >> 11)) >> 8);
v6[3] = v9;
v1 = *(_BYTE *)(a1 + 262);
v5 = (unsigned __int8)v9;
break;
default:
v5 = 0;
break;
}
}
else
{
v5 = byte_1801AEEE0[v4];
}
v11 = ((v5 * (unsigned int)*(unsigned __int8 *)(a1 + 264)) >> 5) & 0xFFFFFFFC;
v12 = -v11;
if ( v1 < 0 )
v12 = v11;
*(_DWORD *)(v3 + 80) = v12;
*(_BYTE *)(v3 + 60) |= 1u;
return 0;
}