//
// sub_601E04 from 0x601e04 to 0x601ef8 (244 bytes)
//
// 3 xrefs:
// > sub_602C7C @ 0x602cec
// > sub_602E4C @ 0x60302a
// > sub_602E4C @ 0x6030c8
//
// 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
//
void *__fastcall sub_601E04(void *result, unsigned __int8 *a2, unsigned __int8 a3)
{
int v3; // r5
unsigned __int8 *v6; // r2
unsigned __int8 *v7; // r6
unsigned int v8; // r1
int *v9; // r4
int v10; // r3
_BYTE *v11; // r2
v3 = (int)result;
while ( *a2 )
{
v6 = a2;
do
v7 = v6++;
while ( ((unsigned __int8)a7[*v7 + 256] & a3) == 0 );
result = sub_601D70(v3, a2, v7 - a2);
v8 = *v7;
if ( v8 == 38 )
{
result = (void *)sub_6019D6(v3, 38, 97, 109, 112, 59);
goto LABEL_18;
}
if ( v8 > 0x26 )
{
a2 = v7 + 1;
if ( v8 == 60 )
{
result = (void *)sub_601A16(v3, 38, 108, 116, 59);
}
else
{
if ( v8 != 62 )
goto LABEL_19;
result = (void *)sub_601A16(v3, 38, 103, 116, 59);
}
}
else if ( *v7 )
{
if ( v8 == 34 )
{
v9 = (int *)(v3 + 10244);
if ( (unsigned int)(*(_DWORD *)(v3 + 10244) + 6) > 0x800 )
result = (void *)sub_601964(v3);
v10 = *v9;
*(_BYTE *)(v3 + v10) = 38;
v11 = (_BYTE *)(v3 + v10);
v11[1] = 113;
v11[2] = 117;
v11[3] = 111;
v11[4] = 116;
v11[5] = 59;
*v9 = v10 + 6;
LABEL_18:
a2 = v7 + 1;
}
else
{
LABEL_19:
a2 = v7 + 1;
result = (void *)sub_6019D6(v3, 38, 35, *v7 / 0xAu + 48, *v7 % 0xAu + 48, 59);
}
}
else
{
a2 = v7;
}
}
return result;
}