#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 */
int getArraySize(int);
int getVoltage0Reading();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int, int /*<<< orphan*/);
int main() {
  while (true) {
    int reading = getVoltage0Reading();
    double voltage = ((double)reading / 4095) * 1.8;
    printf("--------------------------------\n");
    printf("Value %5d\n\n", reading);
    int arrSz = getArraySize(reading);
    printf("Array Size: %d\n", arrSz);
    printf("--------------------------------\n");
    sleep(1, 0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getVoltage0Reading@plt>
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe89(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <getArraySize@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1060 <sleep@plt>
jmp    114f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xebe(%rip),%rbx
lea    0xe9b(%rip),%r14
lea    0xea0(%rip),%r15
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getVoltage0Reading@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1050 <getArraySize@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1070 <sleep@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
@.str = [34 x i8] c"--------------------------------\0A\00"
@.str.1 = [12 x i8] c"Value %5d\0A\0A\00"
@.str.2 = [16 x i8] c"Array Size: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %0, %5
%6 = call i32 (...) @getVoltage0Reading()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 4.095000e+03
%10 = fmul double %9, 1.800000e+00
store double %10, double* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @getArraySize(i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @sleep(i32 1, i32 0)
br label %5
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"Value %5d\0A\0A\00"
@.str.2 = [16 x i8] c"Array Size: %d\0A\00"
@str.3 = [33 x i8] c"--------------------------------\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @getVoltage0Reading()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%5 = tail call i32 @getArraySize(i32 %2)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%8 = tail call i32 @sleep(i32 1, i32 0)
br label %1
}