//
// sub_180085930 from 0x180085930 to 0x180085a5d (301 bytes)
//
// 2 xrefs:
// > sub_180086730 @ 0x180086805
// > ??> @ 0x1801bf6c4
//
// 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_180085930(unsigned __int8 *a1)
{
unsigned __int8 *v1; // rbx
__int64 i; // rax
unsigned __int8 *v4; // rcx
unsigned __int8 *v5; // rdx
unsigned __int8 *v7; // rcx
unsigned __int8 *v8; // rdx
void *Src; // [rsp+20h] [rbp-18h] BYREF
__int64 v10; // [rsp+28h] [rbp-10h]
Src = nullptr;
v1 = a1;
v10 = 0;
while ( 1 )
{
for ( i = *v1; (byte_1801079B0[i] & 1) == 0; ++v1 )
i = v1[1];
if ( (_BYTE)i == 60 )
break;
if ( (_BYTE)i == 38 )
{
v1 = (unsigned __int8 *)sub_180088560(v1, &Src);
}
else
{
if ( !(_BYTE)i )
{
if ( Src )
{
memmove((char *)Src - v10, Src, v1 - (_BYTE *)Src);
v4 = &v1[-v10];
}
else
{
v4 = v1;
}
if ( v4 > a1 )
{
do
{
v5 = v4 - 1;
if ( (byte_1801079B0[*(v4 - 1)] & 8) == 0 )
break;
--v4;
}
while ( v5 > a1 );
}
*v4 = 0;
return v1;
}
++v1;
}
}
if ( Src )
{
memmove((char *)Src - v10, Src, v1 - (_BYTE *)Src);
v7 = &v1[-v10];
}
else
{
v7 = v1;
}
if ( v7 > a1 )
{
do
{
v8 = v7 - 1;
if ( (byte_1801079B0[*(v7 - 1)] & 8) == 0 )
break;
--v7;
}
while ( v8 > a1 );
}
*v7 = 0;
return v1 + 1;
}