#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 loop_g_1() {
  int x = 5, i, arr[32];
  for (i = 0; i < 32; i++)
    arr[i] = i;
#pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
  {
#pragma acc loop gang private(x)
    for (i = 0; i < 32; i++) {
      x = i * 2;
      arr[i] += x;
    }
  }
  for (i = 0; i < 32; i++)
    assert(arr[i] == i * 3);
}


x86 assembly (clang, -O0):
<loop_g_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x5,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    114f <loop_g_1+0x3f>
mov    -0x8(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <loop_g_1+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    118c <loop_g_1+0x7c>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
movslq -0x8(%rbp),%rax
add    -0x90(%rbp,%rax,4),%ecx
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <loop_g_1+0x46>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    11c9 <loop_g_1+0xb9>
movslq -0x8(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%eax
imul   $0x3,-0x8(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <loop_g_1+0x83>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop_g_1>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeef(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xef7(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,(%rsp)
movdqu 0x4(%rsp),%xmm0
paddd  0xef9(%rip),%xmm0
movdqu %xmm0,0x4(%rsp)
movdqu 0x14(%rsp),%xmm0
paddd  0xef5(%rip),%xmm0
movdqu %xmm0,0x14(%rsp)
movdqu 0x24(%rsp),%xmm0
paddd  0xef1(%rip),%xmm0
movdqu %xmm0,0x24(%rsp)
movdqu 0x34(%rsp),%xmm0
paddd  0xeed(%rip),%xmm0
movdqu %xmm0,0x34(%rsp)
movdqu 0x44(%rsp),%xmm0
paddd  0xee9(%rip),%xmm0
movdqu %xmm0,0x44(%rsp)
movdqu 0x54(%rsp),%xmm0
paddd  0xee5(%rip),%xmm0
movdqu %xmm0,0x54(%rsp)
movdqu 0x64(%rsp),%xmm0
paddd  0xee1(%rip),%xmm0
movdqu %xmm0,0x64(%rsp)
addl   $0x3a,0x74(%rsp)
addl   $0x3c,0x78(%rsp)
addl   $0x3e,0x7c(%rsp)
mov    %rsp,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14),%eax
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
add    $0x3,%rbx
add    $0x4,%r14
cmp    $0x60,%rbx
jne    1220 <loop_g_1+0x110>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @loop_g_1() {
%1 = alloca [32 x i32]
%2 = bitcast [32 x i32]* %1 to i8*
%3 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
store i32 0, i32* %3
%4 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 4
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %5
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 8
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %7
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 12
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, <4 x i32>* %9
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 16
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, <4 x i32>* %11
%12 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 20
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, <4 x i32>* %13
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 24
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, <4 x i32>* %15
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 28
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, <4 x i32>* %17
%18 = bitcast [32 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %18
%19 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 1
%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 2, i32 4, i32 6, i32 8>
%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]* %1, i64 0, i64 5
%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 10, i32 12, i32 14, i32 16>
%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]* %1, i64 0, i64 9
%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 18, i32 20, i32 22, i32 24>
%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]* %1, i64 0, i64 13
%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 26, i32 28, i32 30, i32 32>
%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]* %1, i64 0, i64 17
%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 34, i32 36, i32 38, i32 40>
%43 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> %42, <4 x i32>* %43
%44 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 21
%45 = bitcast i32* %44 to <4 x i32>*
%46 = load <4 x i32>, <4 x i32>* %45
%47 = add nsw <4 x i32> %46, <i32 42, i32 44, i32 46, i32 48>
%48 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> %47, <4 x i32>* %48
%49 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 25
%50 = bitcast i32* %49 to <4 x i32>*
%51 = load <4 x i32>, <4 x i32>* %50
%52 = add nsw <4 x i32> %51, <i32 50, i32 52, i32 54, i32 56>
%53 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> %52, <4 x i32>* %53
%54 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 29
%55 = load i32, i32* %54
%56 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 29
%57 = add nsw i32 %55, 58
store i32 %57, i32* %56
%58 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 30
%59 = load i32, i32* %58
%60 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 30
%61 = add nsw i32 %59, 60
store i32 %61, i32* %60
%62 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 31
%63 = load i32, i32* %62
%64 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 31
%65 = add nsw i32 %63, 62
store i32 %65, i32* %64
br label %66
66: ; preds = %0, %66
%67 = phi i64 [ %75, %66 ], [ 0, %0 ]
%68 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = mul nuw nsw i64 %67, 3
%71 = zext i32 %69 to i64
%72 = icmp eq i64 %70, %71
%73 = zext i1 %72 to i32
%74 = tail call i32 @assert(i32 %73)
%75 = add nuw nsw i64 %67, 1
%76 = icmp eq i64 %75, 32
br i1 %76, label %77, label %66
77: ; preds = %66
ret void
}