#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 /*<<< orphan*/ closeJetduino();
int /*<<< orphan*/ exit(int);
int openJetduino();
int /*<<< orphan*/ printf(char *, ...);
float temperatureRead(int, int);
int /*<<< orphan*/ usleep(int);
int main(void) {
  float temp;
  int i = 0;
  int pin = 54;
  if (openJetduino() == -1)
    exit(1);
  for (i = 0; i < 2000; i++) {
    temp = temperatureRead(pin, 2);
    printf("Temperature: %f\n", temp);
    if (temp == -1)
      printf("IO Error");
    usleep(100000);
  }
  closeJetduino();
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x36,-0x10(%rbp)
mov    $0x0,%al
call   1040 <openJetduino@plt>
cmp    $0xffffffff,%eax
jne    1197 <main+0x37>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x7d0,-0xc(%rbp)
jge    1216 <main+0xb6>
mov    -0x10(%rbp),%edi
mov    $0x2,%esi
call   1060 <temperatureRead@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe37(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe1f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11fe <main+0x9e>
jp     11fe <main+0x9e>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119e <main+0x3e>
mov    $0x0,%al
call   1050 <closeJetduino@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <openJetduino@plt>
cmp    $0xffffffff,%eax
je     11f4 <main+0x94>
mov    $0x7d0,%ebp
lea    0xe80(%rip),%rbx
lea    0xe8a(%rip),%r14
jmp    119f <main+0x3f>
nopl   (%rax)
mov    $0x186a0,%edi
call   1080 <usleep@plt>
add    $0xffffffff,%ebp
je     11df <main+0x7f>
mov    $0x36,%edi
mov    $0x2,%esi
call   1060 <temperatureRead@plt>
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe31(%rip),%xmm0
jne    1190 <main+0x30>
jp     1190 <main+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1190 <main+0x30>
xor    %eax,%eax
call   1050 <closeJetduino@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Temperature: %f\0A\00"
@.str.1 = [9 x i8] c"IO Error\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 54, i32* %4
%5 = call i32 (...) @openJetduino()
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
store i32 0, i32* %3
br label %10
10: ; preds = %25, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 2000
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = load i32, i32* %4
%15 = call float @temperatureRead(i32 %14, i32 2)
store float %15, float* %2
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %17)
%19 = load float, float* %2
%20 = fcmp oeq float %19, -1.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %13
%24 = call i32 @usleep(i32 100000)
br label %25
25: ; preds = %23
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %10
28: ; preds = %10
%29 = call i32 (...) @closeJetduino()
ret i32 1
}

LLVM IR (-O2):
@.str = [17 x i8] c"Temperature: %f\0A\00"
@.str.1 = [9 x i8] c"IO Error\00"
define i32 @main() {
%1 = tail call i32 (...) @openJetduino()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %0, %13
%6 = phi i32 [ %15, %13 ], [ 0, %0 ]
%7 = tail call float @temperatureRead(i32 54, i32 2)
%8 = fpext float %7 to double
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %8)
%10 = fcmp oeq float %7, -1.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %5
%14 = tail call i32 @usleep(i32 100000)
%15 = add nuw nsw i32 %6, 1
%16 = icmp eq i32 %15, 2000
br i1 %16, label %17, label %5
17: ; preds = %13
%18 = tail call i32 (...) @closeJetduino()
ret i32 1
}