#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*/ assert(int);
float bar(float, float);
float fabs(float);
int foo_char();
int foo_int();
int foo_short();
int foo_uchar();
int main(void) {
  int v = 0;
  float v2 = 0.0f;
#pragma omp target map(to : v)
  v = foo_char();
  assert(v == 123);
#pragma omp target map(to : v)
  v = foo_uchar();
  assert(v == 123);
#pragma omp target map(to : v)
  v = foo_short();
  assert(v == 123);
#pragma omp target map(to : v)
  v = foo_int();
  assert(v == 123);
#pragma omp target map(to : v2)
  v2 = bar(1.12f, 4.44f);
  assert(fabs(v2 - 14.12) < 0.0001f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1090 <foo_char@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x7b,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    $0x0,%al
call   1040 <foo_uchar@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x7b,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    $0x0,%al
call   1080 <foo_short@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x7b,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    $0x0,%al
call   1030 <foo_int@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x7b,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movss  0xe09(%rip),%xmm0
movss  0xe05(%rip),%xmm1
call   1050 <bar@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf2(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <fabs@plt>
movaps %xmm0,%xmm1
movss  0xdca(%rip),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <foo_char@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1060 <assert@plt>
xor    %eax,%eax
call   1040 <foo_uchar@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1060 <assert@plt>
xor    %eax,%eax
call   1070 <foo_short@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1060 <assert@plt>
xor    %eax,%eax
call   1030 <foo_int@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1060 <assert@plt>
movss  0xe43(%rip),%xmm0
movss  0xe3f(%rip),%xmm1
call   1050 <bar@plt>
cvtss2sd %xmm0,%xmm0
addsd  0xe3a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
andps  0xe3f(%rip),%xmm0
movss  0xe1f(%rip),%xmm1
xor    %edi,%edi
ucomiss %xmm0,%xmm1
seta   %dil
call   1060 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
%3 = call i32 (...) @foo_char()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 123
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 (...) @foo_uchar()
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 123
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 (...) @foo_short()
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 123
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 (...) @foo_int()
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 123
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call float @bar(float 0x3FF1EB8520000000, float 0x4011C28F60000000)
store float %23, float* %2
%24 = load float, float* %2
%25 = fpext float %24 to double
%26 = fsub double %25, 1.412000e+01
%27 = fptrunc double %26 to float
%28 = call float @fabs(float %27)
%29 = fcmp olt float %28, 0x3F1A36E2E0000000
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo_char()
%2 = icmp eq i32 %1, 123
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (...) @foo_uchar()
%6 = icmp eq i32 %5, 123
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 (...) @foo_short()
%10 = icmp eq i32 %9, 123
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 (...) @foo_int()
%14 = icmp eq i32 %13, 123
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call float @bar(float 0x3FF1EB8520000000, float 0x4011C28F60000000)
%18 = fpext float %17 to double
%19 = fadd double %18, -1.412000e+01
%20 = fptrunc double %19 to float
%21 = tail call float @llvm.fabs.f32(float %20)
%22 = fcmp olt float %21, 0x3F1A36E2E0000000
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
ret i32 0
}