//
// sub_10065FAE0 from 0x10065fae0 to 0x10065fb90 (176 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
//
char __fastcall sub_10065FAE0(unsigned int a1, _BYTE **a2)
{
_BYTE *v3; // rax
__int64 v4; // rdx
char v5; // cl
if ( (a1 & 0xFFFFF800) == 0xD800 )
return 0;
v3 = *a2;
if ( a1 < 0x80 )
{
*v3 = a1;
v4 = 1;
LABEL_13:
*a2 = &v3[v4];
return 1;
}
v5 = 1;
if ( a1 >= 0x800 )
{
v4 = 3;
if ( a1 >= 0x10000 )
{
if ( a1 >= 0x110000 )
{
a1 = 65533;
v5 = 0;
}
else
{
v3[3] = a1 & 0x3F | 0x80;
a1 >>= 6;
v4 = 4;
}
}
v3[2] = a1 & 0x3F | 0x80;
a1 >>= 6;
}
else
{
v4 = 2;
}
v3[1] = a1 & 0x3F | 0x80;
*v3 = byte_1008230A0[v4] | (a1 >> 6);
if ( v5 )
goto LABEL_13;
return 0;
}