#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 */
float log(float);
void SHT1x_CalcDewpoint(float fRH, float fTemp, float *fDP) {
  float Tn = 243.12;
  float m = 17.62;
  if (fTemp < 0) {
    Tn = 272.62;
    m = 22.46;
  }
  float lnRH = log(fRH / 100);
  float mTTnT = (m * fTemp) / (Tn + fTemp);
  *fDP = Tn * ((lnRH + mTTnT) / (m - lnRH - mTTnT));
}


x86 assembly (clang, -O0):
<SHT1x_CalcDewpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  0xed6(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xec5(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1167 <SHT1x_CalcDewpoint+0x57>
movss  0xeb7(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xea6(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe9c(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <log@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
addss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
addss  -0x20(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
subss  -0x1c(%rbp),%xmm2
subss  -0x20(%rbp),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHT1x_CalcDewpoint>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm1,0xc(%rsp)
xorps  %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm1,%xmm2
seta   %al
lea    0xed0(%rip),%rcx
movss  (%rcx,%rax,4),%xmm1
movss  %xmm1,0x4(%rsp)
lea    0xec6(%rip),%rcx
movss  (%rcx,%rax,4),%xmm1
movss  %xmm1,0x8(%rsp)
divss  0xebb(%rip),%xmm0
call   1030 <log@plt>
movss  0x4(%rsp),%xmm4
movaps %xmm4,%xmm1
movss  0xc(%rsp),%xmm2
mulss  %xmm2,%xmm1
movss  0x8(%rsp),%xmm3
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
movaps %xmm4,%xmm2
subss  %xmm0,%xmm2
subss  %xmm1,%xmm2
addss  %xmm0,%xmm1
divss  %xmm2,%xmm1
mulss  %xmm3,%xmm1
movss  %xmm1,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @SHT1x_CalcDewpoint(float %0, float %1, float* nocapture writeonly %2) {
%4 = fcmp olt float %1, 0.000000e+00
%5 = select i1 %4, float 0x403675C280000000, float 0x40319EB860000000
%6 = select i1 %4, float 0x407109EB80000000, float 0x406E63D700000000
%7 = fdiv float %0, 1.000000e+02
%8 = tail call float @log(float %7)
%9 = fmul float %5, %1
%10 = fadd float %6, %1
%11 = fdiv float %9, %10
%12 = fadd float %11, %8
%13 = fsub float %5, %8
%14 = fsub float %13, %11
%15 = fdiv float %12, %14
%16 = fmul float %6, %15
store float %16, float* %2
ret void
}