#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*/ printf(char *, ...);
main() {
  int i, j, k;
  i = 1;
  j = 2;
  k = 0;
#pragma omp parallel private(i) firstprivate(j)
  {
    i = 3;
    j += 2;
#pragma omp atomic
    k += 1;
  }
  printf("par002 - values of I: %d, J: %d, and K: %d\n", i, j, k);
  if (k < 1)
    printf("parallel 002 - NOTE serial or team size of one\n");
  if (i == 1 && j == 2)
    printf("parallel 002 - NOTE original variable retains original value\n");
  if (i == 3) {
    printf("parallel 002 - NOTE original variable gets value of master\n copy "
           "of private variable\n");
    if (j == 4)
      printf("parallel 002 - NOTE value of J gives no evidence\n of parallel "
             "execution\n");
  }
  printf("parallel 002 PASSED\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
jge    117c <main+0x6c>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    119e <main+0x8e>
cmpl   $0x2,-0xc(%rbp)
jne    119e <main+0x8e>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11d3 <main+0xc3>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0xc(%rbp)
jne    11ce <main+0xbe>
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <main+0xc3>
lea    0xf5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
lea    0xf6c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"par002 - values of I: %d, J: %d, and K: %d\0A\00"
@.str.1 = [48 x i8] c"parallel 002 - NOTE serial or team size of one\0A\00"
@.str.2 = [62 x i8] c"parallel 002 - NOTE original variable retains original value\0A\00"
@.str.3 = [86 x i8] c"parallel 002 - NOTE original variable gets value of master\0A copy of private variable\0A\00"
@.str.4 = [73 x i8] c"parallel 002 - NOTE value of J gives no evidence\0A of parallel execution\0A\00"
@.str.5 = [21 x i8] c"parallel 002 PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 0, i32* %4
store i32 3, i32* %2
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 2
store i32 %6, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
store i32 %8, i32* %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %20, %17
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %35
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 4
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
br label %35
35: ; preds = %34, %25
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [44 x i8] c"par002 - values of I: %d, J: %d, and K: %d\0A\00"
@str = [85 x i8] c"parallel 002 - NOTE original variable gets value of master\0A copy of private variable\00"
@str.6 = [72 x i8] c"parallel 002 - NOTE value of J gives no evidence\0A of parallel execution\00"
@str.7 = [20 x i8] c"parallel 002 PASSED\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 3, i32 4, i32 1)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}