//
// llvm::ConvertUTF8toWide from 0x7f4f5c to 0x7f5066 (266 bytes)
//
// 1 xrefs:
// > cocos2d::cc_utf8_to_utf16 @ 0x7f5804
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:01:08 +0000
//
bool __fastcall llvm::ConvertUTF8toWide(int a1, unsigned __int8 *a2, void **a3, unsigned __int8 **a4)
{
int v7; // r3
unsigned __int8 *v8; // r2
unsigned __int8 *v9; // r1
int v10; // r3
int v11; // r0
int v12; // r2
size_t v13; // r2
const void *v14; // r1
int v15; // r3
int v16; // r3
int v17; // r0
void *v18; // r3
unsigned __int8 *v19; // r1
int v20; // r2
unsigned int v21; // r1
int v22; // r6
int v23; // r0
void *v24; // r3
unsigned __int8 *v25; // r1
int v26; // r2
unsigned int v27; // r1
int v28; // r6
unsigned __int8 *v30; // [sp+Ch] [bp-Ch] BYREF
unsigned __int8 *v31; // [sp+10h] [bp-8h] BYREF
switch ( a1 )
{
case 1:
v7 = *a2;
if ( (v7 & 1) != 0 )
v8 = *((unsigned __int8 **)a2 + 2);
else
v8 = a2 + 1;
v31 = v8;
if ( (v7 & 1) != 0 )
{
v9 = *((unsigned __int8 **)a2 + 2);
v10 = *((_DWORD *)a2 + 1);
}
else
{
v9 = a2 + 1;
v10 = v7 >> 1;
}
if ( !isLegalUTF8String(&v31, &v9[v10]) )
{
v11 = 3;
*a4 = v31;
return v11 == 0;
}
v12 = *a2;
if ( (v12 & 1) != 0 )
{
v13 = *((_DWORD *)a2 + 1);
v14 = *((const void **)a2 + 2);
}
else
{
v13 = v12 >> 1;
v14 = a2 + 1;
}
memcpy(*a3, v14, v13);
v15 = *a2;
if ( (v15 & 1) != 0 )
v16 = *((_DWORD *)a2 + 1);
else
v16 = v15 >> 1;
*a3 = (char *)*a3 + v16;
LABEL_42:
v11 = 0;
return v11 == 0;
case 2:
v17 = *a2;
v18 = *a3;
if ( (v17 & 1) != 0 )
v19 = *((unsigned __int8 **)a2 + 2);
else
v19 = a2 + 1;
v31 = (unsigned __int8 *)*a3;
v30 = v19;
if ( (v17 & 1) != 0 )
v20 = *((_DWORD *)a2 + 1);
else
v20 = v17 >> 1;
v21 = (unsigned int)&v19[v20];
if ( (v17 & 1) != 0 )
v22 = *((_DWORD *)a2 + 1);
else
v22 = v17 >> 1;
v11 = ConvertUTF8toUTF16(&v30, v21, (_WORD **)&v31, (unsigned int)v18 + 4 * v22, 0);
break;
case 4:
v23 = *a2;
v24 = *a3;
if ( (v23 & 1) != 0 )
v25 = *((unsigned __int8 **)a2 + 2);
else
v25 = a2 + 1;
v31 = (unsigned __int8 *)*a3;
v30 = v25;
if ( (v23 & 1) != 0 )
v26 = *((_DWORD *)a2 + 1);
else
v26 = v23 >> 1;
v27 = (unsigned int)&v25[v26];
if ( (v23 & 1) != 0 )
v28 = *((_DWORD *)a2 + 1);
else
v28 = v23 >> 1;
v11 = ConvertUTF8toUTF32(&v30, v27, (unsigned int **)&v31, (unsigned int)v24 + 16 * v28, 0);
break;
default:
goto LABEL_42;
}
if ( v11 )
*a4 = v30;
else
*a3 = v31;
return v11 == 0;
}