//
// sub_862F04 from 0x862f04 to 0x862fe8 (228 bytes)
//
// 0 xrefs:
//
// 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_862F04(unsigned int a1, unsigned int *a2)
{
unsigned int v2; // r4
bool v5; // cc
bool v7; // cc
v2 = *a2;
if ( (*a2 & 1) != 0 )
{
if ( a1 <= 0x7F )
{
v7 = a1 > 0x20;
if ( a1 != 32 )
v7 = a1 - 48 > 9;
if ( !v7 )
{
if ( (v2 & 2) == 0 )
goto LABEL_15;
goto LABEL_6;
}
}
v2 &= ~1u;
}
if ( (v2 & 2) == 0 )
goto LABEL_13;
if ( a1 > 0x7F )
{
LABEL_12:
v2 &= ~2u;
LABEL_13:
if ( ((a1 > 0x7F) & (v2 >> 4)) != 0 )
v2 &= ~0x10u;
goto LABEL_15;
}
LABEL_6:
if ( (a1 & 0xFFFFFFDF) - 65 > 0x19 )
{
v5 = a1 > 0x20;
if ( a1 != 32 )
v5 = a1 - 48 > 9;
if ( v5 && !strchr("'()+,-./:=?", a1) )
goto LABEL_12;
}
LABEL_15:
if ( ((a1 > 0xFF) & (v2 >> 2)) != 0 )
v2 &= ~4u;
if ( (v2 & 0x800) != 0 )
{
if ( a1 < 0x10000 )
{
LABEL_21:
*a2 = v2;
return 1;
}
v2 &= ~0x800u;
}
if ( v2 )
goto LABEL_21;
return -1;
}