int main(void) {
  const int n = 1000;
  int i;
  double result, array[n];
  int lresult;
#pragma acc parallel vector_length(vl)
#pragma acc loop reduction(+ : result)
  for (i = 0; i < n; i++)
    result += array[i];
#pragma acc parallel vector_length(vl)
#pragma acc loop reduction(* : result)
  for (i = 0; i < n; i++)
    result *= array[i];
#pragma acc parallel vector_length(vl)
#pragma acc loop reduction(&& : lresult)
  for (i = 0; i < n; i++)
    lresult = lresult && (result > array[i]);
#pragma acc parallel vector_length(vl)
#pragma acc loop reduction(|| : lresult)
  for (i = 0; i < n; i++)
    lresult = lresult || (result > array[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f00,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1159 <main+0x59>
movslq -0xc(%rbp),%rax
movsd  -0x1f70(%rbp,%rax,8),%xmm0
ff ff
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <main+0x27>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1192 <main+0x92>
movslq -0xc(%rbp),%rax
movsd  -0x1f70(%rbp,%rax,8),%xmm0
ff ff
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <main+0x60>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11ef <main+0xef>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x1f71(%rbp)
je     11d3 <main+0xd3>
movsd  -0x18(%rbp),%xmm0
movslq -0xc(%rbp),%rax
ucomisd -0x1f70(%rbp,%rax,8),%xmm0
ff ff
seta   %al
mov    %al,-0x1f71(%rbp)
mov    -0x1f71(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1199 <main+0x99>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    124c <main+0x14c>
mov    $0x1,%al
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x1f72(%rbp)
jne    1230 <main+0x130>
movsd  -0x18(%rbp),%xmm0
movslq -0xc(%rbp),%rax
ucomisd -0x1f70(%rbp,%rax,8),%xmm0
ff ff
seta   %al
mov    %al,-0x1f72(%rbp)
mov    -0x1f72(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f6 <main+0xf6>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x1f00,%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 i32
%4 = alloca double
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
store i32 1000, i32* %2
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %5
%8 = alloca double, i64 1000
store i32 0, i32* %3
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %8, i64 %14
%16 = load double, double* %15
%17 = load double, double* %4
%18 = fadd double %17, %16
store double %18, double* %4
br label %19
19: ; preds = %12
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %9
22: ; preds = %9
store i32 0, i32* %3
br label %23
23: ; preds = %33, %22
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 1000
br i1 %25, label %26, label %36
26: ; preds = %23
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %8, i64 %28
%30 = load double, double* %29
%31 = load double, double* %4
%32 = fmul double %31, %30
store double %32, double* %4
br label %33
33: ; preds = %26
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %23
36: ; preds = %23
store i32 0, i32* %3
br label %37
37: ; preds = %53, %36
%38 = load i32, i32* %3
%39 = icmp slt i32 %38, 1000
br i1 %39, label %40, label %56
40: ; preds = %37
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = load double, double* %4
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %8, i64 %46
%48 = load double, double* %47
%49 = fcmp ogt double %44, %48
br label %50
50: ; preds = %43, %40
%51 = phi i1 [ false, %40 ], [ %49, %43 ]
%52 = zext i1 %51 to i32
store i32 %52, i32* %6
br label %53
53: ; preds = %50
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %37
56: ; preds = %37
store i32 0, i32* %3
br label %57
57: ; preds = %73, %56
%58 = load i32, i32* %3
%59 = icmp slt i32 %58, 1000
br i1 %59, label %60, label %76
60: ; preds = %57
%61 = load i32, i32* %6
%62 = icmp ne i32 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %60
%64 = load double, double* %4
%65 = load i32, i32* %3
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %8, i64 %66
%68 = load double, double* %67
%69 = fcmp ogt double %64, %68
br label %70
70: ; preds = %63, %60
%71 = phi i1 [ true, %60 ], [ %69, %63 ]
%72 = zext i1 %71 to i32
store i32 %72, i32* %6
br label %73
73: ; preds = %70
%74 = load i32, i32* %3
%75 = add nsw i32 %74, 1
store i32 %75, i32* %3
br label %57
76: ; preds = %57
store i32 0, i32* %1
%77 = load i8*, i8** %5
%78 = load i32, i32* %1
ret i32 %78
}

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