#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 log10(double);
double phyCalcDp(double temp, double rh) {
  double h;
  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;
  h = ((log10(rh) - 2.0) / 0.4343) + ((17.62 * temp) / (243.12 + temp));
  return (double)((243.12 * h) / (17.62 - h));
}


x86 assembly (clang, -O0):
<phyCalcDp>:
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 <phyCalcDp+0x37>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <phyCalcDp+0x60>
movsd  -0x8(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116b <phyCalcDp+0x5b>
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1170 <phyCalcDp+0x60>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    118b <phyCalcDp+0x7b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11b4 <phyCalcDp+0xa4>
movsd  -0x10(%rbp),%xmm0
movsd  0xe78(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11af <phyCalcDp+0x9f>
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11b4 <phyCalcDp+0xa4>
movsd  -0x10(%rbp),%xmm0
call   1030 <log10@plt>
movsd  0xe6a(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe3a(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xe35(%rip),%xmm2
addsd  -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe1b(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phyCalcDp>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm2
ucomisd %xmm0,%xmm2
ja     1138 <phyCalcDp+0x28>
ucomisd 0xede(%rip),%xmm0
movapd %xmm0,%xmm2
jbe    1138 <phyCalcDp+0x28>
movsd  0xed0(%rip),%xmm2
movapd %xmm2,(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     115d <phyCalcDp+0x4d>
ucomisd 0xec1(%rip),%xmm1
movapd %xmm1,%xmm0
jbe    115d <phyCalcDp+0x4d>
movsd  0xeb3(%rip),%xmm0
call   1030 <log10@plt>
unpcklpd %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm2
movapd (%rsp),%xmm3
movapd %xmm3,%xmm0
addpd  0xeb1(%rip),%xmm1
mulsd  %xmm2,%xmm0
movsd  %xmm0,%xmm1
movsd  0xe91(%rip),%xmm0
addsd  %xmm0,%xmm3
shufpd $0x2,0xea4(%rip),%xmm3
divpd  %xmm3,%xmm1
movapd %xmm1,%xmm3
unpckhpd %xmm1,%xmm3
addsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm0
subsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define double @phyCalcDp(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 = tail call double @log10(double %14)
%16 = insertelement <2 x double> poison, double %8, i64 0
%17 = insertelement <2 x double> %16, double %15, i64 1
%18 = fmul <2 x double> %17, <double 1.762000e+01, double poison>
%19 = fadd <2 x double> %17, <double poison, double -2.000000e+00>
%20 = shufflevector <2 x double> %18, <2 x double> %19, <2 x i32> <i32 0, i32 3>
%21 = fadd double %8, 2.431200e+02
%22 = insertelement <2 x double> <double poison, double 4.343000e-01>, double %21, i64 0
%23 = fdiv <2 x double> %20, %22
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%25 = fadd <2 x double> %23, %24
%26 = extractelement <2 x double> %25, i64 0
%27 = fmul double %26, 2.431200e+02
%28 = fsub double 1.762000e+01, %26
%29 = fdiv double %27, %28
ret double %29
}