#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 ads1115_read(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
double volts_to_c(float);
int main() {
  printf("Starting call\n");
  while (1) {
    float voltage0 = ads1115_read(0);
    float voltage1 = ads1115_read(1);
    float voltage2 = ads1115_read(2);
    float voltage3 = ads1115_read(3);
    printf("Therm 0: %f C\n", volts_to_c(voltage0));
    printf("Therm 1: %f C\n", volts_to_c(voltage1));
    printf("Therm 2: %f C\n", volts_to_c(voltage2));
    printf("Therm 3: %f C\n", volts_to_c(voltage3));
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <ads1115_read@plt>
movss  %xmm0,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <ads1115_read@plt>
movss  %xmm0,-0xc(%rbp)
mov    $0x2,%edi
call   1030 <ads1115_read@plt>
movss  %xmm0,-0x10(%rbp)
mov    $0x3,%edi
call   1030 <ads1115_read@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
call   1050 <volts_to_c@plt>
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
call   1050 <volts_to_c@plt>
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
call   1050 <volts_to_c@plt>
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x14(%rbp),%xmm0
call   1050 <volts_to_c@plt>
lea    0xe4d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    115d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%r14
lea    0xe9a(%rip),%r15
lea    0xea2(%rip),%r12
lea    0xeaa(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
call   1040 <ads1115_read@plt>
movss  %xmm0,0x8(%rsp)
mov    $0x1,%edi
call   1040 <ads1115_read@plt>
movss  %xmm0,0xc(%rsp)
mov    $0x2,%edi
call   1040 <ads1115_read@plt>
movss  %xmm0,0x10(%rsp)
mov    $0x3,%edi
call   1040 <ads1115_read@plt>
movss  %xmm0,0x14(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <volts_to_c@plt>
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rsp),%xmm0
call   1060 <volts_to_c@plt>
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x10(%rsp),%xmm0
call   1060 <volts_to_c@plt>
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x14(%rsp),%xmm0
call   1060 <volts_to_c@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1190 <main+0x40>

LLVM IR (-O0):
@.str = [15 x i8] c"Starting call\0A\00"
@.str.1 = [15 x i8] c"Therm 0: %f C\0A\00"
@.str.2 = [15 x i8] c"Therm 1: %f C\0A\00"
@.str.3 = [15 x i8] c"Therm 2: %f C\0A\00"
@.str.4 = [15 x i8] c"Therm 3: %f C\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %0, %7
%8 = call float @ads1115_read(i32 0)
store float %8, float* %2
%9 = call float @ads1115_read(i32 1)
store float %9, float* %3
%10 = call float @ads1115_read(i32 2)
store float %10, float* %4
%11 = call float @ads1115_read(i32 3)
store float %11, float* %5
%12 = load float, float* %2
%13 = call double @volts_to_c(float %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = load float, float* %3
%16 = call double @volts_to_c(float %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %16)
%18 = load float, float* %4
%19 = call double @volts_to_c(float %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = load float, float* %5
%22 = call double @volts_to_c(float %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %22)
%24 = call i32 @sleep(i32 1)
br label %7
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Therm 0: %f C\0A\00"
@.str.2 = [15 x i8] c"Therm 1: %f C\0A\00"
@.str.3 = [15 x i8] c"Therm 2: %f C\0A\00"
@.str.4 = [15 x i8] c"Therm 3: %f C\0A\00"
@str = [14 x i8] c"Starting call\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = tail call float @ads1115_read(i32 0)
%4 = tail call float @ads1115_read(i32 1)
%5 = tail call float @ads1115_read(i32 2)
%6 = tail call float @ads1115_read(i32 3)
%7 = tail call double @volts_to_c(float %3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %7)
%9 = tail call double @volts_to_c(float %4)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %9)
%11 = tail call double @volts_to_c(float %5)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = tail call double @volts_to_c(float %6)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %13)
%15 = tail call i32 @sleep(i32 1)
br label %2
}