//
// sub_1003AF1CC from 0x1003af1cc to 0x1003af308 (316 bytes)
//
// 1 xrefs:
// > ??> @ 0x10080e0b8
//
// 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
//
char *__fastcall sub_1003AF1CC(char *a1)
{
char *v1; // x19
char *v2; // x21
char *v3; // x20
int v4; // w8
int v5; // t1
__int64 v6; // x24
unsigned __int64 v7; // x0
_BYTE *v8; // x8
unsigned __int64 v9; // x0
void *__src; // [xsp+0h] [xbp-40h] BYREF
__int64 v12; // [xsp+8h] [xbp-38h]
v1 = a1;
__src = nullptr;
v12 = 0;
LABEL_2:
v2 = a1;
do
{
while ( 1 )
{
do
{
v3 = v2;
v5 = (unsigned __int8)*v2++;
v4 = v5;
}
while ( (byte_100645E7D[v5] & 1) == 0 );
if ( v4 > 37 )
break;
if ( v4 == 13 )
{
*v3 = 10;
if ( v3[1] == 10 )
{
if ( __src )
{
if ( v2 < __src )
sub_10062F710();
v6 = v12;
memmove((char *)__src - v12, __src, v2 - (_BYTE *)__src);
}
else
{
v6 = v12;
}
v2 = v3 + 2;
__src = v3 + 2;
v12 = v6 + 1;
}
}
else if ( !v4 )
{
v7 = sub_1003AE928((char **)&__src, (unsigned __int64)v3);
do
{
v8 = (_BYTE *)v7;
if ( v7 <= (unsigned __int64)v1 )
break;
--v7;
}
while ( (byte_100645E7D[(unsigned __int8)*(v8 - 1)] & 8) != 0 );
goto LABEL_24;
}
}
if ( v4 == 38 )
{
a1 = sub_1003AE978(v3, (__int64)&__src);
goto LABEL_2;
}
}
while ( v4 != 60 );
v9 = sub_1003AE928((char **)&__src, (unsigned __int64)v3);
do
{
v8 = (_BYTE *)v9;
if ( v9 <= (unsigned __int64)v1 )
break;
--v9;
}
while ( (byte_100645E7D[(unsigned __int8)*(v8 - 1)] & 8) != 0 );
v3 = v2;
LABEL_24:
*v8 = 0;
return v3;
}