#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*/ __nvvm_bar0();
double __nvvm_fmax_d(double, double);
float __nvvm_fmax_f(float, float);
double __nvvm_fmin_d(double, double);
float __nvvm_fmin_f(float, float);
int /*<<< orphan*/ __nvvm_membar_cta();
int /*<<< orphan*/ __nvvm_membar_gl();
int /*<<< orphan*/ __nvvm_membar_sys();
double __nvvm_rcp_rn_d(double);
float __nvvm_rcp_rn_f(float);
double __nvvm_sqrt_rn_d(double);
float __nvvm_sqrt_rn_f(float);
void nvvm_math(float f1, float f2, double d1, double d2) {
  float t1 = __nvvm_fmax_f(f1, f2);
  float t2 = __nvvm_fmin_f(f1, f2);
  float t3 = __nvvm_sqrt_rn_f(f1);
  float t4 = __nvvm_rcp_rn_f(f2);
  double td1 = __nvvm_fmax_d(d1, d2);
  double td2 = __nvvm_fmin_d(d1, d2);
  double td3 = __nvvm_sqrt_rn_d(d1);
  double td4 = __nvvm_rcp_rn_d(d2);
  __nvvm_membar_cta();
  __nvvm_membar_gl();
  __nvvm_membar_sys();
  __nvvm_bar0();
}


x86 assembly (clang, -O0):
<nvvm_math>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movsd  %xmm2,-0x10(%rbp)
movsd  %xmm3,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1070 <__nvvm_fmax_f@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <__nvvm_fmin_f@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <__nvvm_sqrt_rn_f@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
call   10d0 <__nvvm_rcp_rn_f@plt>
movss  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   10a0 <__nvvm_fmax_d@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <__nvvm_fmin_d@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <__nvvm_sqrt_rn_d@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   10c0 <__nvvm_rcp_rn_d@plt>
movsd  %xmm0,-0x48(%rbp)
mov    $0x0,%al
call   1080 <__nvvm_membar_cta@plt>
mov    $0x0,%al
call   1090 <__nvvm_membar_gl@plt>
mov    $0x0,%al
call   10b0 <__nvvm_membar_sys@plt>
mov    $0x0,%al
call   10e0 <__nvvm_bar0@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvvm_math>:
sub    $0x18,%rsp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
call   1070 <__nvvm_fmax_f@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
call   1030 <__nvvm_fmin_f@plt>
movss  (%rsp),%xmm0
call   1050 <__nvvm_sqrt_rn_f@plt>
movss  0x4(%rsp),%xmm0
call   10d0 <__nvvm_rcp_rn_f@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   10a0 <__nvvm_fmax_d@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <__nvvm_fmin_d@plt>
movsd  0x8(%rsp),%xmm0
call   1060 <__nvvm_sqrt_rn_d@plt>
movsd  0x10(%rsp),%xmm0
call   10c0 <__nvvm_rcp_rn_d@plt>
xor    %eax,%eax
call   1080 <__nvvm_membar_cta@plt>
xor    %eax,%eax
call   1090 <__nvvm_membar_gl@plt>
xor    %eax,%eax
call   10b0 <__nvvm_membar_sys@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    10e0 <__nvvm_bar0@plt>

LLVM IR (-O0):
define void @nvvm_math(float %0, float %1, double %2, double %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca double
%8 = alloca double
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store float %0, float* %5
store float %1, float* %6
store double %2, double* %7
store double %3, double* %8
%17 = load float, float* %5
%18 = load float, float* %6
%19 = call float @__nvvm_fmax_f(float %17, float %18)
store float %19, float* %9
%20 = load float, float* %5
%21 = load float, float* %6
%22 = call float @__nvvm_fmin_f(float %20, float %21)
store float %22, float* %10
%23 = load float, float* %5
%24 = call float @__nvvm_sqrt_rn_f(float %23)
store float %24, float* %11
%25 = load float, float* %6
%26 = call float @__nvvm_rcp_rn_f(float %25)
store float %26, float* %12
%27 = load double, double* %7
%28 = load double, double* %8
%29 = call double @__nvvm_fmax_d(double %27, double %28)
store double %29, double* %13
%30 = load double, double* %7
%31 = load double, double* %8
%32 = call double @__nvvm_fmin_d(double %30, double %31)
store double %32, double* %14
%33 = load double, double* %7
%34 = call double @__nvvm_sqrt_rn_d(double %33)
store double %34, double* %15
%35 = load double, double* %8
%36 = call double @__nvvm_rcp_rn_d(double %35)
store double %36, double* %16
%37 = call i32 (...) @__nvvm_membar_cta()
%38 = call i32 (...) @__nvvm_membar_gl()
%39 = call i32 (...) @__nvvm_membar_sys()
%40 = call i32 (...) @__nvvm_bar0()
ret void
}

LLVM IR (-O2):
define void @nvvm_math(float %0, float %1, double %2, double %3) {
%5 = tail call float @__nvvm_fmax_f(float %0, float %1)
%6 = tail call float @__nvvm_fmin_f(float %0, float %1)
%7 = tail call float @__nvvm_sqrt_rn_f(float %0)
%8 = tail call float @__nvvm_rcp_rn_f(float %1)
%9 = tail call double @__nvvm_fmax_d(double %2, double %3)
%10 = tail call double @__nvvm_fmin_d(double %2, double %3)
%11 = tail call double @__nvvm_sqrt_rn_d(double %2)
%12 = tail call double @__nvvm_rcp_rn_d(double %3)
%13 = tail call i32 (...) @__nvvm_membar_cta()
%14 = tail call i32 (...) @__nvvm_membar_gl()
%15 = tail call i32 (...) @__nvvm_membar_sys()
%16 = tail call i32 (...) @__nvvm_bar0()
ret void
}