#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*/ O_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ show_print(int, int, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int main() {
  int i;
  int data;
  int fd;
  int tmp;
  fd = open("/dev/bmp180", O_RDWR);
  while (1) {
    read(fd, (char *)&data, 1);
    tmp = data;
    data /= 10;
    show_print(data, 50, tmp);
    fflush(stdout);
    sleep(1);
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
lea    0xe91(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    $0x32,%esi
call   1040 <show_print@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1177 <main+0x27>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
lea    0xe97(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
lea    0xc(%rsp),%r14
mov    0x2e5c(%rip),%r15
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
movslq 0xc(%rsp),%rdx
imul   $0x66666667,%rdx,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
mov    %edi,0xc(%rsp)
mov    $0x32,%esi
call   1040 <show_print@plt>
mov    (%r15),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1180 <main+0x30>

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/bmp180\00"
@O_RDWR = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %4
br label %8
8: ; preds = %0, %8
%9 = load i32, i32* %4
%10 = bitcast i32* %3 to i8*
%11 = call i32 @read(i32 %9, i8* %10, i32 1)
%12 = load i32, i32* %3
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = sdiv i32 %13, 10
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = call i32 @show_print(i32 %15, i32 50, i32 %16)
%18 = load i32, i32* @stdout
%19 = call i32 @fflush(i32 %18)
%20 = call i32 @sleep(i32 1)
br label %8
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/bmp180\00"
@O_RDWR = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @O_RDWR
%4 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %5
5: ; preds = %5, %0
%6 = call i32 @read(i32 %4, i8* %2, i32 1)
%7 = load i32, i32* %1
%8 = sdiv i32 %7, 10
store i32 %8, i32* %1
%9 = tail call i32 @show_print(i32 %8, i32 50, i32 %7)
%10 = load i32, i32* @stdout
%11 = tail call i32 @fflush(i32 %10)
%12 = tail call i32 @sleep(i32 1)
br label %5
}