int __fastcall sub_4017DC(_DWORD *a1) { unsigned int v2; // r0 int result; // r0 _DWORD *v4; // r1 unsigned int *v5; // r2 unsigned int v6; // r3 unsigned int v7; // r7 unsigned int *v8; // r4 _DWORD *v9; // r5 unsigned int v10; // r8 bool v11; // zf unsigned int v12; // r7 void *v13; // r1 int v14; // [sp+0h] [bp-40h] BYREF int v15; // [sp+4h] [bp-3Ch] int v16; // [sp+8h] [bp-38h] v2 = a1[5]; if ( v2 > 1 ) return 561; v4 = a1 + 2311; v5 = a1 + 3924; v6 = a1[4]; v7 = v2; result = 264; if ( v4 != nullptr ) { v8 = v5; if ( v5 != nullptr ) { v9 = v4; v10 = v6; sub_401188(a1: &v14, a2: 40); if ( sub_402E7C(a1: &v14) != 0 ) { return 0x20000000; } else { if ( (unsigned int)(v15 - 1) < 2 ) goto LABEL_13; v11 = v15 == 7; if ( v15 != 7 ) v11 = v15 == 4; if ( v11 && v16 == 1 ) { LABEL_13: if ( v7 != 0 ) { v12 = 6431; v13 = (void *)dword_4018A4; } else { v12 = 3972; v13 = off_4018A0; } } else if ( v7 != 0 ) { v13 = (void *)dword_4018AC; v12 = 6340; } else { v12 = 3972; v13 = off_4018A8; } if ( v12 <= v10 ) { sub_401058(a1: v9, a2: v13, a3: v12); *v8 = v12; return 0; } else { return 257; } } } } return result; }