//
// cocos2d::cc_utf8_trim_ws from 0x100241efc to 0x100241fe0 (228 bytes)
//
// 3 xrefs:
// > cocos2d::CCLabelBMFont::updateLabel @ 0x100398f34
// > cocos2d::CCLabelBMFont::updateLabel @ 0x10039903c
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1003990cc
//
// This function is hookable on this platform (idp: arm, 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 11:01:24 +0000
//
_QWORD *__fastcall cocos2d::cc_utf8_trim_ws(_QWORD *result)
{
__int64 v1; // x21
__int64 v2; // x22
unsigned __int64 v3; // x20
unsigned __int64 v4; // x24
unsigned int v5; // w23
_QWORD *v6; // x19
__int64 v7; // x25
__int64 v8; // x8
size_t v9; // x21
v2 = *result;
v1 = result[1];
v3 = v1 - *result;
v4 = v3 >> 1;
v5 = (v3 >> 1) - 1;
if ( (int)(v3 >> 1) < 1 )
return result;
v6 = result;
result = (_QWORD *)cocos2d::isspace_unicode(*(unsigned __int16 *)(v2 + 2LL * v5));
if ( !(_DWORD)result )
return result;
if ( (_DWORD)v4 == 1 )
{
v5 = 0;
LABEL_12:
v8 = v3 & 0x1FFFFFFFELL;
if ( 2LL * v5 != (v3 & 0x1FFFFFFFELL) )
{
v9 = v1 - (v2 + v8);
if ( v9 )
result = memmove((void *)(v2 + 2LL * v5), (const void *)(v2 + v8), v9);
v6[1] = v2 + 2LL * v5 + v9;
}
return result;
}
v7 = (unsigned int)(v4 - 2);
result = (_QWORD *)cocos2d::isspace_unicode(*(unsigned __int16 *)(v2 + 2LL * (unsigned int)v7));
if ( (_DWORD)result )
{
v5 = v4 - 1;
while ( v7 >= 1 )
{
result = (_QWORD *)cocos2d::isspace_unicode(*(unsigned __int16 *)(v2 - 2 + 2 * v7));
--v5;
--v7;
if ( ((unsigned __int8)result & 1) == 0 )
goto LABEL_11;
}
v5 = 0;
}
LABEL_11:
if ( (int)v5 < (int)v4 )
goto LABEL_12;
return result;
}