//
// sub_C4710 from 0xc4710 to 0xc4780 (112 bytes)
//
// 7 xrefs:
// > sub_C460A @ 0xc46c8
// > sub_C460A @ 0xc4704
// > sub_C49E8 @ 0xc4a26
// > sub_C49E8 @ 0xc4ac6
// > sub_C4B48 @ 0xc4b9c
// > sub_C4B48 @ 0xc4c48
// > sub_C4B48 @ 0xc4cf6
//
// 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_C4710(int result, unsigned int a2)
{
unsigned int v2; // r3
v2 = *(_DWORD *)(result + 24);
switch ( __ROR4__(*(_DWORD *)(result + 28), 3) )
{
case 0:
v2 = (unsigned __int16)((_WORD)v2 << 8) ^ dword_ED784[(v2 >> 8) ^ HIBYTE(a2)];
goto LABEL_3;
case 1:
LABEL_3:
v2 = (unsigned __int16)((_WORD)v2 << 8) ^ dword_ED784[BYTE2(a2) ^ (v2 >> 8)];
goto LABEL_4;
case 2:
LABEL_4:
v2 = (unsigned __int16)((_WORD)v2 << 8) ^ dword_ED784[BYTE1(a2) ^ (v2 >> 8)];
goto LABEL_5;
case 3:
LABEL_5:
*(_DWORD *)(result + 24) = dword_ED784[(unsigned __int8)a2 ^ (v2 >> 8)] ^ (unsigned __int16)((_WORD)v2 << 8);
break;
default:
break;
}
*(_DWORD *)(result + 28) = 0;
return result;
}