//
// sub_1004C6AF4 from 0x1004c6af4 to 0x1004c6b8c (152 bytes)
//
// 1 xrefs:
// > sub_10047AA2C @ 0x10047aacc
//
// 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_1004C6AF4(_BYTE *a1)
{
char v1; // w9
int v2; // w11
unsigned __int8 *v3; // x8
int v4; // w10
int v5; // t1
v1 = *a1;
if ( !*a1 )
return 0xFFFFFFFFLL;
v2 = 0;
v3 = a1 + 1;
while ( v2 )
{
v4 = v2;
if ( (v1 & 0xC0) != 0x80 )
return 0;
LABEL_4:
v2 = v4 - 1;
v5 = *v3++;
v1 = v5;
if ( !v5 )
return (unsigned int)((v4 - 2) >> 31);
}
if ( (v1 & 0x80) == 0 )
{
v4 = 1;
goto LABEL_4;
}
if ( (v1 & 0xE0) == 0xC0 )
{
v4 = 2;
goto LABEL_4;
}
if ( (v1 & 0xF0) == 0xE0 )
{
v4 = 3;
goto LABEL_4;
}
if ( (v1 & 0xF8) == 0xF0 )
{
v4 = 4;
goto LABEL_4;
}
return 0;
}