#ifndef HEADER
#define HEADER
void foo() {}
struct S1 {
S1(): a(0) {}
S1(int v) : a(v) {}
int a;
typedef int type;
S1& operator +(const S1&);
S1& operator *(const S1&);
S1& operator &&(const S1&);
S1& operator ^(const S1&);
};
template <typename T>
class S7 : public T {
protected:
T a;
T b[100];
S7() : a(0) {}
public:
S7(typename T::type v) : a(v) {
#pragma omp parallel private(a) private(this->a) private(T::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
#pragma omp parallel firstprivate(a) firstprivate(this->a) firstprivate(T::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
#pragma omp parallel shared(a) shared(this->a) shared(T::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
#pragma omp parallel reduction(+ : a) reduction(*: b[:])
for (int k = 0; k < a.a; ++k)
++this->a.a;
}
S7 &operator=(S7 &s) {
#pragma omp parallel private(a) private(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
#pragma omp parallel firstprivate(a) firstprivate(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
#pragma omp parallel shared(a) shared(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
#pragma omp parallel reduction(&& : this->a) reduction(^: b[s.a.a])
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
return *this;
}
};
class S8 : public S7<S1> {
S8() {}
public:
S8(int v) : S7<S1>(v){
#pragma omp parallel private(a) private(this->a) private(S7 < S1 > ::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
#pragma omp parallel firstprivate(a) firstprivate(this->a) firstprivate(S7 < S1 > ::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
#pragma omp parallel shared(a) shared(this->a) shared(S7 < S1 > ::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
#pragma omp parallel reduction(default, ^ : S7 < S1 > ::a) reduction(+ : S7 < S1 > ::b[ : S7 < S1 > ::a.a])
for (int k = 0; k < a.a; ++k)
++this->a.a;
}
S8 &operator=(S8 &s) {
#pragma omp parallel private(a) private(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
#pragma omp parallel firstprivate(a) firstprivate(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
#pragma omp parallel shared(a) shared(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
#pragma omp parallel reduction(* : this->a) reduction(&&:this->b[a.a:])
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
return *this;
}
};
template <class T>
struct S {
operator T() {return T();}
static T TS;
#pragma omp threadprivate(TS)
};
int thrp;
#pragma omp threadprivate(thrp)
template <typename T, int C>
T tmain(T argc, T *argv) {
T b = argc, c, d, e, f, g;
static T a;
S<T> s;
T arr[C][10], arr1[C];
#pragma omp parallel
a=2;
#pragma omp parallel default(none), private(argc,b) firstprivate(argv) shared (d) if (parallel:argc > 0) num_threads(C) copyin(S<T>::TS, thrp) proc_bind(master) reduction(+:c, arr1[argc]) reduction(max:e, arr[:C][0:10])
foo();
#ifdef OMP51
#pragma omp parallel default(none), private(argc,b) firstprivate(argv) shared (d) if (parallel:argc > 0) num_threads(C) copyin(S<T>::TS, thrp) proc_bind(primary) reduction(+:c, arr1[argc]) reduction(max:e, arr[:C][0:10])
foo();
#endif
#pragma omp parallel if (C) num_threads(s) proc_bind(close) reduction(^:e, f, arr[0:C][:argc]) reduction(default, && : g) reduction(task,+:argc)
foo();
return 0;
}
enum Enum { };
int main (int argc, char **argv) {
long x;
int b = argc, c, d, e, f, g;
static int a;
#pragma omp threadprivate(a)
int arr[10][argc], arr1[2];
Enum ee;
#pragma omp parallel
a=2;
#pragma omp parallel default(none), private(argc,b) firstprivate(argv) if (parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(| : c, d, arr1[argc]) reduction(* : e, arr[:10][0:argc]) allocate(e)
foo();
#pragma omp parallel allocate(e) if (b) num_threads(c) proc_bind(close) reduction(^:e, f) reduction(&& : g, arr[0:argc][:10])
foo();
return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x);
}
template <class T>
struct Foo {
int foo;
};
void foo(const Foo<int> &arg) {
#pragma omp parallel
{
#pragma omp for schedule(static)
for (int idx = 0; idx < 1234; ++idx) {
idx = arg.foo;
}
}
}
template<typename T>
T S<T>::TS = 0;
#endif