//
// sub_100599C48 from 0x100599c48 to 0x100599d4c (260 bytes)
//
// 8 xrefs:
// > sub_1005966B0 @ 0x100596724
// > sub_10059698C @ 0x100596a40
// > sub_10059698C @ 0x100596b00
// > sub_100596B98 @ 0x100596ca0
// > sub_100596B98 @ 0x100596fa8
// > sub_100597C20 @ 0x100597cf8
// > sub_10059A30C @ 0x10059a40c
// > sub_10059A30C @ 0x10059a604
//
// 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
//
_DWORD *__fastcall sub_100599C48(int *a1, int *a2, int *a3, int *a4)
{
unsigned int v7; // w9
int v8; // w10
unsigned int v9; // w8
int v10; // w9
int v11; // w10
unsigned int v12; // w9
int v13; // w8
int v14; // w10
unsigned int v15; // w8
int v16; // w9
int v17; // w10
unsigned int v18; // w9
int v19; // w8
int v20; // w10
_DWORD *result; // x0
unsigned int v22; // w9
int v23; // w10
unsigned int v24; // w8
int v25; // w9
int v26; // w10
unsigned int v27; // w9
int v28; // w8
int v29; // w10
unsigned int v30; // w8
int v31; // w9
int v32; // w10
unsigned int v33; // w9
int v34; // w8
int v35; // w10
v7 = a1[1];
v8 = (*a1 ^ (v7 >> 4)) & 0xF0F0F0F;
v9 = v8 ^ *a1;
v10 = v7 ^ (16 * v8);
v11 = (unsigned __int16)v10 ^ HIWORD(v9);
v12 = v11 ^ v10;
v13 = v9 ^ (v11 << 16);
v14 = (v13 ^ (v12 >> 2)) & 0x33333333;
v15 = v14 ^ v13;
v16 = v12 ^ (4 * v14);
v17 = (v16 ^ (v15 >> 8)) & 0xFF00FF;
v18 = v17 ^ v16;
v19 = v15 ^ (v17 << 8);
v20 = (v19 ^ (v18 >> 1)) & 0x55555555;
*a1 = v20 ^ v19;
a1[1] = v18 ^ (2 * v20);
sub_100598E40(a1, a2, 1);
sub_100598E40(a1, a3, 0);
result = sub_100598E40(a1, a4, 1);
v22 = a1[1];
v23 = (*a1 ^ (v22 >> 1)) & 0x55555555;
v24 = v23 ^ *a1;
v25 = v22 ^ (2 * v23);
v26 = (v25 ^ (v24 >> 8)) & 0xFF00FF;
v27 = v26 ^ v25;
v28 = v24 ^ (v26 << 8);
v29 = (v28 ^ (v27 >> 2)) & 0x33333333;
v30 = v29 ^ v28;
v31 = v27 ^ (4 * v29);
v32 = (unsigned __int16)v31 ^ HIWORD(v30);
v33 = v32 ^ v31;
v34 = v30 ^ (v32 << 16);
v35 = (v34 ^ (v33 >> 4)) & 0xF0F0F0F;
*a1 = v35 ^ v34;
a1[1] = v33 ^ (16 * v35);
return result;
}