//
// sub_74EAA4 from 0x74eaa4 to 0x74ebe8 (324 bytes)
//
// 7 xrefs:
// > sub_74EBE8 @ 0x74ebfc
// > sub_74EC08 @ 0x74ed2e
// > sub_74EEBC @ 0x74efe2
// > sub_74F1DC @ 0x74f2a2
// > sub_74F5D4 @ 0x74f67c
// > sub_74F8B8 @ 0x74f988
// > sub_74FAF4 @ 0x74fba2
//
// 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_74EAA4(int a1, int a2, char *a3, unsigned __int8 *a4, int a5, int a6)
{
int v9; // r2
size_t v10; // r7
int v11; // r4
_BYTE *v13; // r0
_BYTE *v14; // r4
int v15; // r3
_BOOL4 v16; // r2
int v17; // r2
int v18; // r0
int v19; // r0
int v20; // r0
int v21; // r0
_BOOL4 v22; // r0
int v23; // r0
v9 = *(_DWORD *)(a1 + 12) & 0xB0;
v10 = a5 - a6;
if ( v9 != 32 )
{
if ( v9 != 16 )
{
LABEL_3:
v11 = 0;
LABEL_4:
memset(a3, a2, v10);
return sub_8E41D0(&a3[v10], &a4[v11], a6 - v11);
}
v13 = sub_74C87C(a1 + 108);
v14 = v13;
if ( v13[28] )
{
v15 = *a4;
if ( v15 == (unsigned __int8)v13[74] )
goto LABEL_16;
}
else
{
v19 = sub_74B40C((int)v13, 45);
v15 = *a4;
if ( v15 == v19 )
goto LABEL_16;
if ( !v14[28] )
{
sub_77ABA8(v14);
v20 = (*(int (__fastcall **)(_BYTE *, int))(*(_DWORD *)v14 + 24))(v14, 43);
v15 = *a4;
if ( v15 != v20 )
{
if ( !v14[28] )
{
sub_77ABA8(v14);
v21 = (*(int (__fastcall **)(_BYTE *, int))(*(_DWORD *)v14 + 24))(v14, 48);
LOBYTE(v15) = *a4;
v22 = *a4 == v21;
if ( a6 <= 1 )
v22 = 0;
if ( !v22 )
goto LABEL_3;
if ( !v14[28] )
{
v23 = sub_74B40C((int)v14, 120);
v17 = a4[1];
if ( v17 == v23 )
{
LABEL_14:
LOBYTE(v15) = *a4;
goto LABEL_15;
}
if ( !v14[28] )
{
v18 = sub_74B40C((int)v14, 88);
v17 = a4[1];
LABEL_13:
if ( v17 != v18 )
goto LABEL_3;
goto LABEL_14;
}
LABEL_12:
v18 = (unsigned __int8)v14[117];
goto LABEL_13;
}
LABEL_11:
v17 = a4[1];
if ( (unsigned __int8)v14[149] == v17 )
{
LABEL_15:
*a3 = v15;
v11 = 2;
a3[1] = a4[1];
a3 += 2;
goto LABEL_4;
}
goto LABEL_12;
}
LABEL_8:
v16 = (unsigned __int8)v14[77] == v15;
if ( a6 <= 1 )
v16 = 0;
if ( !v16 )
goto LABEL_3;
goto LABEL_11;
}
LABEL_16:
*a3++ = v15;
v11 = 1;
goto LABEL_4;
}
}
if ( (unsigned __int8)v14[72] != v15 )
goto LABEL_8;
goto LABEL_16;
}
memcpy(a3, a4, a6);
return sub_8E41C0(&a3[a6], a2, a5 - a6);
}