//
// cocos2d::cc_utf8_trim_ws from 0x1006600f0 to 0x100660294 (420 bytes)
//
// 3 xrefs:
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1005da47d
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1005da6a2
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1005daa1d
//
// 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 __fastcall cocos2d::cc_utf8_trim_ws(std::vector *a1)
{
std::__vector_base::pointer begin; // rax
signed __int64 v2; // rsi
__int64 v3; // rcx
unsigned int v4; // r8d
__int64 v5; // rdx
int v6; // r8d
unsigned __int16 *v7; // r8
__int64 v8; // r9
unsigned int v9; // r10d
unsigned __int64 v10; // r11
unsigned __int16 *v11; // r14
char *v12; // rsi
char *v13; // rbx
unsigned __int64 v14; // r9
__int64 v15; // r10
begin = a1->__begin_;
v2 = a1->__end_ - a1->__begin_;
if ( (int)v2 <= 0 )
return;
v3 = (unsigned int)(v2 - 1);
v4 = begin[v3];
v5 = 0x100003E00LL;
if ( v4 > 0x84 )
{
if ( v4 == 133 || v4 == 160 || v4 == 5760 )
goto LABEL_5;
LABEL_30:
if ( (unsigned __int16)(v4 - 0x2000) >= 0xBu )
{
v14 = v4 - 8232;
if ( (unsigned int)v14 > 0x37 || (v15 = 0x80000000000083LL, !_bittest64(&v15, v14)) )
{
if ( v4 != 12288 )
return;
}
}
goto LABEL_5;
}
if ( v4 > 0x20 || !_bittest64(&v5, begin[v3]) )
goto LABEL_30;
LABEL_5:
v6 = 0;
if ( (_DWORD)v2 == 1 )
goto LABEL_22;
v7 = &begin[(unsigned int)(v2 - 2)];
v8 = 0x80000000000083LL;
do
{
v9 = *v7;
if ( v9 > 0x84 )
{
if ( v9 == 133 || v9 == 160 || v9 == 5760 )
goto LABEL_8;
}
else if ( v9 <= 0x20 && _bittest64(&v5, *v7) )
{
goto LABEL_8;
}
if ( (unsigned __int16)(v9 - 0x2000) >= 0xBu )
{
v10 = v9 - 8232;
if ( ((unsigned int)v10 > 0x37 || !_bittest64(&v8, v10)) && v9 != 12288 )
goto LABEL_21;
}
LABEL_8:
LODWORD(v3) = v3 - 1;
--v7;
}
while ( (int)v3 > 0 );
LODWORD(v3) = 0;
LABEL_21:
v6 = v3;
if ( (int)v3 < (int)v2 )
{
LABEL_22:
if ( (v2 & 0x7FFFFFFF) != v6 )
{
v11 = &begin[v6];
v12 = (char *)begin + (unsigned int)(2 * v2);
v13 = (char *)((char *)a1->__end_ - v12);
if ( v13 )
memmove(&begin[v6], v12, (size_t)v13);
a1->__end_ = (unsigned __int16 *)((char *)v11 + (_QWORD)v13);
}
}
}