//
// sub_180041A60 from 0x180041a60 to 0x180041afd (157 bytes)
//
// 4 xrefs:
// > sub_180044E10 @ 0x180045108
// > ??> @ 0x180180bd4
// > ??> @ 0x180180be4
// > ??> @ 0x1801f7fb0
//
// 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_180041A60(__int64 *a1)
{
unsigned int v1; // r11d
unsigned int v3; // r10d
__int64 v4; // rdx
__int64 v5; // rcx
unsigned int v6; // r9d
unsigned __int64 v7; // rbx
char v8; // cl
v1 = *((_DWORD *)a1 + 6);
if ( !v1 )
return *((unsigned __int16 *)a1 + 14);
v3 = *((_DWORD *)a1 + 8);
v4 = *((unsigned int *)a1 + 5);
v5 = *a1;
if ( v3 >= v1 )
return *((unsigned __int16 *)a1 + 14);
v6 = *((_DWORD *)a1 + 7);
v7 = *(unsigned int *)(v5 + 4 * v4);
do
{
v8 = 24 - v3;
v3 += 8;
v6 = dword_1801ABCE0[((unsigned __int64)v6 >> 8) ^ (unsigned __int8)(v7 >> v8)] ^ ((unsigned __int8)v6 << 8);
*((_DWORD *)a1 + 7) = v6;
*((_DWORD *)a1 + 8) = v3;
}
while ( v3 < v1 );
return (unsigned __int16)v6;
}