//
// cocos2d::cc_utf8_to_utf16 from 0x5ea4e8 to 0x5ea584 (156 bytes)
//
// 1 xrefs:
// > cocos2d::CCLabelBMFont::setString @ 0x5cb826
//
// 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
//
unsigned __int16 *cocos2d::cc_utf8_to_utf16(const char *a1, int *a2)
{
unsigned int v3; // r4
unsigned int v4; // r0
void *v5; // r0
size_t v6; // r2
void *v7; // r4
void *v8; // r0
_DWORD *v10; // [sp+0h] [bp-14h] BYREF
void *v11; // [sp+4h] [bp-10h] BYREF
int v12; // [sp+8h] [bp-Ch] BYREF
if ( a1 )
{
sub_776584((int)&v10, (char *)a1);
v3 = *(v10 - 3) + 1;
if ( v3 <= 0x3F800000 )
v4 = 2 * v3;
else
v4 = -1;
v5 = (void *)operator new[](v4);
v6 = 2 * v3;
v7 = v5;
memset(v5, 0, v6);
v12 = 0;
v11 = v7;
if ( !*(v10 - 3) || llvm::ConvertUTF8toWide(2, (const void **)&v10, &v11, &v12) )
{
if ( a2 )
*a2 = cocos2d::cc_wcslen((const unsigned __int16 *)v7);
}
else
{
v8 = v7;
v7 = nullptr;
operator delete[](v8);
}
sub_774008(&v10);
return (unsigned __int16 *)v7;
}
return (unsigned __int16 *)a1;
}