#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*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int a = 0;
#pragma omp task
  { a = 1; }
#pragma omp taskwait
  if (a != 0) {
    fprintf(stderr, "a == %d != 0\n", a);
    abort();
  }
#pragma omp task shared(a)
  { a = 1; }
#pragma omp taskwait
  if (a != 1) {
    fprintf(stderr, "a = %d != 1\n", a);
    abort();
  }
  int c[100];
  int i;
  for (i = 0; i < 100; i++) {
    int *p = &(c[i]);
#pragma omp task firstprivate(p)
    { *p = i; }
  }
#pragma omp taskwait
  for (i = 0; i < 100; i++) {
    if (c[i] != i) {
      fprintf(stderr, "c[%d] == %d != %d\n", i, c[i], i);
      abort();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1172 <main+0x52>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     11a4 <main+0x84>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    11fa <main+0xda>
movslq -0x1b4(%rbp),%rcx
lea    -0x1b0(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x1c0(%rbp)
mov    -0x1b4(%rbp),%ecx
mov    -0x1c0(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    11ae <main+0x8e>
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    127d <main+0x15d>
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x1b4(%rbp),%eax
je     1264 <main+0x144>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
mov    -0x1b4(%rbp),%edx
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
mov    -0x1b4(%rbp),%r8d
lea    0xdc5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1269 <main+0x149>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    1204 <main+0xe4>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"a == %d != 0\0A\00"
@.str.1 = [13 x i8] c"a = %d != 1\0A\00"
@.str.2 = [19 x i8] c"c[%d] == %d != %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [100 x i32]
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 1, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i32, i32* %6
%15 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %2
store i32 1, i32* %6
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = load i32, i32* %6
%23 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 (...) @abort()
unreachable
25: ; preds = %17
store i32 0, i32* %8
br label %26
26: ; preds = %35, %25
%27 = load i32, i32* %8
%28 = icmp slt i32 %27, 100
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %31
store i32* %32, i32** %9
%33 = load i32, i32* %8
%34 = load i32*, i32** %9
store i32 %33, i32* %34
br label %35
35: ; preds = %29
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %26
38: ; preds = %26
store i32 0, i32* %8
br label %39
39: ; preds = %60, %38
%40 = load i32, i32* %8
%41 = icmp slt i32 %40, 100
br i1 %41, label %42, label %63
42: ; preds = %39
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = load i32, i32* %8
%48 = icmp ne i32 %46, %47
br i1 %48, label %49, label %59
49: ; preds = %42
%50 = load i32, i32* @stderr
%51 = load i32, i32* %8
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %8
%57 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %51, i32 %55, i32 %56)
%58 = call i32 (...) @abort()
unreachable
59: ; preds = %42
br label %60
60: ; preds = %59
%61 = load i32, i32* %8
%62 = add nsw i32 %61, 1
store i32 %62, i32* %8
br label %39
63: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"a == %d != 0\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 (...) @abort()
unreachable
}