//
// sub_1004561A4 from 0x1004561a4 to 0x1004562e0 (316 bytes)
//
// 1 xrefs:
// > ??> @ 0x100966fc8
//
// This function is hookable on this platform (idp: arm, 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:05:23 +0000
//
char *__fastcall sub_1004561A4(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_10076EDBD[v5] & 1) == 0 );
if ( v4 > 37 )
break;
if ( v4 == 13 )
{
*v3 = 10;
if ( v3[1] == 10 )
{
if ( __src )
{
if ( v2 < __src )
sub_1007559F4();
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_100455900((char **)&__src, (unsigned __int64)v3);
do
{
v8 = (_BYTE *)v7;
if ( v7 <= (unsigned __int64)v1 )
break;
--v7;
}
while ( (byte_10076EDBD[(unsigned __int8)*(v8 - 1)] & 8) != 0 );
goto LABEL_24;
}
}
if ( v4 == 38 )
{
a1 = sub_100455950(v3, (__int64)&__src);
goto LABEL_2;
}
}
while ( v4 != 60 );
v9 = sub_100455900((char **)&__src, (unsigned __int64)v3);
do
{
v8 = (_BYTE *)v9;
if ( v9 <= (unsigned __int64)v1 )
break;
--v9;
}
while ( (byte_10076EDBD[(unsigned __int8)*(v8 - 1)] & 8) != 0 );
v3 = v2;
LABEL_24:
*v8 = 0;
return v3;
}