//
// sub_B1BED4 from 0xb1bed4 to 0xb1bff4 (288 bytes)
//
// 5 xrefs:
// > isLegalUTF8Sequence @ 0xb1c5b8
// > getUTF8StringLength @ 0xb1c63c
// > isLegalUTF8String @ 0xb1c6dc
// > ConvertUTF8toUTF16 @ 0xb1c7b4
// > ConvertUTF8toUTF32 @ 0xb1c9fc
//
// 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_B1BED4(_BYTE *a1, int a2)
{
int v2; // w3
unsigned int v3; // w2
_BYTE *v4; // x1
unsigned int v5; // w1
unsigned int v7; // w3
v2 = a2 - 1;
v3 = 0;
v4 = &a1[a2];
switch ( v2 )
{
case 0:
v5 = (unsigned __int8)*a1;
return (unsigned __int8)(v5 + 0x80) > 0x41u && v5 <= 0xF4;
case 1:
goto LABEL_9;
case 2:
goto LABEL_7;
case 3:
v3 = 0;
if ( (unsigned __int8)(*(v4 - 1) + 0x80) > 0x3Fu )
return v3;
--v4;
LABEL_7:
v3 = 0;
if ( (unsigned __int8)(*(v4 - 1) + 0x80) <= 0x3Fu )
{
--v4;
LABEL_9:
v7 = (unsigned __int8)*(v4 - 1);
v3 = 0;
if ( (unsigned __int8)(v7 + 0x80) <= 0x3Fu )
{
v5 = (unsigned __int8)*a1;
switch ( *a1 )
{
case 0xE0:
v5 = 224;
v3 = 0;
if ( v7 > 0x9F )
return (unsigned __int8)(v5 + 0x80) > 0x41u && v5 <= 0xF4;
return v3;
case 0xED:
v5 = 237;
v3 = 0;
if ( v7 <= 0x9F )
return (unsigned __int8)(v5 + 0x80) > 0x41u && v5 <= 0xF4;
return v3;
case 0xF0:
v5 = 240;
v3 = 0;
if ( v7 > 0x8F )
return (unsigned __int8)(v5 + 0x80) > 0x41u && v5 <= 0xF4;
return v3;
case 0xF4:
v3 = 0;
if ( v7 > 0x8F )
return v3;
v5 = 244;
break;
default:
return (unsigned __int8)(v5 + 0x80) > 0x41u && v5 <= 0xF4;
}
return (unsigned __int8)(v5 + 0x80) > 0x41u && v5 <= 0xF4;
}
}
return v3;
default:
return v3;
}
}