//
// sub_100649FF0 from 0x100649ff0 to 0x10064a0fa (266 bytes)
//
// 1 xrefs:
// > ??> @ 0x100985f78
//
// 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
//
unsigned __int64 __fastcall sub_100649FF0(_BYTE *a1)
{
__int64 v1; // r14
char *v2; // rsi
__int64 v3; // r15
_BYTE *v4; // r12
__int64 v5; // r13
__int64 v6; // rax
unsigned __int64 v7; // rbx
char *v8; // rax
v1 = -1;
v2 = nullptr;
v3 = 0;
while ( 1 )
{
while ( 1 )
{
v4 = a1;
v5 = 0;
do
v6 = (unsigned __int8)a1[v5++];
while ( (a7_0[v6] & 1) == 0 );
a1 += v5;
if ( (_DWORD)v6 != 13 )
break;
*(a1 - 1) = 10;
if ( *a1 == 10 )
{
if ( v2 )
{
if ( &v4[v5] < v2 )
sub_1007CE0D0(a1);
memmove(&v2[-v3], v2, v5 + v4 - v2);
}
a1 = &v4[v5 + 1];
++v3;
--v1;
v2 = a1;
}
}
if ( !(_DWORD)v6 )
break;
if ( (_DWORD)v6 == 60 )
{
v7 = (unsigned __int64)&v4[v5];
v8 = &v4[v5 - 1];
if ( !v2 )
goto LABEL_20;
if ( v2 > v8 )
sub_1007CE100(a1);
goto LABEL_18;
}
}
v7 = (unsigned __int64)&v4[v5 - 1];
if ( v2 )
{
if ( (unsigned __int64)v2 > v7 )
sub_1007CE0A0(a1);
LABEL_18:
memmove(&v2[-v3], v2, v4 - v2 + v5 - 1);
v8 = &v4[v1 + v5];
goto LABEL_20;
}
v8 = &v4[v5 - 1];
LABEL_20:
*v8 = 0;
return v7;
}