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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
movl   $0x8,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    118c <main+0x5c>
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1164 <main+0x34>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11f7 <main+0xc7>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     11e4 <main+0xb4>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%edx
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
mov    -0x3c(%rbp),%r8d
add    $0x1,%r8d
lea    0xe28(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11e9 <main+0xb9>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1193 <main+0x63>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}