//
// ConvertUTF16toUTF32 from 0xb1c0fc to 0xb1c20c (272 bytes)
//
// 1 xrefs:
// > ??> @ 0xc64c8
//
// 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 ConvertUTF16toUTF32(
unsigned __int64 *a1,
unsigned __int64 a2,
_QWORD *a3,
unsigned __int64 a4,
int a5)
{
unsigned __int16 *v5; // x9
_DWORD *v6; // x13
int v7; // w11
_DWORD *v8; // x12
_DWORD *i; // x5
int v10; // w7
unsigned __int16 *v11; // x6
int v12; // w7
v5 = (unsigned __int16 *)*a1;
v6 = (_DWORD *)*a3;
if ( *a1 >= a2 )
{
LABEL_19:
*a1 = (unsigned __int64)v5;
*a3 = v6;
return 0;
}
v7 = *v5;
v8 = v6 + 1;
for ( i = (_DWORD *)*a3; ; ++i )
{
v12 = v7;
v11 = v5 + 1;
if ( (unsigned int)(v7 - 55296) > 0x3FF )
{
if ( !a5 && (unsigned int)(v7 - 56320) <= 0x3FF )
{
LABEL_13:
*a1 = (unsigned __int64)v5;
*a3 = i;
return 3;
}
goto LABEL_6;
}
if ( a2 <= (unsigned __int64)v11 )
break;
v10 = v5[1];
if ( (unsigned int)(v10 - 56320) > 0x3FF )
{
if ( !a5 )
goto LABEL_13;
if ( a4 <= (unsigned __int64)i )
{
LABEL_17:
*a1 = (unsigned __int64)v5;
*a3 = i;
return 2;
}
*i = v7;
v7 = v10;
goto LABEL_9;
}
v11 = v5 + 2;
v12 = ((v7 - 55296) << 10) + 9216 + v10;
LABEL_6:
if ( a4 <= (unsigned __int64)i )
goto LABEL_17;
*i = v12;
if ( (unsigned __int64)v11 >= a2 )
{
v6 = v8;
v5 = v11;
goto LABEL_19;
}
v7 = *v11;
LABEL_9:
++v8;
v5 = v11;
}
*a1 = (unsigned __int64)v5;
*a3 = i;
return 1;
}