//
// cocos2d::cc_utf8_trim_ws from 0xb1cf58 to 0xb1d078 (288 bytes)
//
// 4 xrefs:
// > cocos2d::CCLabelBMFont::updateLabel @ 0xae7fa8
// > cocos2d::CCLabelBMFont::updateLabel @ 0xae8008
// > cocos2d::CCLabelBMFont::updateLabel @ 0xae82a0
// > ??> @ 0xb3070
//
// 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
//
void cocos2d::cc_utf8_trim_ws(std::vector *a1)
{
signed __int64 v1; // x19
int v2; // w22
int v4; // w19
__int64 v5; // x20
unsigned __int16 v6; // w0
unsigned __int16 *m_start; // x19
unsigned __int16 *m_finish; // x2
__int64 v9; // x0
unsigned __int16 *v10; // x22
unsigned __int16 *v11; // x19
signed __int64 v12; // x2
v1 = a1->m_finish - a1->m_start;
if ( (int)v1 > 0 )
{
v2 = v1 - 1;
if ( cocos2d::isspace_unicode(a1->m_start[(int)v1 - 1]) )
{
v4 = v1 - 2;
if ( v4 != -1 )
{
v5 = v4;
while ( 1 )
{
v2 = v4 + 1;
v6 = a1->m_start[v5--];
if ( !cocos2d::isspace_unicode(v6) )
break;
if ( !v4 )
{
v2 = 0;
m_finish = a1->m_finish;
m_start = a1->m_start;
v9 = m_finish - a1->m_start;
if ( (int)v9 <= 0 )
return;
goto LABEL_10;
}
--v4;
}
}
m_start = a1->m_start;
m_finish = a1->m_finish;
v9 = m_finish - a1->m_start;
if ( (int)v9 > v2 )
{
LABEL_10:
v10 = &m_start[v2];
v11 = &m_start[(int)v9];
if ( v10 != v11 )
{
if ( m_finish == v11 )
{
v12 = 0;
}
else
{
v12 = (char *)m_finish - (char *)v11;
if ( v12 >> 1 )
{
memmove(v10, v11, v12);
v12 = (char *)a1->m_finish - (char *)v11;
}
}
a1->m_finish = (unsigned __int16 *)((char *)v10 + v12);
}
}
}
}
}