//
// sub_AE27CC from 0xae27cc to 0xae296c (416 bytes)
//
// 2 xrefs:
// > cocos2d::CCLabelBMFont::setString @ 0xae75c0
// > cocos2d::CCLabelBMFont::setString @ 0xae7668
//
// 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 __int64 __fastcall sub_AE27CC(const unsigned __int16 *a1)
{
int v2; // w19
unsigned __int64 v3; // x0
__int64 v4; // x21
unsigned __int64 v5; // x0
unsigned __int64 result; // x0
const unsigned __int16 *v7; // x5
_OWORD *v8; // x4
unsigned int v9; // w2
unsigned int v10; // w3
int v11; // w1
__int128 v12; // t1
__int64 v13; // x2
__int64 v14; // x1
if ( a1 )
{
v2 = cocos2d::cc_wcslen(a1);
v3 = v2 + 1;
if ( v3 <= 0x3F80000000000000LL )
{
v5 = 2 * v3;
v4 = v5 - 2;
}
else
{
v4 = 2LL * v2;
v5 = -1;
}
}
else
{
v4 = 0;
v5 = 2;
v2 = 0;
}
result = operator new[](v5);
if ( v2 <= 0 )
{
LABEL_17:
*(_WORD *)(result + v4) = 0;
return result;
}
if ( ((unsigned __int64)a1 >= result + 16 || result >= (unsigned __int64)(a1 + 8)) && (unsigned int)v2 > 9 )
{
v7 = a1;
v8 = (_OWORD *)result;
v9 = ((unsigned int)(v2 - 8) >> 3) + 1;
v10 = 0;
v11 = 8 * v9;
do
{
v12 = *(_OWORD *)v7;
v7 += 8;
++v10;
*v8++ = v12;
}
while ( v10 < v9 );
if ( v2 != v11 )
{
*(_WORD *)(result + 2LL * v11) = a1[v11];
v13 = v11;
if ( v11 + 1 < v2 )
{
*(_WORD *)(result + v13 * 2 + 2) = a1[v13 + 1];
if ( v2 > v11 + 2 )
{
*(_WORD *)(result + v13 * 2 + 4) = a1[v13 + 2];
if ( v2 > v11 + 3 )
{
*(_WORD *)(result + v13 * 2 + 6) = a1[v13 + 3];
if ( v2 > v11 + 4 )
{
*(_WORD *)(result + v13 * 2 + 8) = a1[v13 + 4];
if ( v2 > v11 + 5 )
{
*(_WORD *)(result + v13 * 2 + 10) = a1[v13 + 5];
if ( v2 > v11 + 6 )
*(_WORD *)(result + v13 * 2 + 12) = a1[v13 + 6];
}
}
}
}
}
}
goto LABEL_17;
}
v14 = 0;
do
{
*(_WORD *)(result + 2 * v14) = a1[v14];
++v14;
}
while ( v2 > (int)v14 );
*(_WORD *)(result + v4) = 0;
return result;
}