//
// cocos2d::cc_utf8_to_utf16 from 0x7f578c to 0x7f5842 (182 bytes)
//
// 2 xrefs:
// > TextGameObject::updateTextObject @ 0x45abe0
// > cocos2d::CCLabelBMFont::setString @ 0x7d33be
//
// 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
//
cocos2d *__fastcall cocos2d::cc_utf8_to_utf16(cocos2d *this, char *a2, int *a3)
{
cocos2d *v4; // r4
size_t v5; // r0
int v6; // r4
unsigned int v7; // r4
unsigned int v8; // r0
cocos2d *v9; // r0
size_t v10; // r2
const unsigned __int16 *v11; // r1
int v12; // r3
cocos2d *v14; // r0
cocos2d *v15; // [sp+0h] [bp-18h] BYREF
unsigned __int8 *v16; // [sp+4h] [bp-14h] BYREF
int v17; // [sp+8h] [bp-10h] BYREF
int v18; // [sp+Ch] [bp-Ch]
void *v19; // [sp+10h] [bp-8h]
v4 = this;
if ( this )
{
v17 = 0;
v18 = 0;
v19 = nullptr;
v5 = strlen((const char *)this);
std::string::__init(&v17, v4, v5);
if ( (v17 & 1) != 0 )
v6 = v18;
else
v6 = (int)(unsigned __int8)v17 >> 1;
v7 = v6 + 1;
if ( v7 <= 0x3F800000 )
v8 = 2 * v7;
else
v8 = -1;
v9 = (cocos2d *)operator new[](v8);
v10 = 2 * v7;
v4 = v9;
memset(v9, 0, v10);
v16 = nullptr;
v15 = v4;
if ( (v17 & 1) != 0 )
v12 = v18;
else
v12 = (int)(unsigned __int8)v17 >> 1;
if ( v12 && !llvm::ConvertUTF8toWide(2, (unsigned __int8 *)&v17, (void **)&v15, &v16) )
{
v14 = v4;
v4 = nullptr;
operator delete[](v14);
}
else if ( a2 )
{
*(_DWORD *)a2 = cocos2d::cc_wcslen(v4, v11);
}
if ( (v17 & 1) != 0 )
operator delete(v19);
}
return v4;
}