//
// cocos2d::cc_utf8_trim_ws from 0x10073f740 to 0x10073f8e4 (420 bytes)
//
// 3 xrefs:
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1006abdcd
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1006abff2
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1006ac36d
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:36:28 +0000
//
unsigned __int16 *__fastcall cocos2d::cc_utf8_trim_ws(unsigned __int16 **a1)
{
unsigned __int16 *result; // rax
__int64 v2; // rsi
__int64 v3; // rcx
unsigned int v4; // r8d
void *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
size_t v13; // rbx
unsigned __int64 v14; // r9
__int64 v15; // r10
result = *a1;
v2 = a1[1] - *a1;
if ( (int)v2 <= 0 )
return result;
v3 = (unsigned int)(v2 - 1);
v4 = result[v3];
v5 = &loc_100003E00;
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 result;
}
}
goto LABEL_5;
}
if ( v4 > 0x20 || !_bittest64((const __int64 *)&v5, result[v3]) )
goto LABEL_30;
LABEL_5:
v6 = 0;
if ( (_DWORD)v2 == 1 )
goto LABEL_22;
v7 = &result[(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((const __int64 *)&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 = &result[v6];
v12 = (char *)result + (unsigned int)(2 * v2);
v13 = (char *)a1[1] - v12;
if ( v13 )
result = (unsigned __int16 *)memmove(&result[v6], v12, v13);
a1[1] = (unsigned __int16 *)((char *)v11 + v13);
}
}
return result;
}