#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 psychro2ea(double preskPa, double tcdrybulb, double tcwetbulb,
                  double psychrocoef) {
  double eakPa, esatkPa;
  double psychroconst;
  double c, a1, a2, a3, a4, tr;
  if (psychrocoef < 0.0) {
    psychrocoef = 0.000662;
  }
  psychroconst = psychrocoef * preskPa;
  c = 101.325;
  a1 = 13.3185;
  a2 = -1.9760;
  a3 = -0.6445;
  a4 = -0.1299;
  tr = 1.0 - (373.15 / (tcwetbulb + 273.15));
  esatkPa = c * exp(tr * (a1 + tr * (a2 + tr * (a3 + tr * a4))));
  eakPa = esatkPa - psychroconst * (tcdrybulb - tcwetbulb);
  return (eakPa);
}


x86 assembly (clang, -O0):
<psychro2ea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1147 <psychro2ea+0x37>
movsd  0xebe(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe79(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe64(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe50(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm6
movsd  -0x68(%rbp),%xmm5
movsd  -0x60(%rbp),%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psychro2ea>:
sub    $0x38,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movapd %xmm3,%xmm4
cmpltsd %xmm0,%xmm4
movsd  0xec5(%rip),%xmm1
andpd  %xmm4,%xmm1
andnpd %xmm3,%xmm4
movsd  0xebd(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  0xeb9(%rip),%xmm2
divsd  %xmm0,%xmm2
addsd  0xeb5(%rip),%xmm2
movsd  0xeb5(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xeb1(%rip),%xmm0
orpd   %xmm1,%xmm4
movapd %xmm4,0x20(%rsp)
mulsd  %xmm2,%xmm0
addsd  0xea3(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe9f(%rip),%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  0xe96(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  0x8(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
mulsd  0x18(%rsp),%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @psychro2ea(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%18 = load double, double* %8
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %4
store double 6.620000e-04, double* %8
br label %21
21: ; preds = %20, %4
%22 = load double, double* %8
%23 = load double, double* %5
%24 = fmul double %22, %23
store double %24, double* %11
store double 1.013250e+02, double* %12
store double 1.331850e+01, double* %13
store double -1.976000e+00, double* %14
store double -6.445000e-01, double* %15
store double -1.299000e-01, double* %16
%25 = load double, double* %7
%26 = fadd double %25, 2.731500e+02
%27 = fdiv double 3.731500e+02, %26
%28 = fsub double 1.000000e+00, %27
store double %28, double* %17
%29 = load double, double* %12
%30 = load double, double* %17
%31 = load double, double* %13
%32 = load double, double* %17
%33 = load double, double* %14
%34 = load double, double* %17
%35 = load double, double* %15
%36 = load double, double* %17
%37 = load double, double* %16
%38 = call double @llvm.fmuladd.f64(double %36, double %37, double %35)
%39 = call double @llvm.fmuladd.f64(double %34, double %38, double %33)
%40 = call double @llvm.fmuladd.f64(double %32, double %39, double %31)
%41 = fmul double %30, %40
%42 = call double @exp(double %41)
%43 = fmul double %29, %42
store double %43, double* %10
%44 = load double, double* %10
%45 = load double, double* %11
%46 = load double, double* %6
%47 = load double, double* %7
%48 = fsub double %46, %47
%49 = fneg double %45
%50 = call double @llvm.fmuladd.f64(double %49, double %48, double %44)
store double %50, double* %9
%51 = load double, double* %9
ret double %51
}

LLVM IR (-O2):
define double @psychro2ea(double %0, double %1, double %2, double %3) {
%5 = fcmp olt double %3, 0.000000e+00
%6 = select i1 %5, double 6.620000e-04, double %3
%7 = fadd double %2, 2.731500e+02
%8 = fdiv double 3.731500e+02, %7
%9 = fsub double 1.000000e+00, %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double -1.299000e-01, double -6.445000e-01)
%11 = tail call double @llvm.fmuladd.f64(double %9, double %10, double -1.976000e+00)
%12 = tail call double @llvm.fmuladd.f64(double %9, double %11, double 1.331850e+01)
%13 = fmul double %9, %12
%14 = tail call double @exp(double %13)
%15 = fmul double %14, 1.013250e+02
%16 = fsub double %1, %2
%17 = fneg double %6
%18 = fmul double %17, %0
%19 = tail call double @llvm.fmuladd.f64(double %18, double %16, double %15)
ret double %19
}