#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 */
unsigned char inb(int);
int /*<<< orphan*/ print_debug(char *);
int /*<<< orphan*/ print_debug_hex8(unsigned char);
int /*<<< orphan*/ print_reg(unsigned char);
int /*<<< orphan*/ setup_func(int);
void siodump(void) {
  int i;
  unsigned char data;
  print_debug("\n*** SERVER I/O REGISTERS ***\n");
  for (i = 0x10; i <= 0x2d; i++) {
    print_reg((unsigned char)i);
  }
  print_debug("\n***  GPIO REGISTERS ***\n");
  setup_func(0x07);
  for (i = 0xf0; i <= 0xf8; i++) {
    print_reg((unsigned char)i);
  }
  print_debug("\n***  GPIO VALUES ***\n");
  data = inb(0x68a);
  print_debug("\nGPDO 4: 0x");
  print_debug_hex8(data);
  data = inb(0x68b);
  print_debug("\nGPDI 4: 0x");
  print_debug_hex8(data);
  print_debug("\n");
  return;
}


x86 assembly (clang, -O0):
<siodump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1070 <print_debug@plt>
movl   $0x10,-0x4(%rbp)
cmpl   $0x2d,-0x4(%rbp)
jg     118e <siodump+0x3e>
mov    -0x4(%rbp),%eax
movzbl %al,%edi
call   1040 <print_reg@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116b <siodump+0x1b>
lea    0xe8a(%rip),%rdi
call   1070 <print_debug@plt>
mov    $0x7,%edi
call   1060 <setup_func@plt>
movl   $0xf0,-0x4(%rbp)
cmpl   $0xf8,-0x4(%rbp)
jg     11d1 <siodump+0x81>
mov    -0x4(%rbp),%eax
movzbl %al,%edi
call   1040 <print_reg@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ab <siodump+0x5b>
lea    0xe61(%rip),%rdi
call   1070 <print_debug@plt>
mov    $0x68a,%edi
call   1050 <inb@plt>
mov    %al,-0x5(%rbp)
lea    0xe5f(%rip),%rdi
call   1070 <print_debug@plt>
movzbl -0x5(%rbp),%edi
call   1030 <print_debug_hex8@plt>
mov    $0x68b,%edi
call   1050 <inb@plt>
mov    %al,-0x5(%rbp)
lea    0xe49(%rip),%rdi
call   1070 <print_debug@plt>
movzbl -0x5(%rbp),%edi
call   1030 <print_debug_hex8@plt>
lea    0xe26(%rip),%rdi
call   1070 <print_debug@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<siodump>:
push   %rbx
lea    0xea8(%rip),%rdi
call   1070 <print_debug@plt>
mov    $0x10,%edi
call   1040 <print_reg@plt>
mov    $0x11,%edi
call   1040 <print_reg@plt>
mov    $0x12,%edi
call   1040 <print_reg@plt>
mov    $0x13,%edi
call   1040 <print_reg@plt>
mov    $0x14,%edi
call   1040 <print_reg@plt>
mov    $0x15,%edi
call   1040 <print_reg@plt>
mov    $0x16,%edi
call   1040 <print_reg@plt>
mov    $0x17,%edi
call   1040 <print_reg@plt>
mov    $0x18,%edi
call   1040 <print_reg@plt>
mov    $0x19,%edi
call   1040 <print_reg@plt>
mov    $0x1a,%edi
call   1040 <print_reg@plt>
mov    $0x1b,%edi
call   1040 <print_reg@plt>
mov    $0x1c,%edi
call   1040 <print_reg@plt>
mov    $0x1d,%edi
call   1040 <print_reg@plt>
mov    $0x1e,%edi
call   1040 <print_reg@plt>
mov    $0x1f,%edi
call   1040 <print_reg@plt>
mov    $0x20,%edi
call   1040 <print_reg@plt>
mov    $0x21,%edi
call   1040 <print_reg@plt>
mov    $0x22,%edi
call   1040 <print_reg@plt>
mov    $0x23,%edi
call   1040 <print_reg@plt>
mov    $0x24,%edi
call   1040 <print_reg@plt>
mov    $0x25,%edi
call   1040 <print_reg@plt>
mov    $0x26,%edi
call   1040 <print_reg@plt>
mov    $0x27,%edi
call   1040 <print_reg@plt>
mov    $0x28,%edi
call   1040 <print_reg@plt>
mov    $0x29,%edi
call   1040 <print_reg@plt>
mov    $0x2a,%edi
call   1040 <print_reg@plt>
mov    $0x2b,%edi
call   1040 <print_reg@plt>
mov    $0x2c,%edi
call   1040 <print_reg@plt>
mov    $0x2d,%edi
call   1040 <print_reg@plt>
lea    0xd8f(%rip),%rdi
call   1070 <print_debug@plt>
mov    $0x7,%edi
call   1060 <setup_func@plt>
mov    $0xf0,%edi
call   1040 <print_reg@plt>
mov    $0xf1,%edi
call   1040 <print_reg@plt>
mov    $0xf2,%edi
call   1040 <print_reg@plt>
mov    $0xf3,%edi
call   1040 <print_reg@plt>
mov    $0xf4,%edi
call   1040 <print_reg@plt>
mov    $0xf5,%edi
call   1040 <print_reg@plt>
mov    $0xf6,%edi
call   1040 <print_reg@plt>
mov    $0xf7,%edi
call   1040 <print_reg@plt>
mov    $0xf8,%edi
call   1040 <print_reg@plt>
lea    0xd39(%rip),%rdi
call   1070 <print_debug@plt>
mov    $0x68a,%edi
call   1050 <inb@plt>
mov    %eax,%ebx
lea    0xd38(%rip),%rdi
call   1070 <print_debug@plt>
movzbl %bl,%edi
call   1030 <print_debug_hex8@plt>
mov    $0x68b,%edi
call   1050 <inb@plt>
mov    %eax,%ebx
lea    0xd24(%rip),%rdi
call   1070 <print_debug@plt>
movzbl %bl,%edi
call   1030 <print_debug_hex8@plt>
lea    0xd02(%rip),%rdi
pop    %rbx
jmp    1070 <print_debug@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"\0A*** SERVER I/O REGISTERS ***\0A\00"
@.str.1 = [26 x i8] c"\0A*** GPIO REGISTERS ***\0A\00"
@.str.2 = [23 x i8] c"\0A*** GPIO VALUES ***\0A\00"
@.str.3 = [12 x i8] c"\0AGPDO 4: 0x\00"
@.str.4 = [12 x i8] c"\0AGPDI 4: 0x\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @siodump() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @print_debug(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 16, i32* %1
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %1
%6 = icmp sle i32 %5, 45
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %1
%9 = trunc i32 %8 to i8
%10 = call i32 @print_reg(i8 zeroext %9)
br label %11
11: ; preds = %7
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %4
14: ; preds = %4
%15 = call i32 @print_debug(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @setup_func(i32 7)
store i32 240, i32* %1
br label %17
17: ; preds = %24, %14
%18 = load i32, i32* %1
%19 = icmp sle i32 %18, 248
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %1
%22 = trunc i32 %21 to i8
%23 = call i32 @print_reg(i8 zeroext %22)
br label %24
24: ; preds = %20
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %17
27: ; preds = %17
%28 = call i32 @print_debug(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%29 = call zeroext i8 @inb(i32 1674)
store i8 %29, i8* %2
%30 = call i32 @print_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%31 = load i8, i8* %2
%32 = call i32 @print_debug_hex8(i8 zeroext %31)
%33 = call zeroext i8 @inb(i32 1675)
store i8 %33, i8* %2
%34 = call i32 @print_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%35 = load i8, i8* %2
%36 = call i32 @print_debug_hex8(i8 zeroext %35)
%37 = call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"\0A*** SERVER I/O REGISTERS ***\0A\00"
@.str.1 = [26 x i8] c"\0A*** GPIO REGISTERS ***\0A\00"
@.str.2 = [23 x i8] c"\0A*** GPIO VALUES ***\0A\00"
@.str.3 = [12 x i8] c"\0AGPDO 4: 0x\00"
@.str.4 = [12 x i8] c"\0AGPDI 4: 0x\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @siodump() {
%1 = tail call i32 @print_debug(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_reg(i8 zeroext 16)
%3 = tail call i32 @print_reg(i8 zeroext 17)
%4 = tail call i32 @print_reg(i8 zeroext 18)
%5 = tail call i32 @print_reg(i8 zeroext 19)
%6 = tail call i32 @print_reg(i8 zeroext 20)
%7 = tail call i32 @print_reg(i8 zeroext 21)
%8 = tail call i32 @print_reg(i8 zeroext 22)
%9 = tail call i32 @print_reg(i8 zeroext 23)
%10 = tail call i32 @print_reg(i8 zeroext 24)
%11 = tail call i32 @print_reg(i8 zeroext 25)
%12 = tail call i32 @print_reg(i8 zeroext 26)
%13 = tail call i32 @print_reg(i8 zeroext 27)
%14 = tail call i32 @print_reg(i8 zeroext 28)
%15 = tail call i32 @print_reg(i8 zeroext 29)
%16 = tail call i32 @print_reg(i8 zeroext 30)
%17 = tail call i32 @print_reg(i8 zeroext 31)
%18 = tail call i32 @print_reg(i8 zeroext 32)
%19 = tail call i32 @print_reg(i8 zeroext 33)
%20 = tail call i32 @print_reg(i8 zeroext 34)
%21 = tail call i32 @print_reg(i8 zeroext 35)
%22 = tail call i32 @print_reg(i8 zeroext 36)
%23 = tail call i32 @print_reg(i8 zeroext 37)
%24 = tail call i32 @print_reg(i8 zeroext 38)
%25 = tail call i32 @print_reg(i8 zeroext 39)
%26 = tail call i32 @print_reg(i8 zeroext 40)
%27 = tail call i32 @print_reg(i8 zeroext 41)
%28 = tail call i32 @print_reg(i8 zeroext 42)
%29 = tail call i32 @print_reg(i8 zeroext 43)
%30 = tail call i32 @print_reg(i8 zeroext 44)
%31 = tail call i32 @print_reg(i8 zeroext 45)
%32 = tail call i32 @print_debug(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%33 = tail call i32 @setup_func(i32 7)
%34 = tail call i32 @print_reg(i8 zeroext -16)
%35 = tail call i32 @print_reg(i8 zeroext -15)
%36 = tail call i32 @print_reg(i8 zeroext -14)
%37 = tail call i32 @print_reg(i8 zeroext -13)
%38 = tail call i32 @print_reg(i8 zeroext -12)
%39 = tail call i32 @print_reg(i8 zeroext -11)
%40 = tail call i32 @print_reg(i8 zeroext -10)
%41 = tail call i32 @print_reg(i8 zeroext -9)
%42 = tail call i32 @print_reg(i8 zeroext -8)
%43 = tail call i32 @print_debug(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%44 = tail call zeroext i8 @inb(i32 1674)
%45 = tail call i32 @print_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%46 = tail call i32 @print_debug_hex8(i8 zeroext %44)
%47 = tail call zeroext i8 @inb(i32 1675)
%48 = tail call i32 @print_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%49 = tail call i32 @print_debug_hex8(i8 zeroext %47)
%50 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}