#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 */
double exp(double);
double spfh(float temp, float relhum, float press) {
  double cons, es, eofp, w;
  if (relhum <= 0.0)
    return 0.0;
  cons = 6.1078 * exp((2.5E6 / 4.6150E2) / 273.16);
  es = cons / exp((2.5E6 / 4.6150E2) / temp);
  eofp = relhum * es / 100.0;
  w = 0.622 * eofp / (press - 0.378 * eofp);
  return (w / (1.0 + w));
}


x86 assembly (clang, -O0):
<spfh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     114a <spfh+0x3a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    120e <spfh+0xfe>
movsd  0xede(%rip),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xec6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9a(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe49(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  -0x30(%rbp),%xmm1
movsd  0xe26(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
addsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spfh>:
movaps %xmm0,%xmm4
xorps  %xmm0,%xmm0
xorps  %xmm3,%xmm3
ucomiss %xmm1,%xmm3
jae    11a5 <spfh+0x95>
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
movsd  0xebe(%rip),%xmm0
divsd  %xmm1,%xmm0
movss  %xmm2,0xc(%rsp)
call   1030 <exp@plt>
movsd  0xeaf(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  0xea5(%rip),%xmm1
movsd  0xea5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  0xc(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  0xe97(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe8f(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @spfh(float %0, float %1, float %2) {
%4 = alloca double
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%12 = load float, float* %6
%13 = fpext float %12 to double
%14 = fcmp ole double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %3
store double 0.000000e+00, double* %4
br label %41
16: ; preds = %3
%17 = call double @exp(double 0x4033D4D01F08B62B)
%18 = fmul double 6.107800e+00, %17
store double %18, double* %8
%19 = load double, double* %8
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = fdiv double 0x40B5291E3B5AB210, %21
%23 = call double @exp(double %22)
%24 = fdiv double %19, %23
store double %24, double* %9
%25 = load float, float* %6
%26 = fpext float %25 to double
%27 = load double, double* %9
%28 = fmul double %26, %27
%29 = fdiv double %28, 1.000000e+02
store double %29, double* %10
%30 = load double, double* %10
%31 = fmul double 6.220000e-01, %30
%32 = load float, float* %7
%33 = fpext float %32 to double
%34 = load double, double* %10
%35 = call double @llvm.fmuladd.f64(double -3.780000e-01, double %34, double %33)
%36 = fdiv double %31, %35
store double %36, double* %11
%37 = load double, double* %11
%38 = load double, double* %11
%39 = fadd double 1.000000e+00, %38
%40 = fdiv double %37, %39
store double %40, double* %4
br label %41
41: ; preds = %16, %15
%42 = load double, double* %4
ret double %42
}

LLVM IR (-O2):
define double @spfh(float %0, float %1, float %2) {
%4 = fcmp ugt float %1, 0.000000e+00
br i1 %4, label %5, label %19
5: ; preds = %3
%6 = fpext float %1 to double
%7 = fpext float %0 to double
%8 = fdiv double 0x40B5291E3B5AB210, %7
%9 = tail call double @exp(double %8)
%10 = fdiv double 0x41E2A6A0368D3CAB, %9
%11 = fmul double %10, %6
%12 = fdiv double %11, 1.000000e+02
%13 = fmul double %12, 6.220000e-01
%14 = fpext float %2 to double
%15 = tail call double @llvm.fmuladd.f64(double %12, double -3.780000e-01, double %14)
%16 = fdiv double %13, %15
%17 = fadd double %16, 1.000000e+00
%18 = fdiv double %16, %17
br label %19
19: ; preds = %3, %5
%20 = phi double [ %18, %5 ], [ 0.000000e+00, %3 ]
ret double %20
}