#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ IOPi_init(int, int /*<<< orphan*/);
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ read_pin(int, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  setvbuf(stdout, NULL, _IONBF, 0);
  IOPi_init(0x20, 0);
  for (uint8_t a = 1; a < 17; a++) {
    read_pin(0x20, a);
  }
  (void)argc;
  (void)argv;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
mov    $0x20,%edi
xor    %esi,%esi
call   1050 <IOPi_init@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x11,-0x14(%rbp)
jge    119b <main+0x6b>
mov    -0x14(%rbp),%esi
mov    $0x20,%edi
call   1030 <read_pin@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1176 <main+0x46>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
mov    $0x20,%edi
xor    %esi,%esi
call   1050 <IOPi_init@plt>
mov    $0x20,%edi
mov    $0x1,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x2,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x3,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x4,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x5,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x6,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x7,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x8,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x9,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0xa,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0xb,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0xc,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0xd,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0xe,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0xf,%esi
call   1030 <read_pin@plt>
mov    $0x20,%edi
mov    $0x10,%esi
call   1030 <read_pin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdout
%8 = load i32, i32* @_IONBF
%9 = call i32 @setvbuf(i32 %7, i32* null, i32 %8, i32 0)
%10 = call i32 @IOPi_init(i32 32, i32 0)
store i32 1, i32* %6
br label %11
11: ; preds = %17, %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 17
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %6
%16 = call i32 @read_pin(i32 32, i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %11
20: ; preds = %11
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
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 @IOPi_init(i32 32, i32 0)
%7 = tail call i32 @read_pin(i32 32, i32 1)
%8 = tail call i32 @read_pin(i32 32, i32 2)
%9 = tail call i32 @read_pin(i32 32, i32 3)
%10 = tail call i32 @read_pin(i32 32, i32 4)
%11 = tail call i32 @read_pin(i32 32, i32 5)
%12 = tail call i32 @read_pin(i32 32, i32 6)
%13 = tail call i32 @read_pin(i32 32, i32 7)
%14 = tail call i32 @read_pin(i32 32, i32 8)
%15 = tail call i32 @read_pin(i32 32, i32 9)
%16 = tail call i32 @read_pin(i32 32, i32 10)
%17 = tail call i32 @read_pin(i32 32, i32 11)
%18 = tail call i32 @read_pin(i32 32, i32 12)
%19 = tail call i32 @read_pin(i32 32, i32 13)
%20 = tail call i32 @read_pin(i32 32, i32 14)
%21 = tail call i32 @read_pin(i32 32, i32 15)
%22 = tail call i32 @read_pin(i32 32, i32 16)
ret i32 0
}