//
// GameToolbox::stripNonBreakingSpaces from 0x6a2068 to 0x6a2334 (716 bytes)
//
// 10 xrefs:
// > GameToolbox::singleLineSnippet @ 0x6a2388
// > CommentCell::loadFromComment @ 0x74b204
// > ShareLevelLayer::init @ 0x7f41e8
// > InfoLayer::init @ 0x90c2ec
// > FriendRequestPopup::loadFromGJFriendRequest @ 0xa2ba04
// > ShareListLayer::init @ 0xbad240
// > ThreadRequestPopup::init @ 0xc80474
// > CommentOptionsPopup::onCopy @ 0xcfe600
// > CommentOptionsPopup::init @ 0xcffc98
// > ??> @ 0x483d0
//
// 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 12:50:43 +0000
//
__int64 __fastcall GameToolbox::stripNonBreakingSpaces(unsigned __int8 *a1)
{
unsigned __int8 v2; // w0
unsigned __int64 v3; // x1
int v4; // w6
unsigned __int64 v5; // x1
unsigned __int8 v6; // w7
int v7; // w3
unsigned __int64 v8; // x0
int v9; // w4
unsigned __int64 v10; // x5
unsigned __int64 v11; // x20
int v12; // w2
unsigned __int8 *v13; // x0
unsigned __int8 *v14; // x8
unsigned __int8 *v15; // x0
unsigned __int64 v16; // x0
unsigned __int64 v17; // x6
unsigned __int8 *v18; // x3
size_t v19; // x2
bool v20; // cc
unsigned __int8 *v21; // x1
__int64 v22; // x0
__int64 v23; // x1
void *v25; // x1
__int64 v26; // x2
__int64 v27; // x3
__int64 v28; // x4
__int64 v29; // x5
__int64 v30; // [xsp+38h] [xbp+38h] BYREF
__int64 v31; // [xsp+40h] [xbp+40h]
void *v32; // [xsp+48h] [xbp+48h]
__int64 v33; // [xsp+50h] [xbp+50h]
__int64 v34; // [xsp+58h] [xbp+58h]
void *v35; // [xsp+60h] [xbp+60h]
v30 = 0;
v2 = *a1;
v31 = 0;
v3 = v2 >> 1;
v32 = nullptr;
if ( (v2 & 1) != 0 )
v3 = *((_QWORD *)a1 + 1);
std::string::reserve(&v30, v3);
v4 = *a1;
v5 = 0;
v6 = v4 & 1;
LABEL_4:
while ( 1 )
{
v7 = v6;
if ( !v6 )
break;
LABEL_5:
v8 = *((_QWORD *)a1 + 1);
if ( v5 >= v8 )
{
v25 = *((void **)a1 + 2);
v26 = *(_QWORD *)a1;
v27 = *((_QWORD *)a1 + 1);
v28 = v30;
v29 = v31;
*((_QWORD *)a1 + 2) = v32;
*(_QWORD *)a1 = v28;
*((_QWORD *)a1 + 1) = v29;
v32 = v25;
v35 = v25;
v33 = v26;
v34 = v27;
v30 = v26;
v31 = v27;
operator delete(v25);
return _stack_chk_guard;
}
v9 = *(unsigned __int8 *)(*((_QWORD *)a1 + 2) + v5);
if ( (v9 & 0xE0) == 0xC0 )
{
LABEL_54:
v11 = v5 + 2;
v10 = 2;
LABEL_12:
if ( v8 < v11 )
goto LABEL_40;
goto LABEL_13;
}
if ( (v9 & 0xF0) == 0xE0 )
{
v11 = v5 + 3;
v10 = 3;
goto LABEL_12;
}
LABEL_8:
if ( (v9 & 0xF8) == 0xF0 )
{
v10 = 4;
LABEL_10:
v11 = v10 + v5;
v12 = v4 >> 1;
if ( v7 )
{
v8 = *((_QWORD *)a1 + 1);
goto LABEL_12;
}
goto LABEL_39;
}
v10 = 1;
if ( (v9 & 0x80) == 0 )
goto LABEL_10;
++v5;
}
while ( 1 )
{
v12 = v4 >> 1;
v8 = v4 >> 1;
if ( v5 >= v8 )
break;
v9 = a1[v5 + 1];
if ( (v9 & 0xE0) == 0xC0 )
goto LABEL_54;
if ( (v9 & 0xF0) != 0xE0 )
goto LABEL_8;
v11 = v5 + 3;
v10 = 3;
LABEL_39:
if ( v12 < v11 )
{
LABEL_40:
++v5;
goto LABEL_4;
}
LABEL_13:
if ( v10 > 1 )
{
v13 = a1 + 1;
if ( v7 )
v13 = *((unsigned __int8 **)a1 + 2);
if ( (v13[v5 + 1] & 0xC0) != 0x80 )
goto LABEL_46;
if ( v10 != 2 )
{
v14 = a1 + 1;
if ( v7 )
v14 = *((unsigned __int8 **)a1 + 2);
if ( (v14[v5 + 2] & 0xC0) != 0x80 )
goto LABEL_46;
if ( v10 != 3 )
{
v15 = a1 + 1;
if ( v7 )
v15 = *((unsigned __int8 **)a1 + 2);
if ( (v15[v5 + 3] & 0xC0) != 0x80 )
{
LABEL_46:
++v5;
goto LABEL_4;
}
}
}
}
if ( v9 == 194 && v10 == 2 )
{
v16 = v5 + 1;
if ( !v7 )
{
if ( a1[v16 + 1] == 160 )
{
LABEL_48:
v5 = v11;
goto LABEL_4;
}
LABEL_42:
v17 = (unsigned __int8)v4 >> 1;
if ( v5 > v17 )
LABEL_52:
sub_62B474();
v18 = a1 + 1;
goto LABEL_31;
}
if ( *(unsigned __int8 *)(*((_QWORD *)a1 + 2) + v16) == 160 )
goto LABEL_48;
}
else if ( !v7 )
{
goto LABEL_42;
}
v17 = *((_QWORD *)a1 + 1);
if ( v5 > v17 )
goto LABEL_52;
v18 = *((unsigned __int8 **)a1 + 2);
LABEL_31:
v19 = v17 - v5;
v20 = v17 - v5 > v10;
v21 = &v18[v5];
if ( v20 )
v19 = v10;
std::string::append((__int64)&v30, v21, v19);
v4 = *a1;
v5 = v11;
v6 = v4 & 1;
v7 = v4 & 1;
if ( (v4 & 1) != 0 )
goto LABEL_5;
}
v22 = v30;
v23 = v31;
*((_QWORD *)a1 + 2) = v32;
*(_QWORD *)a1 = v22;
*((_QWORD *)a1 + 1) = v23;
return _stack_chk_guard;
}