int main(void) {
  int i;
  double result, array[1000];
  int lresult;
#pragma acc parallel
#pragma acc loop gang worker vector reduction(+ : result)
  for (i = 0; i < 1000; i++)
    result += array[i];
#pragma acc parallel
#pragma acc loop gang worker vector reduction(* : result)
  for (i = 0; i < 1000; i++)
    result *= array[i];
#pragma acc parallel
#pragma acc loop gang worker vector reduction(max : result)
  for (i = 0; i < 1000; i++)
    result = result > array[i] ? result : array[i];
#pragma acc parallel
#pragma acc loop gang worker vector reduction(min : result)
  for (i = 0; i < 1000; i++)
    result = result < array[i] ? result : array[i];
#pragma acc parallel
#pragma acc loop gang worker vector reduction(&& : lresult)
  for (i = 0; i < 1000; i++)
    lresult = lresult && (result > array[i]);
#pragma acc parallel
#pragma acc loop gang worker vector reduction(|| : lresult)
  for (i = 0; i < 1000; i++)
    lresult = lresult || (result > array[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1ef0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    114b <main+0x4b>
movslq -0x8(%rbp),%rax
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1184 <main+0x84>
movslq -0x8(%rbp),%rax
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x52>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11f2 <main+0xf2>
movsd  -0x10(%rbp),%xmm0
movslq -0x8(%rbp),%rax
ucomisd -0x1f50(%rbp,%rax,8),%xmm0
ff ff
jbe    11c2 <main+0xc2>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x1f60(%rbp)
ff
jmp    11d7 <main+0xd7>
movslq -0x8(%rbp),%rax
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1f60(%rbp)
ff
movsd  -0x1f60(%rbp),%xmm0
ff
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118b <main+0x8b>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1264 <main+0x164>
movsd  -0x10(%rbp),%xmm1
movslq -0x8(%rbp),%rax
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
ucomisd %xmm1,%xmm0
jbe    1234 <main+0x134>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x1f68(%rbp)
ff
jmp    1249 <main+0x149>
movslq -0x8(%rbp),%rax
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1f68(%rbp)
ff
movsd  -0x1f68(%rbp),%xmm0
ff
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f9 <main+0xf9>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    12c7 <main+0x1c7>
xor    %eax,%eax
cmpl   $0x0,-0x1f54(%rbp)
mov    %al,-0x1f69(%rbp)
je     12a8 <main+0x1a8>
movsd  -0x10(%rbp),%xmm0
movslq -0x8(%rbp),%rax
ucomisd -0x1f50(%rbp,%rax,8),%xmm0
ff ff
seta   %al
mov    %al,-0x1f69(%rbp)
mov    -0x1f69(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1f54(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    126b <main+0x16b>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    132a <main+0x22a>
mov    $0x1,%al
cmpl   $0x0,-0x1f54(%rbp)
mov    %al,-0x1f6a(%rbp)
jne    130b <main+0x20b>
movsd  -0x10(%rbp),%xmm0
movslq -0x8(%rbp),%rax
ucomisd -0x1f50(%rbp,%rax,8),%xmm0
seta   %al
mov    %al,-0x1f6a(%rbp)
mov    -0x1f6a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1f54(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12ce <main+0x1ce>
xor    %eax,%eax
add    $0x1ef0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca [1000 x double]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1000
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %11
%13 = load double, double* %12
%14 = load double, double* %3
%15 = fadd double %14, %13
store double %15, double* %3
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
store i32 0, i32* %2
br label %20
20: ; preds = %30, %19
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 1000
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %25
%27 = load double, double* %26
%28 = load double, double* %3
%29 = fmul double %28, %27
store double %29, double* %3
br label %30
30: ; preds = %23
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %20
33: ; preds = %20
store i32 0, i32* %2
br label %34
34: ; preds = %53, %33
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 1000
br i1 %36, label %37, label %56
37: ; preds = %34
%38 = load double, double* %3
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %40
%42 = load double, double* %41
%43 = fcmp ogt double %38, %42
br i1 %43, label %44, label %46
44: ; preds = %37
%45 = load double, double* %3
br label %51
46: ; preds = %37
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %48
%50 = load double, double* %49
br label %51
51: ; preds = %46, %44
%52 = phi double [ %45, %44 ], [ %50, %46 ]
store double %52, double* %3
br label %53
53: ; preds = %51
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %34
56: ; preds = %34
store i32 0, i32* %2
br label %57
57: ; preds = %76, %56
%58 = load i32, i32* %2
%59 = icmp slt i32 %58, 1000
br i1 %59, label %60, label %79
60: ; preds = %57
%61 = load double, double* %3
%62 = load i32, i32* %2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %63
%65 = load double, double* %64
%66 = fcmp olt double %61, %65
br i1 %66, label %67, label %69
67: ; preds = %60
%68 = load double, double* %3
br label %74
69: ; preds = %60
%70 = load i32, i32* %2
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %71
%73 = load double, double* %72
br label %74
74: ; preds = %69, %67
%75 = phi double [ %68, %67 ], [ %73, %69 ]
store double %75, double* %3
br label %76
76: ; preds = %74
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
br label %57
79: ; preds = %57
store i32 0, i32* %2
br label %80
80: ; preds = %96, %79
%81 = load i32, i32* %2
%82 = icmp slt i32 %81, 1000
br i1 %82, label %83, label %99
83: ; preds = %80
%84 = load i32, i32* %5
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %93
86: ; preds = %83
%87 = load double, double* %3
%88 = load i32, i32* %2
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %89
%91 = load double, double* %90
%92 = fcmp ogt double %87, %91
br label %93
93: ; preds = %86, %83
%94 = phi i1 [ false, %83 ], [ %92, %86 ]
%95 = zext i1 %94 to i32
store i32 %95, i32* %5
br label %96
96: ; preds = %93
%97 = load i32, i32* %2
%98 = add nsw i32 %97, 1
store i32 %98, i32* %2
br label %80
99: ; preds = %80
store i32 0, i32* %2
br label %100
100: ; preds = %116, %99
%101 = load i32, i32* %2
%102 = icmp slt i32 %101, 1000
br i1 %102, label %103, label %119
103: ; preds = %100
%104 = load i32, i32* %5
%105 = icmp ne i32 %104, 0
br i1 %105, label %113, label %106
106: ; preds = %103
%107 = load double, double* %3
%108 = load i32, i32* %2
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [1000 x double], [1000 x double]* %4, i64 0, i64 %109
%111 = load double, double* %110
%112 = fcmp ogt double %107, %111
br label %113
113: ; preds = %106, %103
%114 = phi i1 [ true, %103 ], [ %112, %106 ]
%115 = zext i1 %114 to i32
store i32 %115, i32* %5
br label %116
116: ; preds = %113
%117 = load i32, i32* %2
%118 = add nsw i32 %117, 1
store i32 %118, i32* %2
br label %100
119: ; preds = %100
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}