//
// sub_601044 from 0x601044 to 0x6010e8 (164 bytes)
//
// 1 xrefs:
// > sub_6049F4 @ 0x6054a2
//
// 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_601044(unsigned __int8 *a1, int a2, int a3, int a4)
{
unsigned __int8 *v5; // r4
int v6; // r0
unsigned int v7; // r0
_BYTE *v8; // r3
int v10; // t1
unsigned int v11; // r0
_BYTE *v12; // r3
int v13; // t1
_DWORD v14[3]; // [sp+4h] [bp-Ch] BYREF
v14[2] = a4;
v5 = a1;
v14[0] = 0;
v14[1] = 0;
while ( 1 )
{
while ( 1 )
{
v6 = *v5;
if ( (a7[v6] & 1) == 0 )
goto LABEL_3;
if ( v6 == 60 )
{
v7 = sub_6006C8((int)v14, (int)v5);
do
{
v8 = (_BYTE *)v7;
if ( v7 <= (unsigned int)a1 )
break;
v10 = *(unsigned __int8 *)--v7;
}
while ( (a7[v10] & 8) != 0 );
*v8 = 0;
return v5 + 1;
}
if ( v6 != 38 )
break;
v5 = sub_600D80(v5, v14);
}
if ( !*v5 )
break;
LABEL_3:
++v5;
}
v11 = sub_6006C8((int)v14, (int)v5);
do
{
v12 = (_BYTE *)v11;
if ( v11 <= (unsigned int)a1 )
break;
v13 = *(unsigned __int8 *)--v11;
}
while ( (a7[v13] & 8) != 0 );
*v12 = 0;
return v5;
}