//
// sub_1003AE69C from 0x1003ae69c to 0x1003ae7d4 (312 bytes)
//
// 4 xrefs:
// > ??> @ 0x10080e040
// > ??> @ 0x10080e050
// > ??> @ 0x10080e060
// > ??> @ 0x10080e070
//
// 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_1003AE69C(unsigned __int8 *a1, unsigned __int8 a2)
{
unsigned __int8 *v2; // x19
__int64 v3; // x8
char v4; // w9
int v5; // w22
unsigned __int8 *v6; // x20
int v7; // w8
int v8; // t1
char v9; // w9
__int64 v10; // x24
char v11; // w8
__int64 v12; // x25
_BYTE *v13; // x0
_BYTE *v14; // x8
int v15; // t1
void *__src; // [xsp+0h] [xbp-50h] BYREF
__int64 v18; // [xsp+8h] [xbp-48h]
v2 = a1;
__src = nullptr;
v18 = 0;
if ( (byte_100645E7D[*a1] & 8) != 0 )
{
v3 = 0;
do
v4 = byte_100645E7D[a1[++v3]];
while ( (v4 & 8) != 0 );
v2 = &a1[v3];
__src = &a1[v3];
v18 = v3;
}
v5 = a2;
while ( 1 )
{
do
{
v6 = v2;
v8 = *v2++;
v7 = v8;
v9 = byte_100645E7D[v8];
}
while ( (v9 & 0xC) == 0 );
if ( v7 == v5 )
break;
if ( (v9 & 8) != 0 )
{
*v6 = 32;
if ( (byte_100645E7D[v6[1]] & 8) != 0 )
{
v10 = 0;
do
v11 = byte_100645E7D[v6[v10++ + 2]];
while ( (v11 & 8) != 0 );
if ( __src )
{
if ( v2 < __src )
sub_10062F710();
v12 = v18;
memmove((char *)__src - v18, __src, v2 - (_BYTE *)__src);
}
else
{
v12 = v18;
}
v2 = &v6[v10 + 1];
__src = v2;
v18 = v12 + v10;
}
}
else if ( !v7 )
{
return nullptr;
}
}
v13 = (_BYTE *)sub_1003AE928(&__src, v6);
v14 = v13;
do
{
v15 = (unsigned __int8)*--v14;
*v13 = 0;
v13 = v14;
}
while ( (byte_100645E7D[v15] & 8) != 0 );
return v2;
}