#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();
scalar_t__ omp_get_cancellation();
scalar_t__ omp_get_thread_num();
int main() {
  int a[64];
#pragma omp parallel
  {
#pragma omp barrier
    if (omp_get_thread_num() == 0) {
#pragma omp cancel parallel
    }
#pragma omp for
    for (int i = 0; i < 64; i++)
      a[i] = i;
    if (omp_get_cancellation())
      abort();
  }
#pragma omp parallel
  {
#pragma omp barrier
    if (omp_get_thread_num() == 0) {
#pragma omp cancel parallel
    }
#pragma omp taskgroup
    {
#pragma omp for
      for (int i = 0; i < 64; i++)
#pragma omp task
        a[i] += i;
      if (omp_get_cancellation())
        abort();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
cmp    $0x0,%rax
jne    1158 <main+0x28>
jmp    1158 <main+0x28>
movl   $0x0,-0x114(%rbp)
cmpl   $0x40,-0x114(%rbp)
jge    1197 <main+0x67>
mov    -0x114(%rbp),%ecx
movslq -0x114(%rbp),%rax
mov    %ecx,-0x110(%rbp,%rax,4)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1162 <main+0x32>
mov    $0x0,%al
call   1050 <omp_get_cancellation@plt>
cmp    $0x0,%rax
je     11af <main+0x7f>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
cmp    $0x0,%rax
jne    11c5 <main+0x95>
jmp    11c5 <main+0x95>
movl   $0x0,-0x118(%rbp)
cmpl   $0x40,-0x118(%rbp)
jge    120b <main+0xdb>
mov    -0x118(%rbp),%ecx
movslq -0x118(%rbp),%rax
add    -0x110(%rbp,%rax,4),%ecx
mov    %ecx,-0x110(%rbp,%rax,4)
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    11cf <main+0x9f>
mov    $0x0,%al
call   1050 <omp_get_cancellation@plt>
cmp    $0x0,%rax
je     1223 <main+0xf3>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x108,%rsp
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
movaps 0xebb(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xee0(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movdqa 0xee2(%rip),%xmm0
movdqa %xmm0,0xf0(%rsp)
xor    %eax,%eax
call   1050 <omp_get_cancellation@plt>
test   %rax,%rax
jne    13b2 <main+0x282>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
movdqa (%rsp),%xmm0
movdqa 0x10(%rsp),%xmm1
movdqa 0x20(%rsp),%xmm2
movdqa 0x30(%rsp),%xmm3
paddd  0xdb3(%rip),%xmm0
paddd  0xdbb(%rip),%xmm1
movdqa %xmm0,(%rsp)
movdqa %xmm1,0x10(%rsp)
paddd  0xdb8(%rip),%xmm2
movdqa %xmm2,0x20(%rsp)
paddd  0xdba(%rip),%xmm3
movdqa %xmm3,0x30(%rsp)
movdqa 0x40(%rsp),%xmm0
paddd  0xdb6(%rip),%xmm0
movdqa %xmm0,0x40(%rsp)
movdqa 0x50(%rsp),%xmm0
paddd  0xdb2(%rip),%xmm0
movdqa %xmm0,0x50(%rsp)
movdqa 0x60(%rsp),%xmm0
paddd  0xdae(%rip),%xmm0
movdqa %xmm0,0x60(%rsp)
movdqa 0x70(%rsp),%xmm0
paddd  0xdaa(%rip),%xmm0
movdqa %xmm0,0x70(%rsp)
movdqa 0x80(%rsp),%xmm0
paddd  0xda3(%rip),%xmm0
movdqa %xmm0,0x80(%rsp)
movdqa 0x90(%rsp),%xmm0
paddd  0xd99(%rip),%xmm0
movdqa %xmm0,0x90(%rsp)
movdqa 0xa0(%rsp),%xmm0
paddd  0xd8f(%rip),%xmm0
movdqa %xmm0,0xa0(%rsp)
movdqa 0xb0(%rsp),%xmm0
paddd  0xd85(%rip),%xmm0
movdqa %xmm0,0xb0(%rsp)
movdqa 0xc0(%rsp),%xmm0
paddd  0xd7b(%rip),%xmm0
movdqa %xmm0,0xc0(%rsp)
movdqa 0xd0(%rsp),%xmm0
paddd  0xd71(%rip),%xmm0
movdqa %xmm0,0xd0(%rsp)
movdqa 0xe0(%rsp),%xmm0
paddd  0xd67(%rip),%xmm0
movdqa %xmm0,0xe0(%rsp)
movdqa 0xf0(%rsp),%xmm0
paddd  0xd5d(%rip),%xmm0
movdqa %xmm0,0xf0(%rsp)
xor    %eax,%eax
call   1050 <omp_get_cancellation@plt>
test   %rax,%rax
jne    13b2 <main+0x282>
xor    %eax,%eax
add    $0x108,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [64 x i32]
%2 = bitcast [64 x i32]* %1 to i8*
%3 = tail call i64 (...) @omp_get_thread_num()
%4 = bitcast [64 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %4
%5 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %6
%7 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 8
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %8
%9 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 12
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, <4 x i32>* %10
%11 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 16
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, <4 x i32>* %12
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 20
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, <4 x i32>* %14
%15 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 24
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, <4 x i32>* %16
%17 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 28
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, <4 x i32>* %18
%19 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 32
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 32, i32 33, i32 34, i32 35>, <4 x i32>* %20
%21 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 36
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 36, i32 37, i32 38, i32 39>, <4 x i32>* %22
%23 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 40
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 40, i32 41, i32 42, i32 43>, <4 x i32>* %24
%25 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 44
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 44, i32 45, i32 46, i32 47>, <4 x i32>* %26
%27 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 48
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, <4 x i32>* %28
%29 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 52
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, <4 x i32>* %30
%31 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 56
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 56, i32 57, i32 58, i32 59>, <4 x i32>* %32
%33 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 60
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 60, i32 61, i32 62, i32 63>, <4 x i32>* %34
%35 = tail call i64 (...) @omp_get_cancellation()
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %0
%38 = tail call i32 (...) @abort()
unreachable
39: ; preds = %0
%40 = tail call i64 (...) @omp_get_thread_num()
%41 = bitcast [64 x i32]* %1 to <4 x i32>*
%42 = load <4 x i32>, <4 x i32>* %41
%43 = add nsw <4 x i32> %42, <i32 0, i32 1, i32 2, i32 3>
%44 = bitcast [64 x i32]* %1 to <4 x i32>*
store <4 x i32> %43, <4 x i32>* %44
%45 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 4
%46 = bitcast i32* %45 to <4 x i32>*
%47 = load <4 x i32>, <4 x i32>* %46
%48 = add nsw <4 x i32> %47, <i32 4, i32 5, i32 6, i32 7>
%49 = bitcast i32* %45 to <4 x i32>*
store <4 x i32> %48, <4 x i32>* %49
%50 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 8
%51 = bitcast i32* %50 to <4 x i32>*
%52 = load <4 x i32>, <4 x i32>* %51
%53 = add nsw <4 x i32> %52, <i32 8, i32 9, i32 10, i32 11>
%54 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> %53, <4 x i32>* %54
%55 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 12
%56 = bitcast i32* %55 to <4 x i32>*
%57 = load <4 x i32>, <4 x i32>* %56
%58 = add nsw <4 x i32> %57, <i32 12, i32 13, i32 14, i32 15>
%59 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> %58, <4 x i32>* %59
%60 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 16
%61 = bitcast i32* %60 to <4 x i32>*
%62 = load <4 x i32>, <4 x i32>* %61
%63 = add nsw <4 x i32> %62, <i32 16, i32 17, i32 18, i32 19>
%64 = bitcast i32* %60 to <4 x i32>*
store <4 x i32> %63, <4 x i32>* %64
%65 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 20
%66 = bitcast i32* %65 to <4 x i32>*
%67 = load <4 x i32>, <4 x i32>* %66
%68 = add nsw <4 x i32> %67, <i32 20, i32 21, i32 22, i32 23>
%69 = bitcast i32* %65 to <4 x i32>*
store <4 x i32> %68, <4 x i32>* %69
%70 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 24
%71 = bitcast i32* %70 to <4 x i32>*
%72 = load <4 x i32>, <4 x i32>* %71
%73 = add nsw <4 x i32> %72, <i32 24, i32 25, i32 26, i32 27>
%74 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> %73, <4 x i32>* %74
%75 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 28
%76 = bitcast i32* %75 to <4 x i32>*
%77 = load <4 x i32>, <4 x i32>* %76
%78 = add nsw <4 x i32> %77, <i32 28, i32 29, i32 30, i32 31>
%79 = bitcast i32* %75 to <4 x i32>*
store <4 x i32> %78, <4 x i32>* %79
%80 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 32
%81 = bitcast i32* %80 to <4 x i32>*
%82 = load <4 x i32>, <4 x i32>* %81
%83 = add nsw <4 x i32> %82, <i32 32, i32 33, i32 34, i32 35>
%84 = bitcast i32* %80 to <4 x i32>*
store <4 x i32> %83, <4 x i32>* %84
%85 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 36
%86 = bitcast i32* %85 to <4 x i32>*
%87 = load <4 x i32>, <4 x i32>* %86
%88 = add nsw <4 x i32> %87, <i32 36, i32 37, i32 38, i32 39>
%89 = bitcast i32* %85 to <4 x i32>*
store <4 x i32> %88, <4 x i32>* %89
%90 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 40
%91 = bitcast i32* %90 to <4 x i32>*
%92 = load <4 x i32>, <4 x i32>* %91
%93 = add nsw <4 x i32> %92, <i32 40, i32 41, i32 42, i32 43>
%94 = bitcast i32* %90 to <4 x i32>*
store <4 x i32> %93, <4 x i32>* %94
%95 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 44
%96 = bitcast i32* %95 to <4 x i32>*
%97 = load <4 x i32>, <4 x i32>* %96
%98 = add nsw <4 x i32> %97, <i32 44, i32 45, i32 46, i32 47>
%99 = bitcast i32* %95 to <4 x i32>*
store <4 x i32> %98, <4 x i32>* %99
%100 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 48
%101 = bitcast i32* %100 to <4 x i32>*
%102 = load <4 x i32>, <4 x i32>* %101
%103 = add nsw <4 x i32> %102, <i32 48, i32 49, i32 50, i32 51>
%104 = bitcast i32* %100 to <4 x i32>*
store <4 x i32> %103, <4 x i32>* %104
%105 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 52
%106 = bitcast i32* %105 to <4 x i32>*
%107 = load <4 x i32>, <4 x i32>* %106
%108 = add nsw <4 x i32> %107, <i32 52, i32 53, i32 54, i32 55>
%109 = bitcast i32* %105 to <4 x i32>*
store <4 x i32> %108, <4 x i32>* %109
%110 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 56
%111 = bitcast i32* %110 to <4 x i32>*
%112 = load <4 x i32>, <4 x i32>* %111
%113 = add nsw <4 x i32> %112, <i32 56, i32 57, i32 58, i32 59>
%114 = bitcast i32* %110 to <4 x i32>*
store <4 x i32> %113, <4 x i32>* %114
%115 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 60
%116 = bitcast i32* %115 to <4 x i32>*
%117 = load <4 x i32>, <4 x i32>* %116
%118 = add nsw <4 x i32> %117, <i32 60, i32 61, i32 62, i32 63>
%119 = bitcast i32* %115 to <4 x i32>*
store <4 x i32> %118, <4 x i32>* %119
%120 = tail call i64 (...) @omp_get_cancellation()
%121 = icmp eq i64 %120, 0
br i1 %121, label %124, label %122
122: ; preds = %39
%123 = tail call i32 (...) @abort()
unreachable
124: ; preds = %39
ret i32 0
}