#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 arr[32], i;
  for (i = 0; i < 32; i++)
    arr[i] = 0;
#pragma acc parallel copy(arr) num_gangs(8) num_workers(8) vector_length(32)
  {
    int j;
#pragma acc loop gang
    for (j = 0; j < 32; j++) {
#pragma acc atomic
      arr[j]++;
    }
  }
  for (i = 0; i < 32; i++)
    assert(arr[i] == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x20,-0x94(%rbp)
jge    1166 <main+0x56>
movslq -0x94(%rbp),%rax
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1133 <main+0x23>
movl   $0x0,-0x98(%rbp)
cmpl   $0x20,-0x98(%rbp)
jge    11a9 <main+0x99>
movslq -0x98(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1170 <main+0x60>
movl   $0x0,-0x94(%rbp)
cmpl   $0x20,-0x94(%rbp)
jge    11f0 <main+0xe0>
movslq -0x94(%rbp),%rax
cmpl   $0x1,-0x90(%rbp,%rax,4)
01
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11b3 <main+0xa3>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movdqa (%rsp),%xmm0
pcmpeqd %xmm1,%xmm1
psubd  %xmm1,%xmm0
movdqa %xmm0,(%rsp)
movdqa 0x10(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x10(%rsp)
movdqa 0x20(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x20(%rsp)
movdqa 0x30(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x30(%rsp)
movdqa 0x40(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x40(%rsp)
movdqa 0x50(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x50(%rsp)
movdqa 0x60(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x60(%rsp)
movdqa 0x70(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqa %xmm0,0x70(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
cmpl   $0x1,(%rsp,%rbx,4)
sete   %dil
call   1030 <assert@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    11d0 <main+0xc0>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %3 to i8*
%5 = bitcast [32 x i32]* %3 to <4 x i32>*
%6 = load <4 x i32>, <4 x i32>* %5
%7 = add nsw <4 x i32> %6, <i32 1, i32 1, i32 1, i32 1>
%8 = bitcast [32 x i32]* %3 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %8
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 4
%10 = bitcast i32* %9 to <4 x i32>*
%11 = load <4 x i32>, <4 x i32>* %10
%12 = add nsw <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%13 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %13
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 8
%15 = bitcast i32* %14 to <4 x i32>*
%16 = load <4 x i32>, <4 x i32>* %15
%17 = add nsw <4 x i32> %16, <i32 1, i32 1, i32 1, i32 1>
%18 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %18
%19 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 12
%20 = bitcast i32* %19 to <4 x i32>*
%21 = load <4 x i32>, <4 x i32>* %20
%22 = add nsw <4 x i32> %21, <i32 1, i32 1, i32 1, i32 1>
%23 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %23
%24 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 16
%25 = bitcast i32* %24 to <4 x i32>*
%26 = load <4 x i32>, <4 x i32>* %25
%27 = add nsw <4 x i32> %26, <i32 1, i32 1, i32 1, i32 1>
%28 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> %27, <4 x i32>* %28
%29 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 20
%30 = bitcast i32* %29 to <4 x i32>*
%31 = load <4 x i32>, <4 x i32>* %30
%32 = add nsw <4 x i32> %31, <i32 1, i32 1, i32 1, i32 1>
%33 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %33
%34 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 24
%35 = bitcast i32* %34 to <4 x i32>*
%36 = load <4 x i32>, <4 x i32>* %35
%37 = add nsw <4 x i32> %36, <i32 1, i32 1, i32 1, i32 1>
%38 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %37, <4 x i32>* %38
%39 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 28
%40 = bitcast i32* %39 to <4 x i32>*
%41 = load <4 x i32>, <4 x i32>* %40
%42 = add nsw <4 x i32> %41, <i32 1, i32 1, i32 1, i32 1>
%43 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> %42, <4 x i32>* %43
br label %44
44: ; preds = %2, %44
%45 = phi i64 [ %51, %44 ], [ 0, %2 ]
%46 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 1
%49 = zext i1 %48 to i32
%50 = tail call i32 @assert(i32 %49)
%51 = add nuw nsw i64 %45, 1
%52 = icmp eq i64 %51, 32
br i1 %52, label %53, label %44
53: ; preds = %44
ret i32 0
}