void t4() {
  int x = 5, i, arr[32];
  for (i = 0; i < 32; i++)
    arr[i] = 3;
#pragma acc parallel firstprivate(x) copy(arr) num_gangs(32) num_workers(8)    \
    vector_length(32)
  {
#pragma acc loop gang
    for (i = 0; i < 32; i++)
      arr[i] += x;
  }
  for (i = 0; i < 32; i++)
    if (arr[i] != 8)
      __builtin_abort();
}


x86 assembly (clang, -O0):
<t4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x5,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    1150 <t4+0x40>
movslq -0x8(%rbp),%rax
movl   $0x3,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <t4+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    1184 <t4+0x74>
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    1157 <t4+0x47>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    11bf <t4+0xaf>
movslq -0x8(%rbp),%rax
cmpl   $0x8,-0x90(%rbp,%rax,4)
08
je     11ac <t4+0x9c>
call   1030 <abort@plt>
jmp    11b1 <t4+0xa1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118b <t4+0x7b>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t4>:
sub    $0x88,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
movdqu 0x4(%rsp),%xmm0
movdqa 0xec6(%rip),%xmm1
paddd  %xmm1,%xmm0
movdqu %xmm0,0x4(%rsp)
movdqu 0x14(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqu %xmm0,0x14(%rsp)
movdqu 0x24(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqu %xmm0,0x24(%rsp)
movdqu 0x34(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqu %xmm0,0x34(%rsp)
movdqu 0x44(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqu %xmm0,0x44(%rsp)
movdqu 0x54(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqu %xmm0,0x54(%rsp)
movdqu 0x64(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqu %xmm0,0x64(%rsp)
addl   $0x5,0x74(%rsp)
addl   $0x5,0x78(%rsp)
addl   $0x5,0x7c(%rsp)
movdqa 0xe55(%rip),%xmm0
movdqa 0x70(%rsp),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm1,%xmm1
pxor   %xmm1,%xmm2
movdqa 0x60(%rsp),%xmm3
pcmpeqd %xmm0,%xmm3
pxor   %xmm1,%xmm3
packssdw %xmm2,%xmm3
movdqa 0x50(%rsp),%xmm4
pcmpeqd %xmm0,%xmm4
pxor   %xmm1,%xmm4
movdqa 0x40(%rsp),%xmm2
pcmpeqd %xmm0,%xmm2
pxor   %xmm1,%xmm2
packssdw %xmm4,%xmm2
packsswb %xmm3,%xmm2
movdqa 0x30(%rsp),%xmm3
pcmpeqd %xmm0,%xmm3
pxor   %xmm1,%xmm3
movdqa 0x20(%rsp),%xmm4
pcmpeqd %xmm0,%xmm4
pxor   %xmm1,%xmm4
packssdw %xmm3,%xmm4
movdqa 0x10(%rsp),%xmm3
pcmpeqd %xmm0,%xmm3
pxor   %xmm1,%xmm3
pcmpeqd (%rsp),%xmm0
pxor   %xmm1,%xmm0
packssdw %xmm3,%xmm0
packsswb %xmm4,%xmm0
por    %xmm2,%xmm0
pmovmskb %xmm0,%eax
test   %eax,%eax
jne    1276 <t4+0x166>
add    $0x88,%rsp
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define void @t4() {
%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 = %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]* %3, i64 0, i64 %9
store i32 3, 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* %2
br label %15
15: ; preds = %25, %14
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 32
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = add nsw i32 %23, %19
store i32 %24, i32* %22
br label %25
25: ; preds = %18
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %15
28: ; preds = %15
store i32 0, i32* %2
br label %29
29: ; preds = %40, %28
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, 32
br i1 %31, label %32, label %43
32: ; preds = %29
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = icmp ne i32 %36, 8
br i1 %37, label %38, label %39
38: ; preds = %32
unreachable
39: ; preds = %32
br label %40
40: ; preds = %39
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %29
43: ; preds = %29
ret void
}

LLVM IR (-O2):
define void @t4() {
%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 3, 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 3, i32 3, i32 3, i32 3>, <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 3, i32 3, i32 3, i32 3>, <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 3, i32 3, i32 3, i32 3>, <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 3, i32 3, i32 3, i32 3>, <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 3, i32 3, i32 3, i32 3>, <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 3, i32 3, i32 3, i32 3>, <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 3, i32 3, i32 3, i32 3>, <4 x i32>* %17
%18 = bitcast <32 x i32>* %1 to <4 x i32>*
store <4 x i32> <i32 8, i32 3, i32 3, 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 5, i32 5, i32 5, i32 5>
%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 5, i32 5, i32 5, i32 5>
%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 5, i32 5, i32 5, i32 5>
%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 5, i32 5, i32 5, i32 5>
%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 5, i32 5, i32 5, i32 5>
%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 5, i32 5, i32 5, i32 5>
%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 5, i32 5, i32 5, i32 5>
%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, 5
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, 5
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, 5
store i32 %65, i32* %64
%66 = load <32 x i32>, <32 x i32>* %1
%67 = freeze <32 x i32> %66
%68 = icmp ne <32 x i32> %67, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
%69 = bitcast <32 x i1> %68 to i32
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %0
ret void
72: ; preds = %0
tail call void @abort()
unreachable
}