//
// sub_C83590 from 0xc83590 to 0xc83644 (180 bytes)
//
// 1 xrefs:
// > sub_C85C88 @ 0xc85d60
//
// 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_C83590(int a1, int *a2)
{
int v2; // w7
unsigned int v3; // w1
unsigned int v4; // w0
unsigned int v5; // w5
unsigned int v6; // w4
unsigned int v7; // w2
unsigned int v8; // w1
v2 = *a2;
v3 = *(a2 - 1);
v4 = (v2 & a1) + (((v2 ^ a1) & 0xFEFEFEFE) >> 1);
v5 = HIBYTE(v4) + (int)(HIBYTE(v4) - HIBYTE(v3)) / 2;
if ( v5 > 0xFF )
v5 = ~v5 >> 24;
v6 = BYTE2(v4) + ((BYTE2(v4) - BYTE2(v3) + (BYTE2(v4) < (unsigned int)BYTE2(v3))) >> 1);
if ( v6 > 0xFF )
v6 = ~v6 >> 24;
v7 = BYTE1(v4) + ((BYTE1(v4) - BYTE1(v3) + (BYTE1(v4) < (unsigned int)BYTE1(v3))) >> 1);
if ( v7 > 0xFF )
v7 = ~v7 >> 24;
v8 = (unsigned __int8)v4 + ((unsigned __int8)v4 - (unsigned __int8)v3) / 2;
if ( v8 > 0xFF )
v8 = ~v8 >> 24;
return (v5 << 24) | (v6 << 16) | (v7 << 8) | v8;
}