#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int uint;
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
float dew_point(float, float);
int /*<<< orphan*/ measure_rht(int);
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
float sorh_to_relative_humidity(int /*<<< orphan*/, float, int);
float sot_to_temperature(int /*<<< orphan*/, char, int);
int get_measurements(float *temperature_C, float *relative_humidity,
                     float *dew_point_C) {
  uint temp_resolution, rh_resolution;
  uint16_t rot1, sorh1;
  uint8_t sht15_status;
  struct timespec tim_r, tim_clk, tim_clk_half;
  tim_r.tv_sec = 0;
  tim_r.tv_nsec = 200;
  tim_clk.tv_sec = 0;
  tim_clk.tv_nsec = 1000000 << 2;
  tim_clk_half.tv_sec = 0;
  tim_clk.tv_nsec = 1000000 >> 1;
  temp_resolution = 14;
  rh_resolution = 12;
  sorh1 = measure_rht(5);
  nanosleep(&tim_clk, NULL);
  rot1 = measure_rht(3);
  *temperature_C = sot_to_temperature(rot1, 'C', temp_resolution);
  *relative_humidity =
      sorh_to_relative_humidity(sorh1, *temperature_C, rh_resolution);
  *dew_point_C = dew_point(*relative_humidity, *temperature_C);
  return 0;
}


x86 assembly (clang, -O0):
<get_measurements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0xc8,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x3d0900,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movl   $0x7a120,-0x50(%rbp)
movl   $0xe,-0x1c(%rbp)
movl   $0xc,-0x20(%rbp)
mov    $0x5,%edi
call   1050 <measure_rht@plt>
mov    %eax,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <nanosleep@plt>
mov    $0x3,%edi
call   1050 <measure_rht@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x1c(%rbp),%edx
mov    $0x43,%esi
call   1070 <sot_to_temperature@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%edi
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%esi
call   1030 <sorh_to_relative_humidity@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
call   1040 <dew_point@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_measurements>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movq   $0x0,0x10(%rsp)
movl   $0x7a120,0x8(%rsp)
mov    $0x5,%edi
call   1050 <measure_rht@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <nanosleep@plt>
mov    $0x3,%edi
call   1050 <measure_rht@plt>
mov    %eax,%edi
mov    $0x43,%esi
mov    $0xe,%edx
call   1070 <sot_to_temperature@plt>
movss  %xmm0,(%rbx)
mov    %ebp,%edi
mov    $0xc,%esi
call   1030 <sorh_to_relative_humidity@plt>
movss  %xmm0,(%r15)
movss  (%rbx),%xmm1
call   1040 <dew_point@plt>
movss  %xmm0,(%r14)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define i32 @get_measurements(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.timespec
%13 = alloca %struct.timespec
%14 = alloca %struct.timespec
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 1
store i64 0, i64* %15
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
store i32 200, i32* %16
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 1
store i64 0, i64* %17
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 0
store i32 4000000, i32* %18
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 1
store i64 0, i64* %19
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 0
store i32 500000, i32* %20
store i32 14, i32* %7
store i32 12, i32* %8
%21 = call i32 @measure_rht(i32 5)
store i32 %21, i32* %10
%22 = call i32 @nanosleep(%struct.timespec* %13, i32* null)
%23 = call i32 @measure_rht(i32 3)
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = load i32, i32* %7
%26 = call float @sot_to_temperature(i32 %24, i8 signext 67, i32 %25)
%27 = load float*, float** %4
store float %26, float* %27
%28 = load i32, i32* %10
%29 = load float*, float** %4
%30 = load float, float* %29
%31 = load i32, i32* %8
%32 = call float @sorh_to_relative_humidity(i32 %28, float %30, i32 %31)
%33 = load float*, float** %5
store float %32, float* %33
%34 = load float*, float** %5
%35 = load float, float* %34
%36 = load float*, float** %4
%37 = load float, float* %36
%38 = call float @dew_point(float %35, float %37)
%39 = load float*, float** %6
store float %38, float* %39
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define i32 @get_measurements(float* nocapture %0, float* nocapture writeonly %1, float* nocapture writeonly %2) {
%4 = alloca %struct.timespec
%5 = bitcast %struct.timespec* %4 to i8*
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
store i64 0, i64* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
store i32 500000, i32* %7
%8 = tail call i32 @measure_rht(i32 5)
%9 = call i32 @nanosleep(%struct.timespec* %4, i32* null)
%10 = call i32 @measure_rht(i32 3)
%11 = call float @sot_to_temperature(i32 %10, i8 signext 67, i32 14)
store float %11, float* %0
%12 = call float @sorh_to_relative_humidity(i32 %8, float %11, i32 12)
store float %12, float* %1
%13 = load float, float* %0
%14 = call float @dew_point(float %12, float %13)
store float %14, float* %2
ret i32 0
}