//
// sub_180082DF0 from 0x180082df0 to 0x180082ee9 (249 bytes)
//
// 2 xrefs:
// > sub_180083740 @ 0x180083794
// > ??> @ 0x1801b5454
//
// 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_180082DF0(unsigned __int8 *a1, char a2)
{
char *v3; // rdx
__int64 v5; // rdi
__int64 i; // rax
__int64 v7; // rax
unsigned __int8 *v9; // rax
unsigned __int8 *v10; // [rsp+20h] [rbp-18h] BYREF
__int64 v11; // [rsp+28h] [rbp-10h]
v3 = nullptr;
v10 = nullptr;
v5 = 0;
v11 = 0;
while ( 1 )
{
for ( i = *a1; (byte_180101290[i] & 2) == 0; ++a1 )
i = a1[1];
if ( (_BYTE)i == a2 )
break;
switch ( (_BYTE)i )
{
case 0xD:
*a1++ = 10;
if ( *a1 == 10 )
{
if ( v3 )
memmove(&v3[-v5], v3, a1 - (unsigned __int8 *)v3);
++a1;
++v5;
v10 = a1;
v11 = v5;
v3 = (char *)a1;
}
break;
case 0x26:
v7 = sub_180085450(a1, &v10);
v3 = (char *)v10;
a1 = (unsigned __int8 *)v7;
v5 = v11;
break;
case 0:
return nullptr;
default:
++a1;
break;
}
}
if ( v3 )
{
memmove(&v3[-v5], v3, a1 - (unsigned __int8 *)v3);
v9 = &a1[-v5];
}
else
{
v9 = a1;
}
*v9 = 0;
return a1 + 1;
}