#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(int);
int /*<<< orphan*/ bar2(int, long *, long *);
void foo(int a, int b, long c, long d) {
#pragma omp target
  bar(0);
#pragma omp target
#pragma omp teams
  bar(1);
#pragma omp target teams
  bar(2);
#pragma omp target
#pragma omp teams num_teams(4)
  bar(3);
#pragma omp target teams num_teams(4)
  bar(4);
#pragma omp target
#pragma omp teams thread_limit(7)
  bar(5);
#pragma omp target teams thread_limit(7)
  bar(6);
#pragma omp target
#pragma omp teams num_teams(4) thread_limit(8)
  {
    { bar(7); }
  }
#pragma omp target teams num_teams(4) thread_limit(8)
  bar(8);
#pragma omp target
#pragma omp teams num_teams(a) thread_limit(b)
  bar(9);
#pragma omp target teams num_teams(a) thread_limit(b)
  bar(10);
#pragma omp target
#pragma omp teams num_teams(c + 1) thread_limit(d - 1)
  bar(11);
#pragma omp target teams num_teams(c + 1) thread_limit(d - 1)
  bar(12);
#pragma omp target map(always, to : c, d)
#pragma omp teams num_teams(c + 1) thread_limit(d - 1)
  bar(13);
#pragma omp target data map(to : c, d)
  {
#pragma omp target defaultmap(tofrom : scalar)
    bar2(14, &c, &d);
#pragma omp target map(to : c, d)
#pragma omp teams num_teams(c + 1) thread_limit(d - 1)
    bar(15);
  }
#pragma omp target
#pragma omp teams num_teams(baz() + 1) thread_limit(baz() - 1)
  bar(16);
#pragma omp target teams num_teams(baz() + 1) thread_limit(baz() - 1)
  bar(17);
#pragma omp target
#pragma omp teams num_teams(v + 1) thread_limit(v - 1)
  bar(18);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
xor    %edi,%edi
call   1040 <bar@plt>
mov    $0x1,%edi
call   1040 <bar@plt>
mov    $0x2,%edi
call   1040 <bar@plt>
mov    $0x3,%edi
call   1040 <bar@plt>
mov    $0x4,%edi
call   1040 <bar@plt>
mov    $0x5,%edi
call   1040 <bar@plt>
mov    $0x6,%edi
call   1040 <bar@plt>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    $0x8,%edi
call   1040 <bar@plt>
mov    $0x9,%edi
call   1040 <bar@plt>
mov    $0xa,%edi
call   1040 <bar@plt>
mov    $0xb,%edi
call   1040 <bar@plt>
mov    $0xc,%edi
call   1040 <bar@plt>
mov    $0xd,%edi
call   1040 <bar@plt>
mov    $0xe,%edi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <bar2@plt>
mov    $0xf,%edi
call   1040 <bar@plt>
mov    $0x10,%edi
call   1040 <bar@plt>
mov    $0x11,%edi
call   1040 <bar@plt>
mov    $0x12,%edi
call   1040 <bar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
mov    %rcx,0x8(%rsp)
xor    %edi,%edi
call   1040 <bar@plt>
mov    $0x1,%edi
call   1040 <bar@plt>
mov    $0x2,%edi
call   1040 <bar@plt>
mov    $0x3,%edi
call   1040 <bar@plt>
mov    $0x4,%edi
call   1040 <bar@plt>
mov    $0x5,%edi
call   1040 <bar@plt>
mov    $0x6,%edi
call   1040 <bar@plt>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    $0x8,%edi
call   1040 <bar@plt>
mov    $0x9,%edi
call   1040 <bar@plt>
mov    $0xa,%edi
call   1040 <bar@plt>
mov    $0xb,%edi
call   1040 <bar@plt>
mov    $0xc,%edi
call   1040 <bar@plt>
mov    $0xd,%edi
call   1040 <bar@plt>
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    $0xe,%edi
call   1030 <bar2@plt>
mov    $0xf,%edi
call   1040 <bar@plt>
mov    $0x10,%edi
call   1040 <bar@plt>
mov    $0x11,%edi
call   1040 <bar@plt>
mov    $0x12,%edi
call   1040 <bar@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @foo(i32 %0, i32 %1, i64 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = call i32 @bar(i32 0)
%10 = call i32 @bar(i32 1)
%11 = call i32 @bar(i32 2)
%12 = call i32 @bar(i32 3)
%13 = call i32 @bar(i32 4)
%14 = call i32 @bar(i32 5)
%15 = call i32 @bar(i32 6)
%16 = call i32 @bar(i32 7)
%17 = call i32 @bar(i32 8)
%18 = call i32 @bar(i32 9)
%19 = call i32 @bar(i32 10)
%20 = call i32 @bar(i32 11)
%21 = call i32 @bar(i32 12)
%22 = call i32 @bar(i32 13)
%23 = call i32 @bar2(i32 14, i64* %7, i64* %8)
%24 = call i32 @bar(i32 15)
%25 = call i32 @bar(i32 16)
%26 = call i32 @bar(i32 17)
%27 = call i32 @bar(i32 18)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
store i64 %2, i64* %5
store i64 %3, i64* %6
%7 = tail call i32 @bar(i32 0)
%8 = tail call i32 @bar(i32 1)
%9 = tail call i32 @bar(i32 2)
%10 = tail call i32 @bar(i32 3)
%11 = tail call i32 @bar(i32 4)
%12 = tail call i32 @bar(i32 5)
%13 = tail call i32 @bar(i32 6)
%14 = tail call i32 @bar(i32 7)
%15 = tail call i32 @bar(i32 8)
%16 = tail call i32 @bar(i32 9)
%17 = tail call i32 @bar(i32 10)
%18 = tail call i32 @bar(i32 11)
%19 = tail call i32 @bar(i32 12)
%20 = tail call i32 @bar(i32 13)
%21 = call i32 @bar2(i32 14, i64* %5, i64* %6)
%22 = call i32 @bar(i32 15)
%23 = call i32 @bar(i32 16)
%24 = call i32 @bar(i32 17)
%25 = call i32 @bar(i32 18)
ret void
}