//
// cocos2d::cc_utf8_to_utf16 from 0x1001ad390 to 0x1001ad478 (232 bytes)
//
// 1 xrefs:
// > cocos2d::CCLabelBMFont::setString_1 @ 0x1002fbe30
//
// 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 *__fastcall cocos2d::cc_utf8_to_utf16(const char *a1, int *a2)
{
signed __int64 v3; // x23
size_t v4; // x0
_WORD *v5; // x20
__int64 v6; // x8
__int64 v9; // [xsp+8h] [xbp-58h] BYREF
void *v10; // [xsp+10h] [xbp-50h] BYREF
void *__p[2]; // [xsp+18h] [xbp-48h] BYREF
unsigned __int8 v12; // [xsp+2Fh] [xbp-31h]
if ( !a1 )
return nullptr;
sub_100009900(__p, (char *)a1);
if ( (v12 & 0x80u) == 0 )
v3 = v12;
else
v3 = (signed __int64)__p[1];
if ( v3 + 1 < 0 )
v4 = -1;
else
v4 = 2 * (v3 + 1);
v5 = operator new[](v4);
bzero(v5, 2 * (v3 + 1));
v10 = v5;
if ( v3 && !sub_1001ACEF0(2, (unsigned __int8 *)__p, &v10, &v9) )
{
operator delete[](v5);
v5 = nullptr;
}
else if ( a2 )
{
LODWORD(v6) = (unsigned __int16)*v5;
if ( *v5 )
{
v6 = 0;
while ( v5[++v6] )
;
}
*a2 = v6;
}
if ( (char)v12 < 0 )
operator delete(__p[0]);
return v5;
}