#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 log(float);
float tempered_util__get_dew_point(float tempC, float rel_hum) {
  double Tn = 243.12;
  double m = 17.62;
  if (tempC < 0) {
    Tn = 272.62;
    m = 22.46;
  }
  double gamma = log(rel_hum / 100) + m * tempC / (Tn + tempC);
  double dew_point = Tn * gamma / (m - gamma);
  return dew_point;
}


x86 assembly (clang, -O0):
<tempered_util__get_dew_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1163 <tempered_util__get_dew_point+0x53>
movsd  0xec7(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xeb0(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <log@plt>
movsd  -0x18(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x10(%rbp),%xmm2
movss  -0x4(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tempered_util__get_dew_point>:
sub    $0x18,%rsp
movss  %xmm0,0x4(%rsp)
xorps  %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm0,%xmm2
seta   %al
lea    0xed4(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xed2(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
divss  0xecf(%rip),%xmm1
movaps %xmm1,%xmm0
call   1030 <log@plt>
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm2
mulsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm4
addsd  %xmm4,%xmm1
divsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm4
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm4
xorps  %xmm0,%xmm0
cvtsd2ss %xmm4,%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define float @tempered_util__get_dew_point(float %0, float %1) {
%3 = fcmp olt float %0, 0.000000e+00
%4 = select i1 %3, double 2.246000e+01, double 1.762000e+01
%5 = select i1 %3, double 2.726200e+02, double 2.431200e+02
%6 = fdiv float %1, 1.000000e+02
%7 = tail call double @log(float %6)
%8 = fpext float %0 to double
%9 = fmul double %4, %8
%10 = fadd double %5, %8
%11 = fdiv double %9, %10
%12 = fadd double %11, %7
%13 = fmul double %5, %12
%14 = fsub double %4, %12
%15 = fdiv double %13, %14
%16 = fptrunc double %15 to float
ret float %16
}