#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 dewPointFast(float, float);
int /*<<< orphan*/ exit(int);
double humidex(float, double);
int pi_2_dht_read(int, float *, float *);
int pi_2_mmio_init();
int /*<<< orphan*/ pi_2_mmio_set_low(int);
int /*<<< orphan*/ power_on_dht11();
int /*<<< orphan*/ printf(char *, float, ...);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int r = pi_2_mmio_init();
  if (r != 0) {
    printf("Error initiating Mem GPIO %d", r);
    exit(-1);
  }
  power_on_dht11();
  sleep(1);
  float humidity = 0, temperature = 0;
  int result = pi_2_dht_read(24, &humidity, &temperature);
  double dP = dewPointFast(temperature, humidity);
  double hI = humidex(temperature, dP);
  printf("DHT11 out\nTemp:\t%f\nHumidity:\t%f\nDP:\t%f\nHI:\t%f\n", temperature,
         humidity, dP, hI);
  pi_2_mmio_set_low(23);
  pi_2_mmio_set_low(24);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pi_2_mmio_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11d7 <main+0x47>
cvtsi2ssl -0x14(%rbp),%xmm0
lea    0xe3a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    $0x0,%al
call   1070 <power_on_dht11@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    $0x18,%edi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <pi_2_dht_read@plt>
mov    %eax,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1080 <dewPointFast@plt>
movsd  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1090 <humidex@plt>
movsd  %xmm0,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
lea    0xdc9(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    $0x17,%edi
call   1040 <pi_2_mmio_set_low@plt>
mov    $0x18,%edi
call   1040 <pi_2_mmio_set_low@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1050 <pi_2_mmio_init@plt>
test   %eax,%eax
jne    123f <main+0xaf>
xor    %eax,%eax
call   1070 <power_on_dht11@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    $0x18,%edi
call   1060 <pi_2_dht_read@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1080 <dewPointFast@plt>
movaps %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
call   1090 <humidex@plt>
movaps %xmm0,%xmm3
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe06(%rip),%rdi
movsd  0x10(%rsp),%xmm2
mov    $0x4,%al
call   1030 <printf@plt>
mov    $0x17,%edi
call   1040 <pi_2_mmio_set_low@plt>
mov    $0x18,%edi
call   1040 <pi_2_mmio_set_low@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
cvtsi2ss %eax,%xmm0
lea    0xdb6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Error initiating Mem GPIO %d\00"
@.str.1 = [47 x i8] c"DHT11 out\0ATemp:\09%f\0AHumidity:\09%f\0ADP:\09%f\0AHI:\09%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (...) @pi_2_mmio_init()
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* %6
%17 = sitofp i32 %16 to float
%18 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %17)
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %2
%21 = call i32 (...) @power_on_dht11()
%22 = call i32 @sleep(i32 1)
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
%23 = call i32 @pi_2_dht_read(i32 24, float* %7, float* %8)
store i32 %23, i32* %9
%24 = load float, float* %8
%25 = load float, float* %7
%26 = call double @dewPointFast(float %24, float %25)
store double %26, double* %10
%27 = load float, float* %8
%28 = load double, double* %10
%29 = call double @humidex(float %27, double %28)
store double %29, double* %11
%30 = load float, float* %8
%31 = load float, float* %7
%32 = fpext float %31 to double
%33 = load double, double* %10
%34 = load double, double* %11
%35 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), float %30, double %32, double %33, double %34)
%36 = call i32 @pi_2_mmio_set_low(i32 23)
%37 = call i32 @pi_2_mmio_set_low(i32 24)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Error initiating Mem GPIO %d\00"
@.str.1 = [47 x i8] c"DHT11 out\0ATemp:\09%f\0AHumidity:\09%f\0ADP:\09%f\0AHI:\09%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = tail call i32 (...) @pi_2_mmio_init()
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = sitofp i32 %5 to float
%9 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %8)
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = tail call i32 (...) @power_on_dht11()
%13 = tail call i32 @sleep(i32 1)
%14 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%15 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%16 = call i32 @pi_2_dht_read(i32 24, float* %3, float* %4)
%17 = load float, float* %4
%18 = load float, float* %3
%19 = call double @dewPointFast(float %17, float %18)
%20 = load float, float* %4
%21 = call double @humidex(float %20, double %19)
%22 = load float, float* %4
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), float %22, double %24, double %19, double %21)
%26 = call i32 @pi_2_mmio_set_low(i32 23)
%27 = call i32 @pi_2_mmio_set_low(i32 24)
ret i32 0
}