aboutsummaryrefslogtreecommitdiff
path: root/tools/test-js-optimizer-regs-output.js
blob: a5e97f46298c5c0678add52a0361ad71f96df683 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
function test() {
  var r1, r2;
  r1 = 0;
  f(r1);
  r1 += 1;
  r2 = r1 + 2;
  g(r1, r2);
  f(r1);
  r1 = cheez();
  r2 = r1 + 2;
  g(r2, r2);
  r2 = 200;
  r2 = 203;
  r2 = 205;
  r1 = 208;
  c(r2);
  while (f()) {
    r2 = 5;
    r1 = 12;
    gg(r2, r1 * 2);
    r1 = 100;
    gg(r1, 20);
  }
  r1 = f(), r2 = 100, r2 = 1e3, r2 = 1e5;
  f(r1());
}
function primes() {
  var r1, r2, r3, r4, r5, r6, r7;
  r1 = 2;
  r2 = 0;
  $_$2 : while (1) {
    r3 = r1 | 0;
    r4 = _sqrtf(r3);
    r3 = 2;
    $_$4 : while (1) {
      r5 = r3 | 0;
      r6 = r5 < r4;
      if (!r6) {
        r7 = 1;
        break $_$4;
      }
      r6 = (r1 | 0) % (r3 | 0);
      r5 = (r6 | 0) == 0;
      if (r5) {
        r7 = 0;
        break $_$4;
      }
      r5 = r3 + 1 | 0;
      r3 = r5;
    }
    r3 = r7 + r2 | 0;
    r4 = r1 + 1 | 0;
    r5 = (r3 | 0) < 1e5;
    if (r5) {
      r1 = r4;
      r2 = r3;
    } else {
      break $_$2;
    }
  }
  r2 = _printf(STRING_TABLE.__str | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r1, tempInt));
  return 1;
  return null;
}
function atomic() {
  var r1, r2, r3, r4;
  r1 = STACKTOP;
  STACKTOP += 4;
  r2 = r1 >> 2;
  HEAP32[r2] = 10;
  r3 = (tempValue = HEAP32[r2], HEAP32[r2] == 10 && (HEAP32[r2] = 7), tempValue);
  r4 = (r3 | 0) == 10 & 1;
  r3 = HEAP32[r2];
  r2 = _printf(STRING_TABLE.__str | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = r3, HEAP32[tempInt + 4 >> 2] = r4, tempInt));
  STACKTOP = r1;
  return 0;
  return null;
}
function fcntl_open() {
  var r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17;
  r1 = STACKTOP;
  STACKTOP += 84;
  r2 = r1;
  r3 = r1 + 72;
  r4 = r3 | 0;
  for (r5 = STRING_TABLE.__ZZ4mainE16nonexistent_name | 0, r6 = r4, r7 = r5 + 12; r5 < r7; r5++, r6++) {
    HEAP8[r6] = HEAP8[r5];
  }
  r5 = (r2 + 8 | 0) >> 2;
  r8 = r2 >> 2;
  r9 = r3 + 9 | 0;
  r10 = r3 + 10 | 0;
  r3 = 0;
  while (1) {
    r11 = HEAP32[__ZZ4mainE5modes + (r3 << 2) >> 2];
    r12 = r11 | 512;
    r13 = r3 + 97 & 255;
    r14 = 0;
    while (1) {
      r15 = (r14 & 1 | 0) == 0 ? r11 : r12;
      r16 = (r14 & 2 | 0) == 0 ? r15 : r15 | 2048;
      r15 = (r14 & 4 | 0) == 0 ? r16 : r16 | 1024;
      r16 = (r14 & 8 | 0) == 0 ? r15 : r15 | 8;
      r15 = _printf(STRING_TABLE.__str | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = r3, HEAP32[tempInt + 4 >> 2] = r14, tempInt));
      r15 = _open(STRING_TABLE.__str2 | 0, r16, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = 511, tempInt));
      r17 = (r15 | 0) != -1 & 1;
      r15 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r17, tempInt));
      r17 = ___errno();
      r15 = HEAP32[r17 >> 2];
      r17 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r15, tempInt));
      r15 = _stat(STRING_TABLE.__str2 | 0, r2);
      r15 = HEAP32[r5] & -512;
      r17 = _printf(STRING_TABLE.__str4 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r15, tempInt));
      for (r6 = r8, r7 = r6 + 18; r6 < r7; r6++) {
        HEAP32[r6] = 0;
      }
      r15 = _putchar(10);
      r15 = ___errno();
      HEAP32[r15 >> 2] = 0;
      r15 = _printf(STRING_TABLE.__str6 | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = r3, HEAP32[tempInt + 4 >> 2] = r14, tempInt));
      r15 = _open(STRING_TABLE.__str7 | 0, r16, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = 511, tempInt));
      r17 = (r15 | 0) != -1 & 1;
      r15 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r17, tempInt));
      r17 = ___errno();
      r15 = HEAP32[r17 >> 2];
      r17 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r15, tempInt));
      r15 = _stat(STRING_TABLE.__str7 | 0, r2);
      r15 = HEAP32[r5] & -512;
      r17 = _printf(STRING_TABLE.__str4 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r15, tempInt));
      for (r6 = r8, r7 = r6 + 18; r6 < r7; r6++) {
        HEAP32[r6] = 0;
      }
      r15 = _putchar(10);
      r15 = ___errno();
      HEAP32[r15 >> 2] = 0;
      HEAP8[r9] = r13;
      HEAP8[r10] = r14 + 97 & 255;
      r15 = _printf(STRING_TABLE.__str8 | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = r3, HEAP32[tempInt + 4 >> 2] = r14, tempInt));
      r15 = _open(r4, r16, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = 511, tempInt));
      r17 = (r15 | 0) != -1 & 1;
      r15 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r17, tempInt));
      r17 = ___errno();
      r15 = HEAP32[r17 >> 2];
      r17 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r15, tempInt));
      r15 = _stat(r4, r2);
      r15 = HEAP32[r5] & -512;
      r17 = _printf(STRING_TABLE.__str4 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r15, tempInt));
      for (r6 = r8, r7 = r6 + 18; r6 < r7; r6++) {
        HEAP32[r6] = 0;
      }
      r16 = _putchar(10);
      r16 = ___errno();
      HEAP32[r16 >> 2] = 0;
      r16 = r14 + 1 | 0;
      if ((r16 | 0) == 16) {
        break;
      }
      r14 = r16;
    }
    r14 = r3 + 1 | 0;
    if ((r14 | 0) == 3) {
      break;
    }
    r3 = r14;
  }
  r3 = _puts(STRING_TABLE._str | 0);
  r3 = _creat(STRING_TABLE.__str10 | 0, 511);
  r6 = (r3 | 0) != -1 & 1;
  r3 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r6, tempInt));
  r6 = ___errno();
  r3 = HEAP32[r6 >> 2];
  r6 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r3, tempInt));
  STACKTOP = r1;
  return 0;
  return null;
}
function ex() {
  var r1, r2;
  r1 = STACKTOP;
  STACKTOP += 4;
  r2 = r1;
  r1 = _puts(STRING_TABLE._str17 | 0);
  r1 = r2 | 0;
  r2 = 0;
  while (1) {
    r1 = _printf(STRING_TABLE.__str15 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = r2, tempInt));
    ((function() {
      try {
        __THREW__ = false;
        return __Z5magici(r2);
      } catch (e) {
        if (typeof e != "number") throw e;
        if (ABORT) throw e;
        __THREW__ = true;
        return null;
      }
    }))();
  }
}
function switchey(x) {
  var r1, r2, r3, r4, r5, r6, r7, r8;
  r1 = 5;
  while (1) {
    switch (x = f(x, r1)) {
     case 1:
      g(r1);
      r2 = x + 1;
      x--;
      break;
     case 2:
      g(r1 * 2);
      r3 = x + 22;
      r4 = r3 + 5;
      x -= 20;
      break;
     default:
      r5 = x + 22;
      r6 = r3 + 5;
      ch(r5, r6 * r3);
      throw 99;
    }
  }
  r7 = x + 1;
  p(r1, r7);
  r8 = x + 2;
  pp(r8);
}
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["test", "primes", "atomic", "fcntl_open", "ex", "switchey"]