#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 omp_get_default_device();
scalar_t__ omp_get_level();
int omp_get_num_devices();
int /*<<< orphan*/ omp_is_initial_device();
void foo(int f) {
  int d = f ? omp_get_num_devices() : omp_get_default_device();
  int h = 5;
#pragma omp target device(d)
  if (omp_get_level() != 0)
    abort();
#pragma omp target if (v > 1)
  if (omp_get_level() != 0 || !omp_is_initial_device())
    abort();
#pragma omp target device(d) if (v > 1)
  if (omp_get_level() != 0 || !omp_is_initial_device())
    abort();
#pragma omp target if (v <= 1)
  if (omp_get_level() != 0)
    abort();
#pragma omp target device(d) if (v <= 1)
  if (omp_get_level() != 0 || (f && !omp_is_initial_device()))
    abort();
#pragma omp target if (0)
  if (omp_get_level() != 0 || !omp_is_initial_device())
    abort();
#pragma omp target device(d) if (0)
  if (omp_get_level() != 0 || !omp_is_initial_device())
    abort();
#pragma omp target if (1)
  if (omp_get_level() != 0)
    abort();
#pragma omp target device(d) if (1)
  if (omp_get_level() != 0 || (f && !omp_is_initial_device()))
    abort();
#pragma omp target data device(d) map(to : h)
  {
#pragma omp target device(d) map(h)
    if (omp_get_level() != 0 || (f && !omp_is_initial_device()) || h++ != 5)
      abort();
#pragma omp target update device(d) from(h)
  }
#pragma omp target data if (v > 1) map(to : h)
  {
#pragma omp target if (v > 1) map(h)
    if (omp_get_level() != 0 || !omp_is_initial_device() || h++ != 6)
      abort();
#pragma omp target update if (v > 1) from(h)
  }
#pragma omp target data device(d) if (v > 1) map(to : h)
  {
#pragma omp target device(d) if (v > 1) map(h)
    if (omp_get_level() != 0 || !omp_is_initial_device() || h++ != 7)
      abort();
#pragma omp target update device(d) if (v > 1) from(h)
  }
#pragma omp target data if (v <= 1) map(to : h)
  {
#pragma omp target if (v <= 1) map(tofrom : h)
    if (omp_get_level() != 0 || h++ != 8)
      abort();
#pragma omp target update if (v <= 1) from(h)
  }
#pragma omp target data device(d) if (v <= 1) map(to : h)
  {
#pragma omp target device(d) if (v <= 1) map(h)
    if (omp_get_level() != 0 || (f && !omp_is_initial_device()) || h++ != 9)
      abort();
#pragma omp target update device(d) if (v <= 1) from(h)
  }
#pragma omp target data if (0) map(to : h)
  {
#pragma omp target if (0) map(h)
    if (omp_get_level() != 0 || !omp_is_initial_device() || h++ != 10)
      abort();
#pragma omp target update if (0) from(h)
  }
#pragma omp target data device(d) if (0) map(to : h)
  {
#pragma omp target device(d) if (0) map(h)
    if (omp_get_level() != 0 || !omp_is_initial_device() || h++ != 11)
      abort();
#pragma omp target update device(d) if (0) from(h)
  }
#pragma omp target data if (1) map(to : h)
  {
#pragma omp target if (1) map(tofrom : h)
    if (omp_get_level() != 0 || h++ != 12)
      abort();
#pragma omp target update if (1) from(h)
  }
#pragma omp target data device(d) if (1) map(to : h)
  {
#pragma omp target device(d) if (1) map(tofrom : h)
    if (omp_get_level() != 0 || (f && !omp_is_initial_device()) || h++ != 13)
      abort();
#pragma omp target update device(d) if (1) from(h)
  }
  if (h != 14)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1174 <foo+0x24>
mov    $0x0,%al
call   1060 <omp_get_num_devices@plt>
mov    %eax,-0x10(%rbp)
jmp    117e <foo+0x2e>
mov    $0x0,%al
call   1040 <omp_get_default_device@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
je     11a3 <foo+0x53>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    11c4 <foo+0x74>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
jne    11cb <foo+0x7b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    11ec <foo+0x9c>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
jne    11f3 <foo+0xa3>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
je     120b <foo+0xbb>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    1236 <foo+0xe6>
cmpl   $0x0,-0x4(%rbp)
je     123d <foo+0xed>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
jne    123d <foo+0xed>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    125e <foo+0x10e>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
jne    1265 <foo+0x115>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    1286 <foo+0x136>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
jne    128d <foo+0x13d>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
je     12a5 <foo+0x155>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    12d0 <foo+0x180>
cmpl   $0x0,-0x4(%rbp)
je     12d7 <foo+0x187>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
jne    12d7 <foo+0x187>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    1316 <foo+0x1c6>
cmpl   $0x0,-0x4(%rbp)
je     1302 <foo+0x1b2>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     1316 <foo+0x1c6>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x5,%eax
je     131d <foo+0x1cd>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    1352 <foo+0x202>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     1352 <foo+0x202>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x6,%eax
je     1359 <foo+0x209>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    138e <foo+0x23e>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     138e <foo+0x23e>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x7,%eax
je     1395 <foo+0x245>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    13ba <foo+0x26a>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x8,%eax
je     13c1 <foo+0x271>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    1400 <foo+0x2b0>
cmpl   $0x0,-0x4(%rbp)
je     13ec <foo+0x29c>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     1400 <foo+0x2b0>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x9,%eax
je     1407 <foo+0x2b7>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    143c <foo+0x2ec>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     143c <foo+0x2ec>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0xa,%eax
je     1443 <foo+0x2f3>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    1478 <foo+0x328>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     1478 <foo+0x328>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0xb,%eax
je     147f <foo+0x32f>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    14a4 <foo+0x354>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0xc,%eax
je     14ab <foo+0x35b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1050 <omp_get_level@plt>
cmp    $0x0,%rax
jne    14ea <foo+0x39a>
cmpl   $0x0,-0x4(%rbp)
je     14d6 <foo+0x386>
mov    $0x0,%al
call   1070 <omp_is_initial_device@plt>
cmp    $0x0,%eax
je     14ea <foo+0x39a>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0xd,%eax
je     14f1 <foo+0x3a1>
mov    $0x0,%al
call   1030 <abort@plt>
cmpl   $0xe,-0xc(%rbp)
je     1502 <foo+0x3b2>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
test   %edi,%edi
je     1160 <foo+0x10>
call   1060 <omp_get_num_devices@plt>
jmp    1165 <foo+0x15>
call   1040 <omp_get_default_device@plt>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
test   %ebx,%ebx
je     11e6 <foo+0x96>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
test   %ebx,%ebx
je     1277 <foo+0x127>
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
jne    1285 <foo+0x135>
jmp    133d <foo+0x1ed>
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
test   %ebx,%ebx
je     12e6 <foo+0x196>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
xor    %eax,%eax
call   1050 <omp_get_level@plt>
test   %rax,%rax
jne    133d <foo+0x1ed>
test   %ebx,%ebx
je     133b <foo+0x1eb>
xor    %eax,%eax
call   1070 <omp_is_initial_device@plt>
test   %eax,%eax
je     133d <foo+0x1ed>
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @omp_get_num_devices()
br label %11
9: ; preds = %1
%10 = call i32 (...) @omp_get_default_device()
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
store i32 %12, i32* %3
store i32 5, i32* %4
%13 = call i64 (...) @omp_get_level()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %11
%18 = call i64 (...) @omp_get_level()
%19 = icmp ne i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = call i32 (...) @omp_is_initial_device()
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20, %17
%24 = call i32 (...) @abort()
unreachable
25: ; preds = %20
%26 = call i64 (...) @omp_get_level()
%27 = icmp ne i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = call i32 (...) @omp_is_initial_device()
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28, %25
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %28
%34 = call i64 (...) @omp_get_level()
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 (...) @abort()
unreachable
38: ; preds = %33
%39 = call i64 (...) @omp_get_level()
%40 = icmp ne i64 %39, 0
br i1 %40, label %47, label %41
41: ; preds = %38
%42 = load i32, i32* %2
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = call i32 (...) @omp_is_initial_device()
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44, %38
%48 = call i32 (...) @abort()
unreachable
49: ; preds = %44, %41
%50 = call i64 (...) @omp_get_level()
%51 = icmp ne i64 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = call i32 (...) @omp_is_initial_device()
%54 = icmp ne i32 %53, 0
br i1 %54, label %57, label %55
55: ; preds = %52, %49
%56 = call i32 (...) @abort()
unreachable
57: ; preds = %52
%58 = call i64 (...) @omp_get_level()
%59 = icmp ne i64 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = call i32 (...) @omp_is_initial_device()
%62 = icmp ne i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %60, %57
%64 = call i32 (...) @abort()
unreachable
65: ; preds = %60
%66 = call i64 (...) @omp_get_level()
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 (...) @abort()
unreachable
70: ; preds = %65
%71 = call i64 (...) @omp_get_level()
%72 = icmp ne i64 %71, 0
br i1 %72, label %79, label %73
73: ; preds = %70
%74 = load i32, i32* %2
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %73
%77 = call i32 (...) @omp_is_initial_device()
%78 = icmp ne i32 %77, 0
br i1 %78, label %81, label %79
79: ; preds = %76, %70
%80 = call i32 (...) @abort()
unreachable
81: ; preds = %76, %73
%82 = call i64 (...) @omp_get_level()
%83 = icmp ne i64 %82, 0
br i1 %83, label %94, label %84
84: ; preds = %81
%85 = load i32, i32* %2
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = call i32 (...) @omp_is_initial_device()
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %87, %84
%91 = load i32, i32* %4
%92 = add nsw i32 %91, 1
store i32 %92, i32* %4
%93 = icmp ne i32 %91, 5
br i1 %93, label %94, label %96
94: ; preds = %90, %87, %81
%95 = call i32 (...) @abort()
unreachable
96: ; preds = %90
%97 = call i64 (...) @omp_get_level()
%98 = icmp ne i64 %97, 0
br i1 %98, label %106, label %99
99: ; preds = %96
%100 = call i32 (...) @omp_is_initial_device()
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %106
102: ; preds = %99
%103 = load i32, i32* %4
%104 = add nsw i32 %103, 1
store i32 %104, i32* %4
%105 = icmp ne i32 %103, 6
br i1 %105, label %106, label %108
106: ; preds = %102, %99, %96
%107 = call i32 (...) @abort()
unreachable
108: ; preds = %102
%109 = call i64 (...) @omp_get_level()
%110 = icmp ne i64 %109, 0
br i1 %110, label %118, label %111
111: ; preds = %108
%112 = call i32 (...) @omp_is_initial_device()
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %118
114: ; preds = %111
%115 = load i32, i32* %4
%116 = add nsw i32 %115, 1
store i32 %116, i32* %4
%117 = icmp ne i32 %115, 7
br i1 %117, label %118, label %120
118: ; preds = %114, %111, %108
%119 = call i32 (...) @abort()
unreachable
120: ; preds = %114
%121 = call i64 (...) @omp_get_level()
%122 = icmp ne i64 %121, 0
br i1 %122, label %127, label %123
123: ; preds = %120
%124 = load i32, i32* %4
%125 = add nsw i32 %124, 1
store i32 %125, i32* %4
%126 = icmp ne i32 %124, 8
br i1 %126, label %127, label %129
127: ; preds = %123, %120
%128 = call i32 (...) @abort()
unreachable
129: ; preds = %123
%130 = call i64 (...) @omp_get_level()
%131 = icmp ne i64 %130, 0
br i1 %131, label %142, label %132
132: ; preds = %129
%133 = load i32, i32* %2
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %138
135: ; preds = %132
%136 = call i32 (...) @omp_is_initial_device()
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %142
138: ; preds = %135, %132
%139 = load i32, i32* %4
%140 = add nsw i32 %139, 1
store i32 %140, i32* %4
%141 = icmp ne i32 %139, 9
br i1 %141, label %142, label %144
142: ; preds = %138, %135, %129
%143 = call i32 (...) @abort()
unreachable
144: ; preds = %138
%145 = call i64 (...) @omp_get_level()
%146 = icmp ne i64 %145, 0
br i1 %146, label %154, label %147
147: ; preds = %144
%148 = call i32 (...) @omp_is_initial_device()
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %154
150: ; preds = %147
%151 = load i32, i32* %4
%152 = add nsw i32 %151, 1
store i32 %152, i32* %4
%153 = icmp ne i32 %151, 10
br i1 %153, label %154, label %156
154: ; preds = %150, %147, %144
%155 = call i32 (...) @abort()
unreachable
156: ; preds = %150
%157 = call i64 (...) @omp_get_level()
%158 = icmp ne i64 %157, 0
br i1 %158, label %166, label %159
159: ; preds = %156
%160 = call i32 (...) @omp_is_initial_device()
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %166
162: ; preds = %159
%163 = load i32, i32* %4
%164 = add nsw i32 %163, 1
store i32 %164, i32* %4
%165 = icmp ne i32 %163, 11
br i1 %165, label %166, label %168
166: ; preds = %162, %159, %156
%167 = call i32 (...) @abort()
unreachable
168: ; preds = %162
%169 = call i64 (...) @omp_get_level()
%170 = icmp ne i64 %169, 0
br i1 %170, label %175, label %171
171: ; preds = %168
%172 = load i32, i32* %4
%173 = add nsw i32 %172, 1
store i32 %173, i32* %4
%174 = icmp ne i32 %172, 12
br i1 %174, label %175, label %177
175: ; preds = %171, %168
%176 = call i32 (...) @abort()
unreachable
177: ; preds = %171
%178 = call i64 (...) @omp_get_level()
%179 = icmp ne i64 %178, 0
br i1 %179, label %190, label %180
180: ; preds = %177
%181 = load i32, i32* %2
%182 = icmp ne i32 %181, 0
br i1 %182, label %183, label %186
183: ; preds = %180
%184 = call i32 (...) @omp_is_initial_device()
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %190
186: ; preds = %183, %180
%187 = load i32, i32* %4
%188 = add nsw i32 %187, 1
store i32 %188, i32* %4
%189 = icmp ne i32 %187, 13
br i1 %189, label %190, label %192
190: ; preds = %186, %183, %177
%191 = call i32 (...) @abort()
unreachable
192: ; preds = %186
%193 = load i32, i32* %4
%194 = icmp ne i32 %193, 14
br i1 %194, label %195, label %197
195: ; preds = %192
%196 = call i32 (...) @abort()
unreachable
197: ; preds = %192
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @omp_get_num_devices()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @omp_get_default_device()
br label %7
7: ; preds = %5, %3
%8 = tail call i64 (...) @omp_get_level()
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %7
%13 = tail call i64 (...) @omp_get_level()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = tail call i32 (...) @omp_is_initial_device()
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15, %12
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %15
%21 = tail call i64 (...) @omp_get_level()
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = tail call i32 (...) @omp_is_initial_device()
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23, %20
%27 = tail call i32 (...) @abort()
unreachable
28: ; preds = %23
%29 = tail call i64 (...) @omp_get_level()
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 (...) @abort()
unreachable
33: ; preds = %28
%34 = tail call i64 (...) @omp_get_level()
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %33
br i1 %2, label %42, label %37
37: ; preds = %36
%38 = tail call i32 (...) @omp_is_initial_device()
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37, %33
%41 = tail call i32 (...) @abort()
unreachable
42: ; preds = %37, %36
%43 = tail call i64 (...) @omp_get_level()
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = tail call i32 (...) @omp_is_initial_device()
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45, %42
%49 = tail call i32 (...) @abort()
unreachable
50: ; preds = %45
%51 = tail call i64 (...) @omp_get_level()
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = tail call i32 (...) @omp_is_initial_device()
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53, %50
%57 = tail call i32 (...) @abort()
unreachable
58: ; preds = %53
%59 = tail call i64 (...) @omp_get_level()
%60 = icmp eq i64 %59, 0
br i1 %60, label %63, label %61
61: ; preds = %58
%62 = tail call i32 (...) @abort()
unreachable
63: ; preds = %58
%64 = tail call i64 (...) @omp_get_level()
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %63
br i1 %2, label %72, label %67
67: ; preds = %66
%68 = tail call i32 (...) @omp_is_initial_device()
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %67, %63
%71 = tail call i32 (...) @abort()
unreachable
72: ; preds = %66
%73 = tail call i64 (...) @omp_get_level()
%74 = icmp eq i64 %73, 0
br i1 %74, label %83, label %81
75: ; preds = %67
%76 = tail call i64 (...) @omp_get_level()
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = tail call i32 (...) @omp_is_initial_device()
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %75, %78, %72
%82 = tail call i32 (...) @abort()
unreachable
83: ; preds = %72, %78
%84 = tail call i64 (...) @omp_get_level()
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = tail call i32 (...) @omp_is_initial_device()
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %86, %83
%90 = tail call i32 (...) @abort()
unreachable
91: ; preds = %86
%92 = tail call i64 (...) @omp_get_level()
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %91
%95 = tail call i32 (...) @omp_is_initial_device()
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %94, %91
%98 = tail call i32 (...) @abort()
unreachable
99: ; preds = %94
%100 = tail call i64 (...) @omp_get_level()
%101 = icmp eq i64 %100, 0
br i1 %101, label %104, label %102
102: ; preds = %99
%103 = tail call i32 (...) @abort()
unreachable
104: ; preds = %99
%105 = tail call i64 (...) @omp_get_level()
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %104
br i1 %2, label %113, label %108
108: ; preds = %107
%109 = tail call i32 (...) @omp_is_initial_device()
%110 = icmp eq i32 %109, 0
br i1 %110, label %111, label %113
111: ; preds = %108, %104
%112 = tail call i32 (...) @abort()
unreachable
113: ; preds = %107, %108
%114 = tail call i64 (...) @omp_get_level()
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %119
116: ; preds = %113
%117 = tail call i32 (...) @omp_is_initial_device()
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %116, %113
%120 = tail call i32 (...) @abort()
unreachable
121: ; preds = %116
%122 = tail call i64 (...) @omp_get_level()
%123 = icmp eq i64 %122, 0
br i1 %123, label %124, label %127
124: ; preds = %121
%125 = tail call i32 (...) @omp_is_initial_device()
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %129
127: ; preds = %124, %121
%128 = tail call i32 (...) @abort()
unreachable
129: ; preds = %124
%130 = tail call i64 (...) @omp_get_level()
%131 = icmp eq i64 %130, 0
br i1 %131, label %134, label %132
132: ; preds = %129
%133 = tail call i32 (...) @abort()
unreachable
134: ; preds = %129
%135 = tail call i64 (...) @omp_get_level()
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %141
137: ; preds = %134
br i1 %2, label %143, label %138
138: ; preds = %137
%139 = tail call i32 (...) @omp_is_initial_device()
%140 = icmp eq i32 %139, 0
br i1 %140, label %141, label %143
141: ; preds = %138, %134
%142 = tail call i32 (...) @abort()
unreachable
143: ; preds = %138, %137
ret void
}