//
// tinyxml2::StrPair::CollapseWhitespace from 0xb23378 to 0xb23450 (216 bytes)
//
// 2 xrefs:
// > tinyxml2::StrPair::GetStr @ 0xb2380c
// > ??> @ 0x35da8
//
// 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
//
__int64 __fastcall tinyxml2::StrPair::CollapseWhitespace(__int64 this)
{
_BYTE *v1; // x21
__int64 v2; // x20
int v3; // w19
__int64 v4; // x20
_BYTE *v5; // x21
int v6; // t1
int v7; // t1
v1 = *(_BYTE **)(this + 8);
v2 = this;
v3 = (unsigned __int8)*v1;
LODWORD(this) = v3 & 0xFFFFFF80;
if ( (v3 & 0x80) != 0 )
goto LABEL_2;
do
{
if ( !isspace(v3) )
break;
v6 = (unsigned __int8)*++v1;
v3 = v6;
}
while ( (v6 & 0x80) == 0 );
*(_QWORD *)(v2 + 8) = v1;
v3 = (unsigned __int8)*v1;
this = v3 & 0xFFFFFF80;
if ( *v1 )
{
LABEL_2:
v4 = (__int64)v1;
if ( (_DWORD)this )
goto LABEL_8;
LABEL_3:
if ( isspace(v3) )
{
while ( 1 )
{
this = isspace(v3);
if ( !(_DWORD)this )
break;
v7 = *(unsigned __int8 *)++v4;
v3 = v7;
if ( (v7 & 0x80) != 0 )
goto LABEL_6;
}
if ( !v3 )
goto LABEL_9;
LABEL_6:
*v1 = 32;
v5 = v1 + 1;
this = v4++;
*v5 = *(_BYTE *)(v4 - 1);
v1 = v5 + 1;
v3 = *(unsigned __int8 *)(this + 1);
if ( *(_BYTE *)(this + 1) )
goto LABEL_7;
}
else
{
LABEL_8:
while ( 1 )
{
this = v4;
*v1++ = v3;
++v4;
v3 = *(unsigned __int8 *)(this + 1);
if ( !*(_BYTE *)(this + 1) )
break;
LABEL_7:
if ( (v3 & 0xFFFFFF80) == 0 )
goto LABEL_3;
}
}
LABEL_9:
*v1 = 0;
}
return this;
}