//
// sub_1800856B0 from 0x1800856b0 to 0x180085804 (340 bytes)
//
// 2 xrefs:
// > sub_180086730 @ 0x180086817
// > ??> @ 0x1801bf6ac
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:22:04 +0000
//
unsigned __int8 *__fastcall sub_1800856B0(unsigned __int8 *a1)
{
char *v1; // rdx
__int64 v2; // rdi
unsigned __int8 *v3; // rbx
__int64 i; // rax
__int64 v6; // rax
unsigned __int8 *v7; // rcx
unsigned __int8 *v8; // rdx
unsigned __int8 *result; // rax
unsigned __int8 *v10; // rdx
unsigned __int8 *v11; // [rsp+20h] [rbp-18h] BYREF
__int64 v12; // [rsp+28h] [rbp-10h]
v1 = nullptr;
v11 = nullptr;
v2 = 0;
v12 = 0;
v3 = a1;
while ( 1 )
{
for ( i = *v3; (byte_1801079B0[i] & 1) == 0; ++v3 )
i = v3[1];
if ( (_BYTE)i == 60 )
break;
switch ( (_BYTE)i )
{
case 0xD:
*v3++ = 10;
if ( *v3 == 10 )
{
if ( v1 )
memmove(&v1[-v2], v1, v3 - (unsigned __int8 *)v1);
++v3;
++v2;
v11 = v3;
v12 = v2;
v1 = (char *)v3;
}
break;
case 0x26:
v6 = sub_180088560(v3, &v11);
v1 = (char *)v11;
v3 = (unsigned __int8 *)v6;
v2 = v12;
break;
case 0:
if ( v1 )
{
memmove(&v1[-v2], v1, v3 - (unsigned __int8 *)v1);
v7 = &v3[-v2];
}
else
{
v7 = v3;
}
if ( v7 > a1 )
{
do
{
v8 = v7 - 1;
if ( (byte_1801079B0[*(v7 - 1)] & 8) == 0 )
break;
--v7;
}
while ( v8 > a1 );
}
result = v3;
goto LABEL_28;
default:
++v3;
break;
}
}
if ( v1 )
{
memmove(&v1[-v2], v1, v3 - (unsigned __int8 *)v1);
v7 = &v3[-v2];
}
else
{
v7 = v3;
}
if ( v7 > a1 )
{
do
{
v10 = v7 - 1;
if ( (byte_1801079B0[*(v7 - 1)] & 8) == 0 )
break;
--v7;
}
while ( v10 > a1 );
}
result = v3 + 1;
LABEL_28:
*v7 = 0;
return result;
}