#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 analogRead(int);
float checkTemp(int pinToRead) {
  float temps = 0;
  float volts;
  float baseLine;
  for (int i = 0; i < 6; i++) {
    baseLine = analogRead(pinToRead);
    volts = baseLine * (4750.0 / 1024);
    temps = temps + ((volts - 1375) / 22.5);
  }
  temps = temps / 5.0;
  return temps;
}


x86 assembly (clang, -O0):
<checkTemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    11a4 <checkTemp+0x94>
mov    -0x4(%rbp),%edi
call   1030 <analogRead@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebe(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xea3(%rip),%xmm2
subss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe83(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112a <checkTemp+0x1a>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkTemp>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
call   1030 <analogRead@plt>
mulss  0xedc(%rip),%xmm0
addss  0xed8(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xed8(%rip),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <analogRead@plt>
mulss  0xea0(%rip),%xmm0
addss  0xe9c(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe9c(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <analogRead@plt>
mulss  0xe69(%rip),%xmm0
addss  0xe65(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe65(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <analogRead@plt>
mulss  0xe32(%rip),%xmm0
addss  0xe2e(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe2e(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <analogRead@plt>
mulss  0xdfb(%rip),%xmm0
addss  0xdf7(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xdf7(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <analogRead@plt>
mulss  0xdc4(%rip),%xmm0
addss  0xdc0(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xdc0(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
divss  0xda6(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @checkTemp(i32 %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 %0, i32* %2
store float 0.000000e+00, float* %3
store i32 0, i32* %6
br label %7
7: ; preds = %25, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 6
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call float @analogRead(i32 %11)
store float %12, float* %5
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fmul double %14, 0x40128E0000000000
%16 = fptrunc double %15 to float
store float %16, float* %4
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = load float, float* %4
%20 = fsub float %19, 1.375000e+03
%21 = fpext float %20 to double
%22 = fdiv double %21, 2.250000e+01
%23 = fadd double %18, %22
%24 = fptrunc double %23 to float
store float %24, float* %3
br label %25
25: ; preds = %10
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %7
28: ; preds = %7
%29 = load float, float* %3
%30 = fpext float %29 to double
%31 = fdiv double %30, 5.000000e+00
%32 = fptrunc double %31 to float
store float %32, float* %3
%33 = load float, float* %3
ret float %33
}

LLVM IR (-O2):
define float @checkTemp(i32 %0) {
%2 = tail call float @analogRead(i32 %0)
%3 = fmul float %2, 0x40128E0000000000
%4 = fadd float %3, -1.375000e+03
%5 = fpext float %4 to double
%6 = fdiv double %5, 2.250000e+01
%7 = fadd double %6, 0.000000e+00
%8 = fptrunc double %7 to float
%9 = fpext float %8 to double
%10 = tail call float @analogRead(i32 %0)
%11 = fmul float %10, 0x40128E0000000000
%12 = fadd float %11, -1.375000e+03
%13 = fpext float %12 to double
%14 = fdiv double %13, 2.250000e+01
%15 = fadd double %14, %9
%16 = fptrunc double %15 to float
%17 = fpext float %16 to double
%18 = tail call float @analogRead(i32 %0)
%19 = fmul float %18, 0x40128E0000000000
%20 = fadd float %19, -1.375000e+03
%21 = fpext float %20 to double
%22 = fdiv double %21, 2.250000e+01
%23 = fadd double %22, %17
%24 = fptrunc double %23 to float
%25 = fpext float %24 to double
%26 = tail call float @analogRead(i32 %0)
%27 = fmul float %26, 0x40128E0000000000
%28 = fadd float %27, -1.375000e+03
%29 = fpext float %28 to double
%30 = fdiv double %29, 2.250000e+01
%31 = fadd double %30, %25
%32 = fptrunc double %31 to float
%33 = fpext float %32 to double
%34 = tail call float @analogRead(i32 %0)
%35 = fmul float %34, 0x40128E0000000000
%36 = fadd float %35, -1.375000e+03
%37 = fpext float %36 to double
%38 = fdiv double %37, 2.250000e+01
%39 = fadd double %38, %33
%40 = fptrunc double %39 to float
%41 = fpext float %40 to double
%42 = tail call float @analogRead(i32 %0)
%43 = fmul float %42, 0x40128E0000000000
%44 = fadd float %43, -1.375000e+03
%45 = fpext float %44 to double
%46 = fdiv double %45, 2.250000e+01
%47 = fadd double %46, %41
%48 = fptrunc double %47 to float
%49 = fdiv float %48, 5.000000e+00
ret float %49
}