#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main(int argc, char *argv[]) {
  int res, res1 = 0, res2 = 0;
#pragma acc parallel num_gangs(GANGS) num_workers(32) vector_length(32) reduction(+:res1) copy(res2, res1)
  {
    res1 += 5;
#pragma acc atomic
    res2 += 5;
  }
  res = 256 * 5;
  assert(res == res1);
  assert(res == res2);
  res = res1 = res2 = 1;
#pragma acc parallel num_gangs(GANGS) num_workers(32) vector_length(32) reduction(*:res1) copy(res1, res2)
  {
    res1 *= 5;
#pragma acc atomic
    res2 *= 5;
  }
  for (int i = 0; i < 8; ++i)
    res *= 5;
  assert(res == res1);
  assert(res == res2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x500,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
imul   $0x5,-0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x5,-0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x8,-0x20(%rbp)
jge    11bc <main+0xac>
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119d <main+0x8d>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
%10 = load i32, i32* %7
%11 = add nsw i32 %10, 5
store i32 %11, i32* %7
%12 = load i32, i32* %8
%13 = add nsw i32 %12, 5
store i32 %13, i32* %8
store i32 1280, i32* %6
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = icmp eq i32 %14, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* %6
%20 = load i32, i32* %8
%21 = icmp eq i32 %19, %20
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
store i32 1, i32* %8
store i32 1, i32* %7
store i32 1, i32* %6
%24 = load i32, i32* %7
%25 = mul nsw i32 %24, 5
store i32 %25, i32* %7
%26 = load i32, i32* %8
%27 = mul nsw i32 %26, 5
store i32 %27, i32* %8
store i32 0, i32* %9
br label %28
28: ; preds = %34, %2
%29 = load i32, i32* %9
%30 = icmp slt i32 %29, 8
br i1 %30, label %31, label %37
31: ; preds = %28
%32 = load i32, i32* %6
%33 = mul nsw i32 %32, 5
store i32 %33, i32* %6
br label %34
34: ; preds = %31
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %28
37: ; preds = %28
%38 = load i32, i32* %6
%39 = load i32, i32* %7
%40 = icmp eq i32 %38, %39
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load i32, i32* %6
%44 = load i32, i32* %8
%45 = icmp eq i32 %43, %44
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @assert(i32 0)
%4 = tail call i32 @assert(i32 0)
%5 = tail call i32 @assert(i32 0)
%6 = tail call i32 @assert(i32 0)
ret i32 0
}