aboutsummaryrefslogtreecommitdiffstats
path: root/fw/pseudo/merit.merit_cmd05.after.c
blob: bb9581995e3538eb2651936bb2a1804610a991c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
int __fastcall merit_cmd05(void *ctx, struct ta_params *params)
{
  _DWORD *v2; // r8
  void *v4; // r4
  int *v5; // r7
  int v6; // r6
  unsigned __int8 *v7; // r9
  int result; // r0
  int v9; // r7
  int *v10; // r11
  int v11; // r0
  int v12; // r10
  bool v13; // zf
  int v14; // r3
  int v15; // r6
  int v16; // r7
  _OWORD *v17; // r5
  int v18; // r0
  __int128 v19; // [sp+8h] [bp-14h] BYREF
  int v20; // [sp+18h] [bp-4h]

  v2 = (_DWORD *)off_401BD8;
  v20 = *(_DWORD *)off_401BD8;
  v4 = *((void **)ctx + 4);
  if ( (char *)v4 - 1 <= (char *)0x3F
    && (v5 = (int *)off_401CE0, v6 = 257 * (_DWORD)v4, *((_BYTE *)off_401CE0 + 257 * (_DWORD)v4) != 0) )
  {
    if ( merit_cmd05__h1(ctx: v4, params: (struct ta_params *)((char *)ctx + 20)) == 0 )
      goto LABEL_10;
    v7 = (unsigned __int8 *)v5 + v6 + 33;
    if ( *((_DWORD *)ctx + 17) == (*v7
                                 | (*((unsigned __int8 *)v5 + v6 + 34) << 8)
                                 | ((*((unsigned __int8 *)v5 + v6 + 35) | (*((unsigned __int8 *)v5 + v6 + 36) << 8)) << 16)) )
    {
      if ( merit_lib_52b900d8_88(a1: off_401BDC, a2: (int)ctx + 52, a3: 16) == 0 )
      {
        v9 = *((_DWORD *)ctx + 19);
        v10 = (int *)off_401BE0;
        v11 = 0;
        while ( 1 )
        {
          v12 = v11 + 16;
          if ( v11 == 128 )
            break;
          v13 = merit_lib_52b900d8_88(a1: (int)v10 + v11, a2: (int)ctx + 80, a3: v9) == 0;
          v11 = v12;
          if ( v13 )
          {
            v14 = *((_DWORD *)ctx + 10);
            v15 = *((_DWORD *)ctx + 11);
            v16 = *((_DWORD *)ctx + 12);
            *((_DWORD *)ctx + 1038) = *((_DWORD *)ctx + 9);
            *((_DWORD *)ctx + 1039) = v14;
            *((_DWORD *)ctx + 1040) = v15;
            *((_DWORD *)ctx + 1041) = v16;
            *((_DWORD *)ctx + 1042) = dword_401BE4;
            *((_DWORD *)ctx + 1037) = 20;
            merit_lib_zero_fill_words(dst: (char *)ctx + 4172, len: 0xFD8u);
            v17 = (char *)ctx + 4132;
            if ( ((int (__fastcall *)(_OWORD *, int, __int128 *, void *))loc_4012FC)(
                   a1: v17,
                   a2: 4096,
                   a3: &v19,
                   a4: v4) != 0 )
            {
              result = 266;
            }
            else
            {
              *v17 = v19;
              v18 = ((*v7)++ | (v7[1] << 8) | ((v7[2] | (v7[3] << 8)) << 16)) + 1;
              v7[2] = BYTE2(v18);
              v7[3] = HIBYTE(v18);
              v7[1] = BYTE1(v18);
              result = 0;
            }
            goto LABEL_8;
          }
        }
      }
      result = 262;
    }
    else
    {
      result = 260;
    }
  }
  else
  {
    result = 259;
  }
LABEL_8:
  while ( *v2 != v20 )
  {
    ((void (__fastcall *)(int, int))loc_40202C)(a1: result, a2: *v2 - v20);
LABEL_10:
    result = 261;
  }
  return result;
}