//
// sub_1800825D0 from 0x1800825d0 to 0x1800826fb (299 bytes)
//
// 2 xrefs:
// > sub_180083740 @ 0x180083803
// > ??> @ 0x1801b5400
//
// 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_1800825D0(unsigned __int8 *a1)
{
char *v1; // rdx
__int64 v2; // rdi
__int64 i; // rax
__int64 v5; // rax
unsigned __int8 *v7; // rax
unsigned __int8 *v8; // [rsp+20h] [rbp-18h] BYREF
__int64 v9; // [rsp+28h] [rbp-10h]
v1 = nullptr;
v8 = nullptr;
v2 = 0;
v9 = 0;
while ( 1 )
{
for ( i = *a1; (byte_180101290[i] & 1) == 0; ++a1 )
i = a1[1];
if ( (_BYTE)i == 60 )
break;
switch ( (_BYTE)i )
{
case 0xD:
*a1++ = 10;
if ( *a1 == 10 )
{
if ( v1 )
memmove(&v1[-v2], v1, a1 - (unsigned __int8 *)v1);
++a1;
++v2;
v8 = a1;
v9 = v2;
v1 = (char *)a1;
}
break;
case 0x26:
v5 = sub_180085450(a1, &v8);
v1 = (char *)v8;
a1 = (unsigned __int8 *)v5;
v2 = v9;
break;
case 0:
if ( v1 )
{
memmove(&v1[-v2], v1, a1 - (unsigned __int8 *)v1);
a1[-v2] = 0;
}
else
{
*a1 = 0;
}
return a1;
default:
++a1;
break;
}
}
if ( v1 )
{
memmove(&v1[-v2], v1, a1 - (unsigned __int8 *)v1);
v7 = &a1[-v2];
}
else
{
v7 = a1;
}
*v7 = 0;
return a1 + 1;
}