//
// sub_646F3C from 0x646f3c to 0x646fa6 (106 bytes)
//
// 2 xrefs:
// > sub_64AD70 @ 0x64aed6
// > sub_64AD70 @ 0x64b38a
//
// 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_646F3C(_BYTE *a1, unsigned __int8 *a2, int a3)
{
unsigned __int8 *v3; // r2
int v4; // r5
int v5; // r12
int v6; // t1
v3 = &a2[a3];
v4 = (unsigned __int8)*a1;
while ( a2 != v3 )
{
v6 = *a2++;
v5 = v6;
if ( v4 )
{
if ( v5 < (unsigned __int8)(v4 & 0xF0) || v5 >= ((4 * v4) & 0x30) + (v4 & 0xF0) + 16 )
return 1;
v4 = byte_9DE544[(v4 & 3) + 21];
}
else if ( (v5 & 0x80) != 0 )
{
v4 = 140;
if ( (unsigned __int8)(v5 + 62) > 0x32u )
return 1;
if ( (unsigned int)v5 > 0xDF )
v4 = byte_9DE544[v5 - 224];
}
}
*a1 = v4;
return 0;
}