#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*/ io_init(int);
int /*<<< orphan*/ io_invert_port(int, int);
int io_read_pin(int);
int /*<<< orphan*/ io_set_port_direction(int, int);
int /*<<< orphan*/ io_set_port_pullups(int, int);
int /*<<< orphan*/ printf(char *, 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);
  io_init(1);
  io_set_port_direction(0, 0xFF);
  io_set_port_direction(1, 0xFF);
  io_set_port_pullups(0, 0xFF);
  io_invert_port(0, 0xFF);
  io_set_port_pullups(1, 0xFF);
  io_invert_port(1, 0xFF);
  while (1) {
    clearscreen();
    printf("Pin 1: %x \n", io_read_pin(1));
    printf("Pin 2: %x \n", io_read_pin(2));
    printf("Pin 3: %x \n", io_read_pin(3));
    printf("Pin 4: %x \n", io_read_pin(4));
    printf("Pin 5: %x \n", io_read_pin(5));
    printf("Pin 6: %x \n", io_read_pin(6));
    printf("Pin 7: %x \n", io_read_pin(7));
    printf("Pin 8: %x \n", io_read_pin(8));
    printf("Pin 9: %x \n", io_read_pin(9));
    printf("Pin 10: %x \n", io_read_pin(10));
    printf("Pin 11: %x \n", io_read_pin(11));
    printf("Pin 12: %x \n", io_read_pin(12));
    printf("Pin 13: %x \n", io_read_pin(13));
    printf("Pin 14: %x \n", io_read_pin(14));
    printf("Pin 15: %x \n", io_read_pin(15));
    printf("Pin 16: %x \n", io_read_pin(16));
    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    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    0x2e32(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1080 <setvbuf@plt>
mov    $0x1,%edi
call   1060 <io_init@plt>
xor    %edi,%edi
mov    $0xff,%esi
call   1030 <io_set_port_direction@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   1030 <io_set_port_direction@plt>
xor    %edi,%edi
mov    $0xff,%esi
call   1090 <io_set_port_pullups@plt>
xor    %edi,%edi
mov    $0xff,%esi
call   1050 <io_invert_port@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   1090 <io_set_port_pullups@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   1050 <io_invert_port@plt>
mov    $0x0,%al
call   1040 <clearscreen@plt>
mov    $0x1,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xdc8(%rip),%rdi
call   1070 <printf@plt>
mov    $0x2,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xdbc(%rip),%rdi
call   1070 <printf@plt>
mov    $0x3,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xdb0(%rip),%rdi
call   1070 <printf@plt>
mov    $0x4,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xda4(%rip),%rdi
call   1070 <printf@plt>
mov    $0x5,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd98(%rip),%rdi
call   1070 <printf@plt>
mov    $0x6,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd8c(%rip),%rdi
call   1070 <printf@plt>
mov    $0x7,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd80(%rip),%rdi
call   1070 <printf@plt>
mov    $0x8,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd74(%rip),%rdi
call   1070 <printf@plt>
mov    $0x9,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd68(%rip),%rdi
call   1070 <printf@plt>
mov    $0xa,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd5c(%rip),%rdi
call   1070 <printf@plt>
mov    $0xb,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd51(%rip),%rdi
call   1070 <printf@plt>
mov    $0xc,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd46(%rip),%rdi
call   1070 <printf@plt>
mov    $0xd,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd3b(%rip),%rdi
call   1070 <printf@plt>
mov    $0xe,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd30(%rip),%rdi
call   1070 <printf@plt>
mov    $0xf,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd25(%rip),%rdi
call   1070 <printf@plt>
mov    $0x10,%edi
call   10a0 <io_read_pin@plt>
mov    %eax,%esi
lea    0xd1a(%rip),%rdi
call   1070 <printf@plt>
mov    $0x30d40,%edi
call   10b0 <usleep@plt>
jmp    121e <main+0x8e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1080 <setvbuf@plt>
mov    $0x1,%edi
call   1060 <io_init@plt>
xor    %edi,%edi
mov    $0xff,%esi
call   1030 <io_set_port_direction@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   1030 <io_set_port_direction@plt>
xor    %edi,%edi
mov    $0xff,%esi
call   1090 <io_set_port_pullups@plt>
xor    %edi,%edi
mov    $0xff,%esi
call   1050 <io_invert_port@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   1090 <io_set_port_pullups@plt>
mov    $0x1,%edi
mov    $0xff,%esi
call   1050 <io_invert_port@plt>
lea    0xe61(%rip),%rbx
lea    0xe67(%rip),%rbp
lea    0xe6d(%rip),%r14
lea    0xe73(%rip),%r15
lea    0xe79(%rip),%r12
lea    0xe7f(%rip),%r13
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <clearscreen@plt>
mov    $0x1,%edi
call   10a0 <io_read_pin@plt>
lea    0xda8(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x2,%edi
call   10a0 <io_read_pin@plt>
lea    0xd9c(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x3,%edi
call   10a0 <io_read_pin@plt>
lea    0xd90(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x4,%edi
call   10a0 <io_read_pin@plt>
lea    0xd84(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x5,%edi
call   10a0 <io_read_pin@plt>
lea    0xd78(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x6,%edi
call   10a0 <io_read_pin@plt>
lea    0xd6c(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x7,%edi
call   10a0 <io_read_pin@plt>
lea    0xd60(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x8,%edi
call   10a0 <io_read_pin@plt>
lea    0xd54(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x9,%edi
call   10a0 <io_read_pin@plt>
lea    0xd48(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0xa,%edi
call   10a0 <io_read_pin@plt>
lea    0xd3c(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0xb,%edi
call   10a0 <io_read_pin@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0xc,%edi
call   10a0 <io_read_pin@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0xd,%edi
call   10a0 <io_read_pin@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0xe,%edi
call   10a0 <io_read_pin@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0xf,%edi
call   10a0 <io_read_pin@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x10,%edi
call   10a0 <io_read_pin@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x30d40,%edi
call   10b0 <usleep@plt>
jmp    1240 <main+0xb0>

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [12 x i8] c"Pin 1: %x \0A\00"
@.str.1 = [12 x i8] c"Pin 2: %x \0A\00"
@.str.2 = [12 x i8] c"Pin 3: %x \0A\00"
@.str.3 = [12 x i8] c"Pin 4: %x \0A\00"
@.str.4 = [12 x i8] c"Pin 5: %x \0A\00"
@.str.5 = [12 x i8] c"Pin 6: %x \0A\00"
@.str.6 = [12 x i8] c"Pin 7: %x \0A\00"
@.str.7 = [12 x i8] c"Pin 8: %x \0A\00"
@.str.8 = [12 x i8] c"Pin 9: %x \0A\00"
@.str.9 = [13 x i8] c"Pin 10: %x \0A\00"
@.str.10 = [13 x i8] c"Pin 11: %x \0A\00"
@.str.11 = [13 x i8] c"Pin 12: %x \0A\00"
@.str.12 = [13 x i8] c"Pin 13: %x \0A\00"
@.str.13 = [13 x i8] c"Pin 14: %x \0A\00"
@.str.14 = [13 x i8] c"Pin 15: %x \0A\00"
@.str.15 = [13 x i8] c"Pin 16: %x \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)
%9 = call i32 @io_init(i32 1)
%10 = call i32 @io_set_port_direction(i32 0, i32 255)
%11 = call i32 @io_set_port_direction(i32 1, i32 255)
%12 = call i32 @io_set_port_pullups(i32 0, i32 255)
%13 = call i32 @io_invert_port(i32 0, i32 255)
%14 = call i32 @io_set_port_pullups(i32 1, i32 255)
%15 = call i32 @io_invert_port(i32 1, i32 255)
br label %16
16: ; preds = %2, %16
%17 = call i32 (...) @clearscreen()
%18 = call i32 @io_read_pin(i32 1)
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 @io_read_pin(i32 2)
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @io_read_pin(i32 3)
%23 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = call i32 @io_read_pin(i32 4)
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = call i32 @io_read_pin(i32 5)
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = call i32 @io_read_pin(i32 6)
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = call i32 @io_read_pin(i32 7)
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%32 = call i32 @io_read_pin(i32 8)
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = call i32 @io_read_pin(i32 9)
%35 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = call i32 @io_read_pin(i32 10)
%37 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %36)
%38 = call i32 @io_read_pin(i32 11)
%39 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %38)
%40 = call i32 @io_read_pin(i32 12)
%41 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %40)
%42 = call i32 @io_read_pin(i32 13)
%43 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %42)
%44 = call i32 @io_read_pin(i32 14)
%45 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %44)
%46 = call i32 @io_read_pin(i32 15)
%47 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 %46)
%48 = call i32 @io_read_pin(i32 16)
%49 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i32 %48)
%50 = call i32 @usleep(i32 200000)
br label %16
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [12 x i8] c"Pin 1: %x \0A\00"
@.str.1 = [12 x i8] c"Pin 2: %x \0A\00"
@.str.2 = [12 x i8] c"Pin 3: %x \0A\00"
@.str.3 = [12 x i8] c"Pin 4: %x \0A\00"
@.str.4 = [12 x i8] c"Pin 5: %x \0A\00"
@.str.5 = [12 x i8] c"Pin 6: %x \0A\00"
@.str.6 = [12 x i8] c"Pin 7: %x \0A\00"
@.str.7 = [12 x i8] c"Pin 8: %x \0A\00"
@.str.8 = [12 x i8] c"Pin 9: %x \0A\00"
@.str.9 = [13 x i8] c"Pin 10: %x \0A\00"
@.str.10 = [13 x i8] c"Pin 11: %x \0A\00"
@.str.11 = [13 x i8] c"Pin 12: %x \0A\00"
@.str.12 = [13 x i8] c"Pin 13: %x \0A\00"
@.str.13 = [13 x i8] c"Pin 14: %x \0A\00"
@.str.14 = [13 x i8] c"Pin 15: %x \0A\00"
@.str.15 = [13 x i8] c"Pin 16: %x \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)
%6 = tail call i32 @io_init(i32 1)
%7 = tail call i32 @io_set_port_direction(i32 0, i32 255)
%8 = tail call i32 @io_set_port_direction(i32 1, i32 255)
%9 = tail call i32 @io_set_port_pullups(i32 0, i32 255)
%10 = tail call i32 @io_invert_port(i32 0, i32 255)
%11 = tail call i32 @io_set_port_pullups(i32 1, i32 255)
%12 = tail call i32 @io_invert_port(i32 1, i32 255)
br label %13
13: ; preds = %2, %13
%14 = tail call i32 (...) @clearscreen()
%15 = tail call i32 @io_read_pin(i32 1)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = tail call i32 @io_read_pin(i32 2)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = tail call i32 @io_read_pin(i32 3)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = tail call i32 @io_read_pin(i32 4)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = tail call i32 @io_read_pin(i32 5)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = tail call i32 @io_read_pin(i32 6)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = tail call i32 @io_read_pin(i32 7)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %27)
%29 = tail call i32 @io_read_pin(i32 8)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = tail call i32 @io_read_pin(i32 9)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = tail call i32 @io_read_pin(i32 10)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %33)
%35 = tail call i32 @io_read_pin(i32 11)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %35)
%37 = tail call i32 @io_read_pin(i32 12)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %37)
%39 = tail call i32 @io_read_pin(i32 13)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %39)
%41 = tail call i32 @io_read_pin(i32 14)
%42 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %41)
%43 = tail call i32 @io_read_pin(i32 15)
%44 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 %43)
%45 = tail call i32 @io_read_pin(i32 16)
%46 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i32 %45)
%47 = tail call i32 @usleep(i32 200000)
br label %13
}