//
// sub_180082980 from 0x180082980 to 0x180082aad (301 bytes)
//
// 2 xrefs:
// > sub_180083740 @ 0x180083815
// > ??> @ 0x1801b5424
//
// 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_180082980(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_180101290[i] & 1) == 0; ++v1 )
i = v1[1];
if ( (_BYTE)i == 60 )
break;
if ( (_BYTE)i == 38 )
{
v1 = (unsigned __int8 *)sub_180085450(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_180101290[*(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_180101290[*(v7 - 1)] & 8) == 0 )
break;
--v7;
}
while ( v8 > a1 );
}
*v7 = 0;
return v1 + 1;
}