1 extern "C" void abort ();
3 struct S { S (); S (long int, long int); ~S (); static int cnt1, cnt2, cnt3; long int s, t; };
15 S::S (long int x, long int y) : s (x), t (y)
17 #pragma omp atomic update
25 if (t < 3 || t > 9 || (t & 1) == 0)
41 if (o->t != 5 || i->t != 9)
46 #pragma omp declare reduction (+: S : omp_out.s += omp_in.s) initializer (omp_priv (0, 3))
47 #pragma omp declare reduction (*: S : baz (&omp_out, &omp_in)) initializer (bar (&omp_priv, &omp_orig))
49 S as[2] = { { 0, 7 }, { 0, 7 } };
51 S bs[7] = { { 9, 5 }, { 11, 5 }, { 1, 5 }, { 1, 5 }, { 1, 5 }, { 13, 5 }, { 15, 5 } };
53 S es[3] = { { 5, 7 }, { 0, 7 }, { 5, 7 } };
55 S fs[5] = { { 6, 7 }, { 7, 7 }, { 0, 7 }, { 0, 7 }, { 9, 7 } };
57 S gs[4] = { { 1, 7 }, { 0, 7 }, { 0, 7 }, { 2, 7 } };
59 S hs[3] = { { 0, 7 }, { 1, 7 }, { 4, 7 } };
61 S ks[4][2] = { { { 5, 7 }, { 6, 7 } }, { { 0, 7 }, { 0, 7 } }, { { 0, 7 }, { 0, 7 } }, { { 7, 7 }, { 8, 7 } } };
68 template <typename S, typename T>
70 foo (T &n, S *&c, S *&d, S (&m)[3], S *&r, S (&o)[4], S *&p, S (&q)[4][2])
73 for (i = 0; i < 2; i++)
74 #pragma omp task in_reduction (+: a, c[:2]) in_reduction (*: b[2 * n:3 * n], d[0:2]) \
75 in_reduction (+: o[n:n*2], m[1], k[1:2][:], p[0], f[2:2]) \
76 in_reduction (+: q[1:2][:], g[n:n*2], e[1], h[0], r[2:2]) \
77 in_reduction (*: s[1:2], t[2:2][:])
104 if ((e[1].t != 7 && e[1].t != 3) || (h[0].t != 7 && h[0].t != 3)
105 || (m[1].t != 7 && m[1].t != 3) || (p[0].t != 7 && p[0].t != 3))
107 for (T z = 0; z < 2; z++)
108 if ((a[z].t != 7 && a[z].t != 3) || (c[z].t != 7 && c[z].t != 3)
109 || (d[z].t != 5 && d[z].t != 9) || (f[z + 2].t != 7 && f[z + 2].t != 3)
110 || (g[z + 1].t != 7 && g[z + 1].t != 3) || (r[z + 2].t != 7 && r[z + 2].t != 3)
111 || (s[z + 1].t != 5 && s[z + 1].t != 9) || (o[z + 1].t != 7 && o[z + 1].t != 3)
112 || (k[z + 1][0].t != 7 && k[z + 1][0].t != 3) || (k[z + 1][1].t != 7 && k[z + 1][1].t != 3)
113 || (q[z + 1][0].t != 7 && q[z + 1][0].t != 3) || (q[z + 1][1].t != 7 && q[z + 1][1].t != 3)
114 || (t[z + 2][0].t != 5 && t[z + 2][0].t != 9) || (t[z + 2][1].t != 5 && t[z + 2][1].t != 9))
116 for (T z = 0; z < 3; z++)
117 if (b[z + 2].t != 5 && b[z + 2].t != 9)
122 template <typename S, typename T>
126 S cs[2] = { { 0, 7 }, { 0, 7 } };
128 S ps[3] = { { 0, 7 }, { 1, 7 }, { 4, 7 } };
130 S qs[4][2] = { { { 5, 7 }, { 6, 7 } }, { { 0, 7 }, { 0, 7 } }, { { 0, 7 }, { 0, 7 } }, { { 7, 7 }, { 8, 7 } } };
132 S sb[4] = { { 5, 5 }, { 1, 5 }, { 1, 5 }, { 6, 5 } };
133 S tb[5][2] = { { { 9, 5 }, { 10, 5 } }, { { 11, 5 }, { 12, 5 } }, { { 1, 5 }, { 1, 5 } }, { { 1, 5 }, { 1, 5 } }, { { 13, 5 }, { 14, 5 } } };
134 S ms[3] = { { 5, 7 }, { 0, 7 }, { 5, 7 } };
135 S os[4] = { { 1, 7 }, { 0, 7 }, { 0, 7 }, { 2, 7 } };
138 #pragma omp parallel if (0)
140 S ds[] = { { 1, 5 }, { 1, 5 } };
143 S rs[5] = { { 6, 7 }, { 7, 7 }, { 0, 7 }, { 0, 7 }, { 9, 7 } };
146 #pragma omp parallel reduction (task, +: a, c) reduction (task, *: b[2 * n:3 * n], d) \
147 reduction (task, +: e[1], f[2:2], g[n:n*2], h[0], k[1:2][0:2]) \
148 reduction (task, +: o[n:n*2], m[1], q[1:2][:], p[0], r[2:2]) \
149 reduction (task, *: t[2:2][:], s[1:n + 1])
152 for (T i = 0; i < 4; i++)
153 #pragma omp task in_reduction (+: a, c) in_reduction (*: b[2 * n:3 * n], d) \
154 in_reduction (+: o[n:n*2], q[1:2][:], p[0], m[1], r[2:2]) \
155 in_reduction (+: g[n:n * 2], e[1], k[1:2][:], h[0], f[2:2]) \
156 in_reduction (*: s[1:2], t[2:2][:])
173 if ((e[1].t != 7 && e[1].t != 3) || (h[0].t != 7 && h[0].t != 3)
174 || (m[1].t != 7 && m[1].t != 3) || (p[0].t != 7 && p[0].t != 3))
176 for (T z = 0; z < 2; z++)
177 if ((a[z].t != 7 && a[z].t != 3) || (c[z].t != 7 && c[z].t != 3)
178 || (d[z].t != 5 && d[z].t != 9) || (f[z + 2].t != 7 && f[z + 2].t != 3)
179 || (g[z + 1].t != 7 && g[z + 1].t != 3) || (r[z + 2].t != 7 && r[z + 2].t != 3)
180 || (s[z + 1].t != 5 && s[z + 1].t != 9) || (o[z + 1].t != 7 && o[z + 1].t != 3)
181 || (k[z + 1][0].t != 7 && k[z + 1][0].t != 3) || (k[z + 1][1].t != 7 && k[z + 1][1].t != 3)
182 || (q[z + 1][0].t != 7 && q[z + 1][0].t != 3) || (q[z + 1][1].t != 7 && q[z + 1][1].t != 3)
183 || (t[z + 2][0].t != 5 && t[z + 2][0].t != 9) || (t[z + 2][1].t != 5 && t[z + 2][1].t != 9))
185 for (T z = 0; z < 3; z++)
186 if (b[z + 2].t != 5 && b[z + 2].t != 9)
188 for (j = 0; j < 2; j++)
189 #pragma omp task in_reduction (+: a, c[:2]) \
190 in_reduction (*: b[2 * n:3 * n], d[n - 1:n + 1]) \
191 in_reduction (+: e[1], f[2:2], g[n:n*2], h[0], k[1:2][:2]) \
192 in_reduction (+: m[1], r[2:2], o[n:n*2], p[0], q[1:2][:2]) \
193 in_reduction (*: s[n:2], t[2:2][:])
214 if ((e[1].t != 7 && e[1].t != 3) || (h[0].t != 7 && h[0].t != 3)
215 || (m[1].t != 7 && m[1].t != 3) || (p[0].t != 7 && p[0].t != 3))
217 for (T z = 0; z < 2; z++)
218 if ((a[z].t != 7 && a[z].t != 3) || (c[z].t != 7 && c[z].t != 3)
219 || (d[z].t != 5 && d[z].t != 9) || (f[z + 2].t != 7 && f[z + 2].t != 3)
220 || (g[z + 1].t != 7 && g[z + 1].t != 3) || (r[z + 2].t != 7 && r[z + 2].t != 3)
221 || (s[z + 1].t != 5 && s[z + 1].t != 9) || (o[z + 1].t != 7 && o[z + 1].t != 3)
222 || (k[z + 1][0].t != 7 && k[z + 1][0].t != 3) || (k[z + 1][1].t != 7 && k[z + 1][1].t != 3)
223 || (q[z + 1][0].t != 7 && q[z + 1][0].t != 3) || (q[z + 1][1].t != 7 && q[z + 1][1].t != 3)
224 || (t[z + 2][0].t != 5 && t[z + 2][0].t != 9) || (t[z + 2][1].t != 5 && t[z + 2][1].t != 9))
226 for (T z = 0; z < 3; z++)
227 if (b[z + 2].t != 5 && b[z + 2].t != 9)
229 foo (n, cp, dp, m, rp, o, pp, q);
256 if (d[0].s != 1LL << (8 + 4)
257 || d[1].s != 1LL << 16
259 || m[1].s != 19 * 16 + 6 * 8 + 16 * 4
263 || r[2].s != 21 * 16 + 7 * 8 + 8 * 4
264 || r[3].s != 23 * 16 + 18 * 8 + 8 * 4
267 || o[1].s != 25 * 16 + 29 * 8 + 9 * 4
268 || o[2].s != 27 * 16 + 18 * 8 + 10 * 4
271 if (e[1].t != 7 || h[0].t != 7 || m[1].t != 7 || p[0].t != 7)
273 for (T z = 0; z < 2; z++)
274 if (a[z].t != 7 || c[z].t != 7 || d[z].t != 5 || f[z + 2].t != 7
275 || g[z + 1].t != 7 || r[z + 2].t != 7 || s[z + 1].t != 5 || o[z + 1].t != 7
276 || k[z + 1][0].t != 7 || k[z + 1][1].t != 7 || q[z + 1][0].t != 7 || q[z + 1][1].t != 7
277 || t[z + 2][0].t != 5 || t[z + 2][1].t != 5)
279 for (T z = 0; z < 3; z++)
283 if (a[0].s != 7 * 16 + 4 * 8 + 2 * 4
284 || a[1].s != 17 * 16 + 5 * 8 + 3 * 4
285 || b[0].s != 9 || b[1].s != 11
286 || b[2].s != 1LL << (16 + 4)
287 || b[3].s != 1LL << (8 + 4)
288 || b[4].s != 1LL << (16 + 8)
289 || b[5].s != 13 || b[6].s != 15
290 || c[0].s != 6 * 16 + 4 * 8 + 4 * 4
291 || c[1].s != 5 * 8 + 9 * 4
293 || e[1].s != 19 * 16 + 6 * 8 + 16 * 4
297 || f[2].s != 21 * 16 + 7 * 8 + 8 * 4
298 || f[3].s != 23 * 16 + 18 * 8 + 8 * 4
301 || g[1].s != 25 * 16 + 29 * 8 + 9 * 4
302 || g[2].s != 27 * 16 + 18 * 8 + 10 * 4
304 || h[0].s != 29 * 16 + 19 * 8 + 11 * 4
305 || h[1].s != 1 || h[2].s != 4
306 || k[0][0].s != 5 || k[0][1].s != 6
307 || k[1][0].s != 31 * 16 + 17 * 8
308 || k[1][1].s != 13 * 4
309 || k[2][0].s != 19 * 8
310 || k[2][1].s != 33 * 16 + 15 * 4
311 || k[3][0].s != 7 || k[3][1].s != 8
312 || p[0].s != 29 * 16 + 19 * 8 + 11 * 4
313 || p[1].s != 1 || p[2].s != 4
314 || q[0][0].s != 5 || q[0][1].s != 6
315 || q[1][0].s != 31 * 16 + 17 * 8
316 || q[1][1].s != 13 * 4
317 || q[2][0].s != 19 * 8
318 || q[2][1].s != 33 * 16 + 15 * 4
319 || q[3][0].s != 7 || q[3][1].s != 8
321 || sb[1].s != 1LL << (16 + 4)
322 || sb[2].s != 1LL << 8
324 || tb[0][0].s != 9 || tb[0][1].s != 10 || tb[1][0].s != 11 || tb[1][1].s != 12
325 || tb[2][0].s != 1LL << (16 + 8)
326 || tb[2][1].s != 1LL << 4
327 || tb[3][0].s != 1LL << 8
328 || tb[3][1].s != 1LL << (16 + 4)
329 || tb[4][0].s != 13 || tb[4][1].s != 14)
336 int c1 = S::cnt1, c2 = S::cnt2, c3 = S::cnt3;
339 if (S::cnt1 + S::cnt2 - c1 - c2 != S::cnt3 - c3)