//
// cocos2d::cc_utf16_vec_from_utf16_str from 0xb1d188 to 0xb1d2c4 (316 bytes)
//
// 2 xrefs:
// > cocos2d::CCLabelBMFont::updateLabel @ 0xae7bbc
// > ??> @ 0x74478
//
// 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
//
std::vector *cocos2d::cc_utf16_vec_from_utf16_str(
std::vector *__return_ptr retstr,
const unsigned __int16 *a2)
{
int v4; // w0
int v5; // w22
__int64 v6; // x19
unsigned __int16 *m_reserveEnd; // x2
unsigned __int16 *m_finish; // x0
unsigned __int16 *m_start; // x0
signed __int64 v11; // x21
unsigned __int64 v12; // x1
unsigned __int64 v13; // x24
char *v14; // x25
unsigned __int16 *v15; // x21
__int64 v16; // x2
v4 = cocos2d::cc_wcslen(a2);
retstr->m_start = nullptr;
retstr->m_finish = nullptr;
v5 = v4;
retstr->m_reserveEnd = nullptr;
if ( v4 > 0 )
{
v6 = 0;
m_reserveEnd = nullptr;
m_finish = nullptr;
while ( 1 )
{
if ( m_reserveEnd != m_finish )
{
if ( m_finish )
*m_finish = a2[v6];
retstr->m_finish = m_finish + 1;
goto LABEL_8;
}
m_start = retstr->m_start;
v11 = (char *)m_reserveEnd - (char *)retstr->m_start;
v12 = v11 >> 1;
if ( v11 >> 1 )
{
v16 = 2 * v12;
v13 = -2;
if ( v12 <= 2 * v12 && (v16 & 0x8000000000000000LL) == 0 )
{
v13 = 4 * v12;
v14 = nullptr;
if ( !v16 )
goto LABEL_13;
}
}
else
{
v13 = 2;
}
v14 = (char *)operator new(v13);
m_start = retstr->m_start;
v11 = (char *)retstr->m_finish - (char *)retstr->m_start;
v12 = v11 >> 1;
LABEL_13:
if ( &v14[v11] )
*(_WORD *)&v14[v11] = a2[v6];
if ( v12 )
{
memmove(v14, m_start, v11);
m_start = retstr->m_start;
}
v15 = (unsigned __int16 *)&v14[v11 + 2];
if ( m_start )
operator delete(m_start);
retstr->m_start = (unsigned __int16 *)v14;
retstr->m_finish = v15;
retstr->m_reserveEnd = (unsigned __int16 *)&v14[v13];
LABEL_8:
if ( v5 <= (int)++v6 )
return retstr;
m_finish = retstr->m_finish;
m_reserveEnd = retstr->m_reserveEnd;
}
}
return retstr;
}