#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);
void t22() {
  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);
}


x86 assembly (clang, -O0):
<t22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x84(%rbp)
cmpl   $0x20,-0x84(%rbp)
jge    1155 <t22+0x45>
movslq -0x84(%rbp),%rax
movl   $0x0,-0x80(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1125 <t22+0x15>
movl   $0x0,-0x88(%rbp)
cmpl   $0x20,-0x88(%rbp)
jge    1192 <t22+0x82>
movslq -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    115f <t22+0x4f>
movl   $0x0,-0x84(%rbp)
cmpl   $0x20,-0x84(%rbp)
jge    11d6 <t22+0xc6>
movslq -0x84(%rbp),%rax
cmpl   $0x1,-0x80(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    119c <t22+0x8c>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t22>:
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 <t22+0xc0>
add    $0x80,%rsp
pop    %rbx
ret

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

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