//
// sub_C4584 from 0xc4584 to 0xc45d6 (82 bytes)
//
// 2 xrefs:
// > ??> @ 0xc4582
// > sub_C7C28 @ 0xc86be
//
// 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
//
int __fastcall sub_C4584(_DWORD *a1)
{
unsigned int v1; // r12
unsigned int v2; // r2
unsigned int v3; // r4
unsigned int v4; // r3
int v5; // r6
v1 = a1[5];
if ( v1 )
{
v2 = a1[7];
v3 = *(_DWORD *)(*a1 + 4 * a1[4]);
v4 = 24 - v2;
while ( v2 < v1 )
{
v5 = (unsigned __int8)(v3 >> v4);
v2 += 8;
v4 -= 8;
a1[6] = (unsigned __int16)((unsigned __int16)a1[6] << 8) ^ dword_ED784[v5 ^ (a1[6] >> 8)];
a1[7] = v2;
}
}
return *((unsigned __int16 *)a1 + 12);
}