#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 sht1x_get_temperature(void *);
float sht1x_get_moisture(void *sht1x_address) {
  short moisture_data;
  float linear_moisture;
  float moisture;
  float temperature = sht1x_get_temperature(sht1x_address);
  moisture_data = *((volatile int *)sht1x_address + 3);
  linear_moisture = -2.0468 + 0.0367 * moisture_data +
                    -1.5955E-6 * moisture_data * moisture_data;
  moisture =
      (temperature - 25) * (0.01 + 0.00008 * moisture_data) + linear_moisture;
  return (moisture);
}


x86 assembly (clang, -O0):
<sht1x_get_moisture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sht1x_get_temperature@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xed3(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xecf(%rip),%xmm0
addsd  %xmm0,%xmm1
movswl -0xa(%rbp),%eax
cvtsi2sd %eax,%xmm2
movsd  0xeab(%rip),%xmm0
mulsd  %xmm2,%xmm0
movswl -0xa(%rbp),%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xe99(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movswl -0xa(%rbp),%eax
cvtsi2sd %eax,%xmm2
movsd  0xe59(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xe55(%rip),%xmm1
addsd  %xmm1,%xmm2
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sht1x_get_moisture>:
push   %rbx
mov    %rdi,%rbx
call   1030 <sht1x_get_temperature@plt>
mov    0xc(%rbx),%eax
cwtl
cvtsi2sd %eax,%xmm1
movsd  0xed7(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xed3(%rip),%xmm2
movsd  0xed3(%rip),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
xorps  %xmm2,%xmm2
cvtsd2ss %xmm3,%xmm2
addss  0xed0(%rip),%xmm0
mulsd  0xeb8(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
addsd  0xeb4(%rip),%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @sht1x_get_moisture(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call float @sht1x_get_temperature(i8* %7)
store float %8, float* %6
%9 = load i8*, i8** %2
%10 = bitcast i8* %9 to i32*
%11 = getelementptr inbounds i32, i32* %10, i64 3
%12 = load volatile i32, i32* %11
%13 = trunc i32 %12 to i16
store i16 %13, i16* %3
%14 = load i16, i16* %3
%15 = sext i16 %14 to i32
%16 = sitofp i32 %15 to double
%17 = call double @llvm.fmuladd.f64(double 3.670000e-02, double %16, double -2.046800e+00)
%18 = load i16, i16* %3
%19 = sext i16 %18 to i32
%20 = sitofp i32 %19 to double
%21 = fmul double -1.595500e-06, %20
%22 = load i16, i16* %3
%23 = sext i16 %22 to i32
%24 = sitofp i32 %23 to double
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %17)
%26 = fptrunc double %25 to float
store float %26, float* %4
%27 = load float, float* %6
%28 = fsub float %27, 2.500000e+01
%29 = fpext float %28 to double
%30 = load i16, i16* %3
%31 = sext i16 %30 to i32
%32 = sitofp i32 %31 to double
%33 = call double @llvm.fmuladd.f64(double 8.000000e-05, double %32, double 1.000000e-02)
%34 = load float, float* %4
%35 = fpext float %34 to double
%36 = call double @llvm.fmuladd.f64(double %29, double %33, double %35)
%37 = fptrunc double %36 to float
store float %37, float* %5
%38 = load float, float* %5
ret float %38
}

LLVM IR (-O2):
define float @sht1x_get_moisture(i8* %0) {
%2 = tail call float @sht1x_get_temperature(i8* %0)
%3 = getelementptr inbounds i8, i8* %0, i64 12
%4 = bitcast i8* %3 to i32*
%5 = load volatile i32, i32* %4
%6 = shl i32 %5, 16
%7 = ashr exact i32 %6, 16
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 3.670000e-02, double -2.046800e+00)
%10 = fmul double %8, -1.595500e-06
%11 = tail call double @llvm.fmuladd.f64(double %10, double %8, double %9)
%12 = fptrunc double %11 to float
%13 = fadd float %2, -2.500000e+01
%14 = fpext float %13 to double
%15 = tail call double @llvm.fmuladd.f64(double %8, double 8.000000e-05, double 1.000000e-02)
%16 = fpext float %12 to double
%17 = tail call double @llvm.fmuladd.f64(double %14, double %15, double %16)
%18 = fptrunc double %17 to float
ret float %18
}