//
// sub_180082860 from 0x180082860 to 0x180082973 (275 bytes)
//
// 2 xrefs:
// > sub_180083740 @ 0x18008381e
// > ??> @ 0x1801b5418
//
// 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 __int8 *__fastcall sub_180082860(unsigned __int8 *a1)
{
unsigned __int8 *v1; // rdx
__int64 v2; // rdi
unsigned __int8 *v3; // rbx
__int64 i; // rax
unsigned __int8 *v6; // rcx
unsigned __int8 *v7; // rdx
unsigned __int8 *result; // rax
unsigned __int8 *v9; // rdx
v1 = nullptr;
v2 = 0;
v3 = a1;
while ( 1 )
{
for ( i = *v3; (byte_180101290[i] & 1) == 0; ++v3 )
i = v3[1];
if ( (_BYTE)i == 60 )
break;
if ( (_BYTE)i == 13 )
{
*v3++ = 10;
if ( *v3 == 10 )
{
if ( v1 )
memmove(&v1[-v2], v1, v3 - v1);
v1 = ++v3;
++v2;
}
}
else
{
if ( !(_BYTE)i )
{
if ( v1 )
{
memmove(&v1[-v2], v1, v3 - v1);
v6 = &v3[-v2];
}
else
{
v6 = v3;
}
if ( v6 > a1 )
{
do
{
v7 = v6 - 1;
if ( (byte_180101290[*(v6 - 1)] & 8) == 0 )
break;
--v6;
}
while ( v7 > a1 );
}
result = v3;
goto LABEL_26;
}
++v3;
}
}
if ( v1 )
{
memmove(&v1[-v2], v1, v3 - v1);
v6 = &v3[-v2];
}
else
{
v6 = v3;
}
if ( v6 > a1 )
{
do
{
v9 = v6 - 1;
if ( (byte_180101290[*(v6 - 1)] & 8) == 0 )
break;
--v6;
}
while ( v9 > a1 );
}
result = v3 + 1;
LABEL_26:
*v6 = 0;
return result;
}