//
// sub_1003AE4D0 from 0x1003ae4d0 to 0x1003ae5a8 (216 bytes)
//
// 2 xrefs:
// > ??> @ 0x10080e020
// > ??> @ 0x10080e030
//
// 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
//
_BYTE *__fastcall sub_1003AE4D0(_BYTE *a1, unsigned __int8 a2)
{
int v3; // w21
_BYTE *v4; // x20
int v5; // w8
int v6; // t1
char v7; // w9
__int64 v8; // x24
void *__src; // [xsp+0h] [xbp-40h] BYREF
__int64 v11; // [xsp+8h] [xbp-38h]
v3 = a2;
__src = nullptr;
v11 = 0;
while ( 1 )
{
do
{
v4 = a1;
v6 = (unsigned __int8)*a1++;
v5 = v6;
v7 = byte_100645E7D[v6];
}
while ( (v7 & 4) == 0 );
if ( v5 == v3 )
break;
if ( (v7 & 8) != 0 )
{
*v4 = 32;
if ( v5 == 13 && *a1 == 10 )
{
if ( __src )
{
if ( a1 < __src )
sub_10062F710();
v8 = v11;
memmove((char *)__src - v11, __src, a1 - (_BYTE *)__src);
}
else
{
v8 = v11;
}
a1 = v4 + 2;
__src = v4 + 2;
v11 = v8 + 1;
}
}
else if ( !v5 )
{
return nullptr;
}
}
*(_BYTE *)sub_1003AE928(&__src, v4) = 0;
return a1;
}