#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*/ bar();
void foo() {
#pragma omp metadirective when(implementation = {vendor(score(0)               \
                                                        : llvm)},              \
                               device = {kind(cpu)}                            \
                               : parallel) default(target teams)
  bar();
#pragma omp metadirective when(device = {kind(gpu)}                            \
                               : target teams)                                 \
    when(implementation = {vendor(llvm)}                                       \
         : parallel) default()
  bar();
#pragma omp metadirective default(target)                                      \
    when(implementation = {vendor(score(5)                                     \
                                  : llvm)},                                    \
         device = {kind(cpu, host)}                                            \
         : parallel)
  bar();
#pragma omp metadirective when(implementation = {extension(match_all)}         \
                               : parallel) default(parallel for)
  for (int i = 0; i < 100; i++)
    ;
#pragma omp metadirective when(implementation = {extension(match_any)}         \
                               : parallel) default(parallel for)
  for (int i = 0; i < 100; i++)
    ;
#pragma omp metadirective when(implementation = {extension(match_none)}        \
                               : parallel) default(parallel for)
  for (int i = 0; i < 100; i++)
    ;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <bar@plt>
mov    $0x0,%al
call   1030 <bar@plt>
mov    $0x0,%al
call   1030 <bar@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1151 <foo+0x41>
jmp    1143 <foo+0x33>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1134 <foo+0x24>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1175 <foo+0x65>
jmp    1167 <foo+0x57>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <foo+0x48>
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    1199 <foo+0x89>
jmp    118b <foo+0x7b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117c <foo+0x6c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @bar()
%5 = call i32 (...) @bar()
%6 = call i32 (...) @bar()
store i32 0, i32* %1
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %14
10: ; preds = %7
br label %11
11: ; preds = %10
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %7
14: ; preds = %7
store i32 0, i32* %2
br label %15
15: ; preds = %19, %14
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 100
br i1 %17, label %18, label %22
18: ; preds = %15
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %15
22: ; preds = %15
store i32 0, i32* %3
br label %23
23: ; preds = %27, %22
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 100
br i1 %25, label %26, label %30
26: ; preds = %23
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %23
30: ; preds = %23
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @bar()
%3 = tail call i32 (...) @bar()
ret void
}