#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] = i;
#pragma acc parallel copy(arr) num_gangs(1) num_workers(8) vector_length(32)
  {
    int k;
#pragma acc loop vector
    for (k = 0; k < 32; k++) {
#pragma acc atomic
      arr[k]++;
    }
  }
  for (i = 0; i < 32; i++)
    assert(arr[i] == 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    1168 <main+0x58>
mov    -0x94(%rbp),%ecx
movslq -0x94(%rbp),%rax
mov    %ecx,-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    11ab <main+0x9b>
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    1172 <main+0x62>
movl   $0x0,-0x94(%rbp)
cmpl   $0x20,-0x94(%rbp)
jge    11fc <main+0xec>
movslq -0x94(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%eax
mov    -0x94(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11b5 <main+0xa5>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef1(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xefd(%rip),%xmm0
movaps %xmm0,(%rsp)
movdqu 0x4(%rsp),%xmm0
pcmpeqd %xmm1,%xmm1
psubd  %xmm1,%xmm0
movdqu %xmm0,0x4(%rsp)
movdqu 0x14(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqu %xmm0,0x14(%rsp)
movdqu 0x24(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqu %xmm0,0x24(%rsp)
movdqu 0x34(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqu %xmm0,0x34(%rsp)
movdqu 0x44(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqu %xmm0,0x44(%rsp)
movdqu 0x54(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqu %xmm0,0x54(%rsp)
movdqu 0x64(%rsp),%xmm0
psubd  %xmm1,%xmm0
movdqu %xmm0,0x64(%rsp)
addl   $0x1,0x74(%rsp)
addl   $0x1,0x78(%rsp)
addl   $0x1,0x7c(%rsp)
mov    $0x1,%ebx
nop
mov    -0x4(%rsp,%rbx,4),%eax
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
add    $0x1,%rbx
cmp    $0x21,%rbx
jne    1200 <main+0xf0>
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 = %17, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %7
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %12
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %9
20: ; preds = %9
store i32 0, i32* %8
br label %21
21: ; preds = %30, %20
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 32
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = add nsw i32 %28, 1
store i32 %29, i32* %27
br label %30
30: ; preds = %24
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %21
33: ; preds = %21
store i32 0, i32* %7
br label %34
34: ; preds = %47, %33
%35 = load i32, i32* %7
%36 = icmp slt i32 %35, 32
br i1 %36, label %37, label %50
37: ; preds = %34
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
%44 = icmp eq i32 %41, %43
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
br label %47
47: ; preds = %37
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %34
50: ; preds = %34
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 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
store i32 0, i32* %5
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 4
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %7
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 8
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %9
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 12
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, <4 x i32>* %11
%12 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 16
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, <4 x i32>* %13
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 20
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, <4 x i32>* %15
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 24
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, <4 x i32>* %17
%18 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 28
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, <4 x i32>* %19
%20 = bitcast [32 x i32]* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 2, i32 3>, <4 x i32>* %20
%21 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 1
%22 = bitcast i32* %21 to <4 x i32>*
%23 = load <4 x i32>, <4 x i32>* %22
%24 = add nsw <4 x i32> %23, <i32 1, i32 1, i32 1, i32 1>
%25 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %25
%26 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 5
%27 = bitcast i32* %26 to <4 x i32>*
%28 = load <4 x i32>, <4 x i32>* %27
%29 = add nsw <4 x i32> %28, <i32 1, i32 1, i32 1, i32 1>
%30 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> %29, <4 x i32>* %30
%31 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 9
%32 = bitcast i32* %31 to <4 x i32>*
%33 = load <4 x i32>, <4 x i32>* %32
%34 = add nsw <4 x i32> %33, <i32 1, i32 1, i32 1, i32 1>
%35 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> %34, <4 x i32>* %35
%36 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 13
%37 = bitcast i32* %36 to <4 x i32>*
%38 = load <4 x i32>, <4 x i32>* %37
%39 = add nsw <4 x i32> %38, <i32 1, i32 1, i32 1, i32 1>
%40 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> %39, <4 x i32>* %40
%41 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 17
%42 = bitcast i32* %41 to <4 x i32>*
%43 = load <4 x i32>, <4 x i32>* %42
%44 = add nsw <4 x i32> %43, <i32 1, i32 1, i32 1, i32 1>
%45 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> %44, <4 x i32>* %45
%46 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 21
%47 = bitcast i32* %46 to <4 x i32>*
%48 = load <4 x i32>, <4 x i32>* %47
%49 = add nsw <4 x i32> %48, <i32 1, i32 1, i32 1, i32 1>
%50 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> %49, <4 x i32>* %50
%51 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 25
%52 = bitcast i32* %51 to <4 x i32>*
%53 = load <4 x i32>, <4 x i32>* %52
%54 = add nsw <4 x i32> %53, <i32 1, i32 1, i32 1, i32 1>
%55 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> %54, <4 x i32>* %55
%56 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 29
%57 = load i32, i32* %56
%58 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 29
%59 = add nsw i32 %57, 1
store i32 %59, i32* %58
%60 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 30
%61 = load i32, i32* %60
%62 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 30
%63 = add nsw i32 %61, 1
store i32 %63, i32* %62
%64 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 31
%65 = load i32, i32* %64
%66 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 31
%67 = add nsw i32 %65, 1
store i32 %67, i32* %66
br label %68
68: ; preds = %2, %68
%69 = phi i64 [ %72, %68 ], [ 0, %2 ]
%70 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = add nuw nsw i64 %69, 1
%73 = zext i32 %71 to i64
%74 = icmp eq i64 %72, %73
%75 = zext i1 %74 to i32
%76 = tail call i32 @assert(i32 %75)
%77 = icmp eq i64 %72, 32
br i1 %77, label %78, label %68
78: ; preds = %68
ret i32 0
}