#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 phyCalcAh(double temp, double rh) {
  if (temp < -20.0)
    temp = -20.0;
  else if (temp > 50.0)
    temp = 50.0;
  if (rh < 0.0)
    rh = 0.0;
  else if (rh > 100.0)
    rh = 100.0;
  return (double)(216.7 * (((rh / 100) * 6.112 *
                            exp((17.62 * temp) / (243.12 + temp))) /
                           (273.15 + temp)));
}


x86 assembly (clang, -O0):
<phyCalcAh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1147 <phyCalcAh+0x37>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <phyCalcAh+0x60>
movsd  -0x8(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116b <phyCalcAh+0x5b>
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <phyCalcAh+0x60>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    118b <phyCalcAh+0x7b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11b4 <phyCalcAh+0xa4>
movsd  -0x10(%rbp),%xmm0
movsd  0xe78(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11af <phyCalcAh+0x9f>
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11b4 <phyCalcAh+0xa4>
movsd  -0x10(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe6b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe52(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe16(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdfd(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phyCalcAh>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm2
ucomisd %xmm0,%xmm2
ja     1138 <phyCalcAh+0x28>
ucomisd 0xede(%rip),%xmm0
movapd %xmm0,%xmm2
jbe    1138 <phyCalcAh+0x28>
movsd  0xed0(%rip),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     1158 <phyCalcAh+0x48>
ucomisd 0xec6(%rip),%xmm1
movapd %xmm1,%xmm0
jbe    1158 <phyCalcAh+0x48>
movsd  0xeb8(%rip),%xmm0
divsd  0xeb0(%rip),%xmm0
mulsd  0xeb0(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xea6(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
addsd  0xe8d(%rip),%xmm1
mulsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
mulsd  0xe83(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @phyCalcAh(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fcmp olt double %5, -2.000000e+01
br i1 %6, label %7, label %8
7: ; preds = %2
store double -2.000000e+01, double* %3
br label %13
8: ; preds = %2
%9 = load double, double* %3
%10 = fcmp ogt double %9, 5.000000e+01
br i1 %10, label %11, label %12
11: ; preds = %8
store double 5.000000e+01, double* %3
br label %12
12: ; preds = %11, %8
br label %13
13: ; preds = %12, %7
%14 = load double, double* %4
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %13
store double 0.000000e+00, double* %4
br label %22
17: ; preds = %13
%18 = load double, double* %4
%19 = fcmp ogt double %18, 1.000000e+02
br i1 %19, label %20, label %21
20: ; preds = %17
store double 1.000000e+02, double* %4
br label %21
21: ; preds = %20, %17
br label %22
22: ; preds = %21, %16
%23 = load double, double* %4
%24 = fdiv double %23, 1.000000e+02
%25 = fmul double %24, 6.112000e+00
%26 = load double, double* %3
%27 = fmul double 1.762000e+01, %26
%28 = load double, double* %3
%29 = fadd double 2.431200e+02, %28
%30 = fdiv double %27, %29
%31 = call double @exp(double %30)
%32 = fmul double %25, %31
%33 = load double, double* %3
%34 = fadd double 2.731500e+02, %33
%35 = fdiv double %32, %34
%36 = fmul double 2.167000e+02, %35
ret double %36
}

LLVM IR (-O2):
define double @phyCalcAh(double %0, double %1) {
%3 = fcmp olt double %0, -2.000000e+01
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = fcmp ogt double %0, 5.000000e+01
br i1 %5, label %6, label %7
6: ; preds = %4
br label %7
7: ; preds = %2, %4, %6
%8 = phi double [ 5.000000e+01, %6 ], [ %0, %4 ], [ -2.000000e+01, %2 ]
%9 = fcmp olt double %1, 0.000000e+00
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = fcmp ogt double %1, 1.000000e+02
br i1 %11, label %12, label %13
12: ; preds = %10
br label %13
13: ; preds = %7, %10, %12
%14 = phi double [ 1.000000e+02, %12 ], [ %1, %10 ], [ 0.000000e+00, %7 ]
%15 = fdiv double %14, 1.000000e+02
%16 = fmul double %15, 6.112000e+00
%17 = fmul double %8, 1.762000e+01
%18 = fadd double %8, 2.431200e+02
%19 = fdiv double %17, %18
%20 = tail call double @exp(double %19)
%21 = fmul double %20, %16
%22 = fadd double %8, 2.731500e+02
%23 = fdiv double %21, %22
%24 = fmul double %23, 2.167000e+02
ret double %24
}