//
// sub_C487C from 0xc487c to 0xc48ea (110 bytes)
//
// 3 xrefs:
// > sub_C6FF4 @ 0xc75da
// > sub_C6FF4 @ 0xc7732
// > sub_C6FF4 @ 0xc77cc
//
// 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_C487C(int a1, int a2, unsigned int a3)
{
unsigned int v4; // r4
int v6; // r0
unsigned int v7; // r6
int v9; // [sp+4h] [bp-14h] BYREF
if ( !a3 )
return 1;
v4 = a3;
v6 = *(_DWORD *)(a2 + 20) & 7;
if ( v6 )
{
v7 = 8 - v6;
if ( 8 - v6 >= a3 )
v7 = a3;
if ( !sub_C460A(a1, a2, &v9, v7) )
return 0;
v4 -= v7;
}
if ( !(v4 >> 3) )
return !v4 || sub_C460A(a1, a2, &v9, v4);
if ( sub_C48EA(a1, a2, v4 >> 3) )
{
v4 &= 7u;
return !v4 || sub_C460A(a1, a2, &v9, v4);
}
return 0;
}