#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*/ _IONBF;
int /*<<< orphan*/ clearscreen();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read_raw(int, int, int, int, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  setvbuf(stdout, NULL, _IONBF, 0);
  while (1) {
    clearscreen();
    printf("Pin 1: %lu \n", read_raw(0x68, 1, 18, 1, 1));
    printf("Pin 2: %lu \n", read_raw(0x68, 2, 16, 1, 1));
    printf("Pin 3: %lu \n", read_raw(0x68, 3, 14, 1, 1));
    printf("Pin 4: %lu \n", read_raw(0x68, 4, 12, 1, 1));
    printf("Pin 5: %lu \n", read_raw(0x69, 1, 12, 1, 1));
    printf("Pin 6: %lu \n", read_raw(0x69, 2, 12, 1, 1));
    printf("Pin 7: %lu \n", read_raw(0x69, 3, 12, 1, 1));
    printf("Pin 8: %lu \n", read_raw(0x69, 4, 12, 1, 1));
    usleep(200000);
  }
  (void)argc;
  (void)argv;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1060 <setvbuf@plt>
mov    $0x0,%al
call   1040 <clearscreen@plt>
mov    $0x68,%edi
mov    $0x1,%r8d
mov    $0x12,%edx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xe52(%rip),%rdi
call   1050 <printf@plt>
mov    $0x68,%edi
mov    $0x2,%esi
mov    $0x10,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xe34(%rip),%rdi
call   1050 <printf@plt>
mov    $0x68,%edi
mov    $0x3,%esi
mov    $0xe,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xe16(%rip),%rdi
call   1050 <printf@plt>
mov    $0x68,%edi
mov    $0x4,%esi
mov    $0xc,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xdf8(%rip),%rdi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x1,%r8d
mov    $0xc,%edx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xddc(%rip),%rdi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x2,%esi
mov    $0xc,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xdbe(%rip),%rdi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x3,%esi
mov    $0xc,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xda0(%rip),%rdi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x4,%esi
mov    $0xc,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <read_raw@plt>
mov    %eax,%esi
lea    0xd82(%rip),%rdi
call   1050 <printf@plt>
mov    $0x30d40,%edi
call   1070 <usleep@plt>
jmp    1183 <main+0x33>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1060 <setvbuf@plt>
lea    0xe9d(%rip),%r12
lea    0xea3(%rip),%r13
lea    0xea9(%rip),%rbx
lea    0xeaf(%rip),%rbp
lea    0xeb5(%rip),%r14
lea    0xebb(%rip),%r15
xor    %eax,%eax
call   1040 <clearscreen@plt>
mov    $0x68,%edi
mov    $0x1,%esi
mov    $0x12,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
lea    0xe33(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x68,%edi
mov    $0x2,%esi
mov    $0x10,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
lea    0xe13(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x68,%edi
mov    $0x3,%esi
mov    $0xe,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x68,%edi
mov    $0x4,%esi
mov    $0xc,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x1,%esi
mov    $0xc,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x2,%esi
mov    $0xc,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x3,%esi
mov    $0xc,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x69,%edi
mov    $0x4,%esi
mov    $0xc,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <read_raw@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x30d40,%edi
call   1070 <usleep@plt>
jmp    11a0 <main+0x50>

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [13 x i8] c"Pin 1: %lu \0A\00"
@.str.1 = [13 x i8] c"Pin 2: %lu \0A\00"
@.str.2 = [13 x i8] c"Pin 3: %lu \0A\00"
@.str.3 = [13 x i8] c"Pin 4: %lu \0A\00"
@.str.4 = [13 x i8] c"Pin 5: %lu \0A\00"
@.str.5 = [13 x i8] c"Pin 6: %lu \0A\00"
@.str.6 = [13 x i8] c"Pin 7: %lu \0A\00"
@.str.7 = [13 x i8] c"Pin 8: %lu \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @stdout
%7 = load i32, i32* @_IONBF
%8 = call i32 @setvbuf(i32 %6, i32* null, i32 %7, i32 0)
br label %9
9: ; preds = %2, %9
%10 = call i32 (...) @clearscreen()
%11 = call i32 @read_raw(i32 104, i32 1, i32 18, i32 1, i32 1)
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @read_raw(i32 104, i32 2, i32 16, i32 1, i32 1)
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = call i32 @read_raw(i32 104, i32 3, i32 14, i32 1, i32 1)
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @read_raw(i32 104, i32 4, i32 12, i32 1, i32 1)
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = call i32 @read_raw(i32 105, i32 1, i32 12, i32 1, i32 1)
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = call i32 @read_raw(i32 105, i32 2, i32 12, i32 1, i32 1)
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %21)
%23 = call i32 @read_raw(i32 105, i32 3, i32 12, i32 1, i32 1)
%24 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %23)
%25 = call i32 @read_raw(i32 105, i32 4, i32 12, i32 1, i32 1)
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %25)
%27 = call i32 @usleep(i32 200000)
br label %9
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [13 x i8] c"Pin 1: %lu \0A\00"
@.str.1 = [13 x i8] c"Pin 2: %lu \0A\00"
@.str.2 = [13 x i8] c"Pin 3: %lu \0A\00"
@.str.3 = [13 x i8] c"Pin 4: %lu \0A\00"
@.str.4 = [13 x i8] c"Pin 5: %lu \0A\00"
@.str.5 = [13 x i8] c"Pin 6: %lu \0A\00"
@.str.6 = [13 x i8] c"Pin 7: %lu \0A\00"
@.str.7 = [13 x i8] c"Pin 8: %lu \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = load i32, i32* @_IONBF
%5 = tail call i32 @setvbuf(i32 %3, i32* null, i32 %4, i32 0)
br label %6
6: ; preds = %2, %6
%7 = tail call i32 (...) @clearscreen()
%8 = tail call i32 @read_raw(i32 104, i32 1, i32 18, i32 1, i32 1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @read_raw(i32 104, i32 2, i32 16, i32 1, i32 1)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 @read_raw(i32 104, i32 3, i32 14, i32 1, i32 1)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = tail call i32 @read_raw(i32 104, i32 4, i32 12, i32 1, i32 1)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = tail call i32 @read_raw(i32 105, i32 1, i32 12, i32 1, i32 1)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = tail call i32 @read_raw(i32 105, i32 2, i32 12, i32 1, i32 1)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = tail call i32 @read_raw(i32 105, i32 3, i32 12, i32 1, i32 1)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %20)
%22 = tail call i32 @read_raw(i32 105, i32 4, i32 12, i32 1, i32 1)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %22)
%24 = tail call i32 @usleep(i32 200000)
br label %6
}