#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 /*<<< orphan*/ printf(char *);
int main() {
  int data1[3] = {1}, data2[3] = {2}, data3[3] = {3};
  int sum[16] = {0};
#pragma omp target teams distribute parallel for map(tofrom                    \
                                                     : sum)                    \
    firstprivate(data1, data2, data3)
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 3; ++j) {
      sum[i] += data1[j];
      sum[i] += data2[j];
      sum[i] += data3[j];
    }
  }
  for (int i = 0; i < 16; ++i) {
    assert(sum[i] == 6);
  }
  printf("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xead(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x10,-0x74(%rbp)
jge    120d <main+0xdd>
movl   $0x0,-0x78(%rbp)
cmpl   $0x3,-0x78(%rbp)
jge    11fa <main+0xca>
movslq -0x78(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%ecx
movslq -0x74(%rbp),%rax
add    -0x70(%rbp,%rax,4),%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
movslq -0x78(%rbp),%rax
mov    -0x1c(%rbp,%rax,4),%ecx
movslq -0x74(%rbp),%rax
add    -0x70(%rbp,%rax,4),%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
movslq -0x78(%rbp),%rax
mov    -0x28(%rbp,%rax,4),%ecx
movslq -0x74(%rbp),%rax
add    -0x70(%rbp,%rax,4),%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11a6 <main+0x76>
jmp    11ff <main+0xcf>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1195 <main+0x65>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x10,-0x7c(%rbp)
jge    1242 <main+0x112>
movslq -0x7c(%rbp),%rax
cmpl   $0x6,-0x70(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1214 <main+0xe4>
lea    0xddb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
lea    0xe38(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.data1 = [3 x i32] [i32 1, i32 0, i32 0]
@__const.main.data2 = [3 x i32] [i32 2, i32 0, i32 0]
@__const.main.data3 = [3 x i32] [i32 3, i32 0, i32 0]
@.str = [6 x i8] c"PASS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [3 x i32]
%4 = alloca [3 x i32]
%5 = alloca [16 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [3 x i32]* %2 to i8*
%10 = bitcast [3 x i32]* %3 to i8*
%11 = bitcast [3 x i32]* %4 to i8*
%12 = bitcast [16 x i32]* %5 to i8*
store i32 0, i32* %6
br label %13
13: ; preds = %52, %0
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 16
br i1 %15, label %16, label %55
16: ; preds = %13
store i32 0, i32* %7
br label %17
17: ; preds = %48, %16
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %51
20: ; preds = %17
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = add nsw i32 %28, %24
store i32 %29, i32* %27
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = add nsw i32 %37, %33
store i32 %38, i32* %36
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = add nsw i32 %46, %42
store i32 %47, i32* %45
br label %48
48: ; preds = %20
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %17
51: ; preds = %17
br label %52
52: ; preds = %51
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %13
55: ; preds = %13
store i32 0, i32* %8
br label %56
56: ; preds = %67, %55
%57 = load i32, i32* %8
%58 = icmp slt i32 %57, 16
br i1 %58, label %59, label %70
59: ; preds = %56
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = icmp eq i32 %63, 6
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
br label %67
67: ; preds = %59
%68 = load i32, i32* %8
%69 = add nsw i32 %68, 1
store i32 %69, i32* %8
br label %56
70: ; preds = %56
%71 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"PASS\00"
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @assert(i32 1)
%11 = tail call i32 @assert(i32 1)
%12 = tail call i32 @assert(i32 1)
%13 = tail call i32 @assert(i32 1)
%14 = tail call i32 @assert(i32 1)
%15 = tail call i32 @assert(i32 1)
%16 = tail call i32 @assert(i32 1)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}