//
// sub_7BE0F8 from 0x7be0f8 to 0x7be2e8 (496 bytes)
//
// 2 xrefs:
// > sub_7BE300 @ 0x7be848
// > sub_7BE300 @ 0x7bedc0
//
// 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_7BE0F8(unsigned int a1, __int16 a2, _BYTE *a3, int a4)
{
int v5; // r3
int v7; // r3
int v8; // r3
int v9; // r3
int v10; // r3
char v11; // [sp+3h] [bp-11h] BYREF
_BYTE v12[16]; // [sp+4h] [bp-10h] BYREF
if ( a1 >= 0x10000 )
{
BIO_snprintf(v12, 11, "\\W%08lX", a1);
if ( !a4 || BIO_write(a4, v12, 10, v7) == 10 )
return 10;
return -1;
}
if ( a1 > 0xFF )
{
BIO_snprintf(v12, 11, "\\U%04lX", a1);
if ( !a4 || BIO_write(a4, v12, 6, v8) == 6 )
return 6;
return -1;
}
v11 = a1;
if ( (a1 & 0x80) != 0 )
{
v5 = a2 & 4;
}
else
{
v5 = (unsigned __int16)(word_A0CF7C[a1] & a2);
if ( (word_A0CF7C[a1] & (unsigned __int8)a2 & 0x61) != 0 )
{
if ( (word_A0CF7C[a1] & (unsigned __int8)a2 & 8) == 0 )
{
if ( !a4 || BIO_write(a4, &word_9B841C, 1, v5) == 1 && BIO_write(a4, &v11, 1, v10) == 1 )
return 2;
return -1;
}
if ( a3 )
{
v5 = 1;
*a3 = 1;
}
goto LABEL_9;
}
}
if ( (v5 & 6) == 0 )
{
if ( a1 == 92 && (a2 & 0xF) != 0 )
{
if ( !a4 || BIO_write(a4, &word_9B8418, 2, v5) == 2 )
return 2;
return -1;
}
LABEL_9:
if ( !a4 || BIO_write(a4, &v11, 1, v5) == 1 )
return 1;
return -1;
}
BIO_snprintf(v12, 11, "\\%02X", a1);
if ( a4 && BIO_write(a4, v12, 3, v9) != 3 )
return -1;
return 3;
}