//
// sub_C4E7B0 from 0xc4e7b0 to 0xc4e8cc (284 bytes)
//
// 4 xrefs:
// > sub_C4E8CC @ 0xc4e940
// > sub_C4EB74 @ 0xc4ecc0
// > sub_C4F028 @ 0xc4f0b8
// > sub_C4F350 @ 0xc4f49c
//
// 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_C4E7B0(unsigned __int16 a1, __int16 *a2)
{
int v2; // w2
__int64 result; // x0
int v4; // w1
__int16 v5; // w2
int v6; // w1
__int16 v7; // w2
int v8; // w1
__int16 v9; // w2
int v10; // w1
v2 = a1 - 1;
result = 0;
switch ( v2 )
{
case 0:
case 4:
v9 = *a2;
result = 2;
v10 = *a2 & 0xFFFB;
if ( v10 != 2 )
{
result = 3;
if ( v10 != 3 )
result = ((v9 - 4) & 0xFFFB) == 0;
}
break;
case 1:
case 5:
v7 = *a2;
result = 2;
v8 = *a2 & 0xFFFB;
if ( v8 != 1 )
{
result = 1;
if ( v8 != 3 )
{
if ( ((v7 - 4) & 0xFFFB) != 0 )
result = 0;
else
result = 3;
}
}
break;
case 2:
case 6:
v5 = *a2;
result = 3;
v6 = *a2 & 0xFFFB;
if ( v6 != 1 )
{
result = 1;
if ( v6 != 2 )
{
if ( ((v5 - 4) & 0xFFFB) != 0 )
result = 0;
else
result = 2;
}
}
break;
case 3:
case 7:
result = 1;
v4 = *a2 & 0xFFFB;
if ( v4 != 1 )
{
result = 3;
if ( v4 != 2 )
{
if ( v4 == 3 )
result = 2;
else
result = 0;
}
}
break;
default:
return result;
}
return result;
}