//
// DS_Dictionary::cleanStringWhiteSpace from 0x100179b10 to 0x100179c7b (363 bytes)
//
// 2 xrefs:
// > DS_Dictionary::rectFromString @ 0x10017a3b1
// > DS_Dictionary::vec2FromString @ 0x10017a9d6
//
// 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
//
std::string *__fastcall DS_Dictionary::cleanStringWhiteSpace(std::string *a1, double a2, __int64 a3, __int64 a4)
{
unsigned int v4; // ebx
std::string::pointer data; // r12
std::string::size_type size; // rbx
std::string::value_type *v7; // r14
std::string::size_type v8; // r13
__int64 v9; // rdi
__uint32_t v10; // eax
char *v11; // r12
char *v12; // r13
std::string::pointer v13; // rcx
char *v14; // rdx
__int64 v16; // rdi
__uint32_t v17; // eax
char *v18; // [rsp+8h] [rbp-38h]
if ( (*(_BYTE *)a4 & 1) != 0 )
{
sub_100006B70(a1, *(const void **)(a4 + 16), *(_QWORD *)(a4 + 8), a2);
}
else
{
a1->__r_.__value_.__r.__words[2] = *(_QWORD *)(a4 + 16);
*(_OWORD *)&a1->__r_.__value_.__l.0 = *(_OWORD *)a4;
}
v4 = (unsigned int)a1->__r_.__value_.__l.0;
data = a1->__r_.__value_.__s.__data_;
v18 = a1->__r_.__value_.__s.__data_;
if ( (v4 & 1) != 0 )
{
data = a1->__r_.__value_.__l.__data_;
size = a1->__r_.__value_.__l.__size_;
v7 = data;
if ( !size )
goto LABEL_14;
}
else
{
size = v4 >> 1;
v7 = a1->__r_.__value_.__s.__data_;
if ( !size )
goto LABEL_14;
}
v8 = size;
v7 = data;
do
{
v9 = (unsigned int)*v7;
if ( (int)v9 < 0 )
v10 = __maskrune(v9, 0x4000);
else
v10 = _DefaultRuneLocale.__runetype[(unsigned int)v9] & 0x4000;
if ( v10 )
break;
++v7;
--v8;
}
while ( v8 );
LABEL_14:
v11 = &data[size];
v12 = v7 + 1;
if ( v7 != v11 && v7 + 1 != v11 )
{
do
{
v16 = (unsigned int)*v12;
if ( (int)v16 < 0 )
v17 = __maskrune(v16, 0x4000);
else
v17 = _DefaultRuneLocale.__runetype[(unsigned int)v16] & 0x4000;
if ( !v17 )
*v7++ = *v12;
++v12;
}
while ( v12 != v11 );
}
v13 = a1->__r_.__value_.__l.__data_;
v14 = &v18[*(_BYTE *)&a1->__r_.__value_.__l.0 >> 1];
if ( (*(_BYTE *)&a1->__r_.__value_.__s.0 & 1) != 0 )
v14 = &v13[a1->__r_.__value_.__l.__size_];
else
v13 = v18;
std::string::erase(a1, v7 - v13, v14 - v7);
return a1;
}