#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 inb(int);
int /*<<< orphan*/ outb(int, int);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ udelay(int);
int __kbdreset(void) {
  unsigned char c;
  int i, t;
  t = 2000;
  while ((inb(0x64) & 0x01)) {
    (void)inb(0x60);
    if (--t == 0)
      return 1;
  }
  t = 20000;
  while (inb(0x64) & 0x02)
    if (--t == 0)
      return 2;
  outb(0x64, 0xAA);
  t = 200000;
  while ((inb(0x64) & 0x01) == 0)
    if (--t == 0)
      return 3;
  if ((c = inb(0x60)) != 0x55) {
    printf("Keyboard self test failed - result: %02x", c);
  }
  t = 20000;
  while (inb(0x64) & 0x02)
    if (--t == 0)
      return 4;
  outb(0x64, 0x60);
  t = 20000;
  while (inb(0x64) & 0x02)
    if (--t == 0)
      return 5;
  outb(0x60, 0x45);
  for (i = 0; i < 10000; i++)
    udelay(1);
  t = 20000;
  while (inb(0x64) & 0x02)
    if (--t == 0)
      return 6;
  outb(0x64, 0x20);
  t = 200000;
  while ((inb(0x64) & 0x01) == 0)
    if (--t == 0)
      return 7;
  if (!(inb(0x60) & 0x40)) {
    t = 200000;
    while (inb(0x64) & (0x01 | 0x02))
      if (--t == 0)
        return 8;
    outb(0x60, 0xF0);
    t = 200000;
    while (inb(0x64) & (0x01 | 0x02))
      if (--t == 0)
        return 9;
    outb(0x60, 0x01);
  }
  t = 20000;
  while (inb(0x64) & 0x02)
    if (--t == 0)
      return 10;
  outb(0x64, 0xAE);
  return 0;
}


x86 assembly (clang, -O0):
<__kbdreset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7d0,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     1192 <__kbdreset+0x52>
mov    $0x60,%edi
call   1050 <inb@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    118d <__kbdreset+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    114f <__kbdreset+0xf>
movl   $0x4e20,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     11d2 <__kbdreset+0x92>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    11cd <__kbdreset+0x8d>
movl   $0x2,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    1199 <__kbdreset+0x59>
mov    $0x64,%edi
mov    $0xaa,%esi
call   1040 <outb@plt>
movl   $0x30d40,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x1,%eax
cmp    $0x0,%eax
jne    1221 <__kbdreset+0xe1>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    121c <__kbdreset+0xdc>
movl   $0x3,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    11e8 <__kbdreset+0xa8>
mov    $0x60,%edi
call   1050 <inb@plt>
mov    %al,-0x5(%rbp)
movzbl %al,%eax
cmp    $0x55,%eax
je     124a <__kbdreset+0x10a>
lea    0xdbf(%rip),%rdi
movzbl -0x5(%rbp),%esi
call   1030 <printf@plt>
movl   $0x4e20,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     128a <__kbdreset+0x14a>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    1285 <__kbdreset+0x145>
movl   $0x4,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    1251 <__kbdreset+0x111>
mov    $0x64,%edi
mov    $0x60,%esi
call   1040 <outb@plt>
movl   $0x4e20,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     12d9 <__kbdreset+0x199>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    12d4 <__kbdreset+0x194>
movl   $0x5,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    12a0 <__kbdreset+0x160>
mov    $0x60,%edi
mov    $0x45,%esi
call   1040 <outb@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2710,-0xc(%rbp)
jge    1314 <__kbdreset+0x1d4>
mov    $0x1,%edi
call   1060 <udelay@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12ef <__kbdreset+0x1af>
movl   $0x4e20,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     1354 <__kbdreset+0x214>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    134f <__kbdreset+0x20f>
movl   $0x6,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    131b <__kbdreset+0x1db>
mov    $0x64,%edi
mov    $0x20,%esi
call   1040 <outb@plt>
movl   $0x30d40,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x1,%eax
cmp    $0x0,%eax
jne    13a3 <__kbdreset+0x263>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    139e <__kbdreset+0x25e>
movl   $0x7,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    136a <__kbdreset+0x22a>
mov    $0x60,%edi
call   1050 <inb@plt>
and    $0x40,%eax
cmp    $0x0,%eax
jne    1457 <__kbdreset+0x317>
movl   $0x30d40,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x3,%eax
cmp    $0x0,%eax
je     13f9 <__kbdreset+0x2b9>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    13f4 <__kbdreset+0x2b4>
movl   $0x8,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    13c0 <__kbdreset+0x280>
mov    $0x60,%edi
mov    $0xf0,%esi
call   1040 <outb@plt>
movl   $0x30d40,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x3,%eax
cmp    $0x0,%eax
je     1448 <__kbdreset+0x308>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    1443 <__kbdreset+0x303>
movl   $0x9,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    140f <__kbdreset+0x2cf>
mov    $0x60,%edi
mov    $0x1,%esi
call   1040 <outb@plt>
movl   $0x4e20,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <inb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     1497 <__kbdreset+0x357>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    1492 <__kbdreset+0x352>
movl   $0xa,-0x4(%rbp)
jmp    14ad <__kbdreset+0x36d>
jmp    145e <__kbdreset+0x31e>
mov    $0x64,%edi
mov    $0xae,%esi
call   1040 <outb@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__kbdreset>:
push   %rbx
mov    $0xfffff830,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x1,%al
je     1173 <__kbdreset+0x33>
mov    $0x60,%edi
call   1050 <inb@plt>
inc    %ebx
jne    1150 <__kbdreset+0x10>
mov    $0x1,%eax
pop    %rbx
ret
mov    $0xffffb1e0,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x2,%al
je     1199 <__kbdreset+0x59>
inc    %ebx
jne    1180 <__kbdreset+0x40>
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x64,%edi
mov    $0xaa,%esi
call   1040 <outb@plt>
mov    $0xfffcf2c0,%ebx
nopl   (%rax)
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x1,%al
jne    11c9 <__kbdreset+0x89>
inc    %ebx
jne    11b0 <__kbdreset+0x70>
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x60,%edi
call   1050 <inb@plt>
cmp    $0x55,%al
je     11e6 <__kbdreset+0xa6>
movzbl %al,%esi
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffb1e0,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x2,%al
je     1209 <__kbdreset+0xc9>
inc    %ebx
jne    11f0 <__kbdreset+0xb0>
mov    $0x4,%eax
pop    %rbx
ret
mov    $0x64,%edi
mov    $0x60,%esi
call   1040 <outb@plt>
mov    $0xffffb1e0,%ebx
nopl   (%rax)
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x2,%al
je     1239 <__kbdreset+0xf9>
inc    %ebx
jne    1220 <__kbdreset+0xe0>
mov    $0x5,%eax
pop    %rbx
ret
mov    $0x60,%edi
mov    $0x45,%esi
call   1040 <outb@plt>
mov    $0x2710,%ebx
nopl   (%rax)
mov    $0x1,%edi
call   1060 <udelay@plt>
add    $0xffffffff,%ebx
jne    1250 <__kbdreset+0x110>
mov    $0xffffb1e0,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x2,%al
je     128c <__kbdreset+0x14c>
mov    $0x6,%eax
inc    %ebx
jne    1270 <__kbdreset+0x130>
jmp    1353 <__kbdreset+0x213>
mov    $0x64,%edi
mov    $0x20,%esi
call   1040 <outb@plt>
mov    $0xfffcf2c0,%ebx
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x1,%al
jne    12bc <__kbdreset+0x17c>
mov    $0x7,%eax
inc    %ebx
jne    12a0 <__kbdreset+0x160>
jmp    1353 <__kbdreset+0x213>
mov    $0x60,%edi
call   1050 <inb@plt>
test   $0x40,%al
jne    1324 <__kbdreset+0x1e4>
mov    $0xfffcf2c0,%ebx
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x3,%al
je     12e8 <__kbdreset+0x1a8>
mov    $0x8,%eax
inc    %ebx
jne    12cf <__kbdreset+0x18f>
jmp    1353 <__kbdreset+0x213>
mov    $0x60,%edi
mov    $0xf0,%esi
call   1040 <outb@plt>
mov    $0xfffcf2c0,%ebx
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x3,%al
je     1315 <__kbdreset+0x1d5>
mov    $0x9,%eax
inc    %ebx
jne    12fc <__kbdreset+0x1bc>
jmp    1353 <__kbdreset+0x213>
mov    $0x60,%edi
mov    $0x1,%esi
call   1040 <outb@plt>
mov    $0xffffb1e0,%ebx
mov    $0x64,%edi
call   1050 <inb@plt>
test   $0x2,%al
je     1342 <__kbdreset+0x202>
mov    $0xa,%eax
inc    %ebx
jne    1329 <__kbdreset+0x1e9>
jmp    1353 <__kbdreset+0x213>
mov    $0x64,%edi
mov    $0xae,%esi
call   1040 <outb@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Keyboard self test failed - result: %02x\00"
define i32 @__kbdreset() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i32 2000, i32* %4
br label %5
5: ; preds = %15, %0
%6 = call i32 @inb(i32 100)
%7 = and i32 %6, 1
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = call i32 @inb(i32 96)
%11 = load i32, i32* %4
%12 = add nsw i32 %11, -1
store i32 %12, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 1, i32* %1
br label %145
15: ; preds = %9
br label %5
16: ; preds = %5
store i32 20000, i32* %4
br label %17
17: ; preds = %26, %16
%18 = call i32 @inb(i32 100)
%19 = and i32 %18, 2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i32, i32* %4
%23 = add nsw i32 %22, -1
store i32 %23, i32* %4
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 2, i32* %1
br label %145
26: ; preds = %21
br label %17
27: ; preds = %17
%28 = call i32 @outb(i32 100, i32 170)
store i32 200000, i32* %4
br label %29
29: ; preds = %38, %27
%30 = call i32 @inb(i32 100)
%31 = and i32 %30, 1
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load i32, i32* %4
%35 = add nsw i32 %34, -1
store i32 %35, i32* %4
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 3, i32* %1
br label %145
38: ; preds = %33
br label %29
39: ; preds = %29
%40 = call i32 @inb(i32 96)
%41 = trunc i32 %40 to i8
store i8 %41, i8* %2
%42 = zext i8 %41 to i32
%43 = icmp ne i32 %42, 85
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i8, i8* %2
%46 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8 zeroext %45)
br label %47
47: ; preds = %44, %39
store i32 20000, i32* %4
br label %48
48: ; preds = %57, %47
%49 = call i32 @inb(i32 100)
%50 = and i32 %49, 2
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = load i32, i32* %4
%54 = add nsw i32 %53, -1
store i32 %54, i32* %4
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %52
store i32 4, i32* %1
br label %145
57: ; preds = %52
br label %48
58: ; preds = %48
%59 = call i32 @outb(i32 100, i32 96)
store i32 20000, i32* %4
br label %60
60: ; preds = %69, %58
%61 = call i32 @inb(i32 100)
%62 = and i32 %61, 2
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %60
%65 = load i32, i32* %4
%66 = add nsw i32 %65, -1
store i32 %66, i32* %4
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %64
store i32 5, i32* %1
br label %145
69: ; preds = %64
br label %60
70: ; preds = %60
%71 = call i32 @outb(i32 96, i32 69)
store i32 0, i32* %3
br label %72
72: ; preds = %77, %70
%73 = load i32, i32* %3
%74 = icmp slt i32 %73, 10000
br i1 %74, label %75, label %80
75: ; preds = %72
%76 = call i32 @udelay(i32 1)
br label %77
77: ; preds = %75
%78 = load i32, i32* %3
%79 = add nsw i32 %78, 1
store i32 %79, i32* %3
br label %72
80: ; preds = %72
store i32 20000, i32* %4
br label %81
81: ; preds = %90, %80
%82 = call i32 @inb(i32 100)
%83 = and i32 %82, 2
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = load i32, i32* %4
%87 = add nsw i32 %86, -1
store i32 %87, i32* %4
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %85
store i32 6, i32* %1
br label %145
90: ; preds = %85
br label %81
91: ; preds = %81
%92 = call i32 @outb(i32 100, i32 32)
store i32 200000, i32* %4
br label %93
93: ; preds = %102, %91
%94 = call i32 @inb(i32 100)
%95 = and i32 %94, 1
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %103
97: ; preds = %93
%98 = load i32, i32* %4
%99 = add nsw i32 %98, -1
store i32 %99, i32* %4
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %97
store i32 7, i32* %1
br label %145
102: ; preds = %97
br label %93
103: ; preds = %93
%104 = call i32 @inb(i32 96)
%105 = and i32 %104, 64
%106 = icmp ne i32 %105, 0
br i1 %106, label %132, label %107
107: ; preds = %103
store i32 200000, i32* %4
br label %108
108: ; preds = %117, %107
%109 = call i32 @inb(i32 100)
%110 = and i32 %109, 3
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %118
112: ; preds = %108
%113 = load i32, i32* %4
%114 = add nsw i32 %113, -1
store i32 %114, i32* %4
%115 = icmp eq i32 %114, 0
br i1 %115, label %116, label %117
116: ; preds = %112
store i32 8, i32* %1
br label %145
117: ; preds = %112
br label %108
118: ; preds = %108
%119 = call i32 @outb(i32 96, i32 240)
store i32 200000, i32* %4
br label %120
120: ; preds = %129, %118
%121 = call i32 @inb(i32 100)
%122 = and i32 %121, 3
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %130
124: ; preds = %120
%125 = load i32, i32* %4
%126 = add nsw i32 %125, -1
store i32 %126, i32* %4
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %129
128: ; preds = %124
store i32 9, i32* %1
br label %145
129: ; preds = %124
br label %120
130: ; preds = %120
%131 = call i32 @outb(i32 96, i32 1)
br label %132
132: ; preds = %130, %103
store i32 20000, i32* %4
br label %133
133: ; preds = %142, %132
%134 = call i32 @inb(i32 100)
%135 = and i32 %134, 2
%136 = icmp ne i32 %135, 0
br i1 %136, label %137, label %143
137: ; preds = %133
%138 = load i32, i32* %4
%139 = add nsw i32 %138, -1
store i32 %139, i32* %4
%140 = icmp eq i32 %139, 0
br i1 %140, label %141, label %142
141: ; preds = %137
store i32 10, i32* %1
br label %145
142: ; preds = %137
br label %133
143: ; preds = %133
%144 = call i32 @outb(i32 100, i32 174)
store i32 0, i32* %1
br label %145
145: ; preds = %143, %141, %128, %116, %101, %89, %68, %56, %37, %25, %14
%146 = load i32, i32* %1
ret i32 %146
}

LLVM IR (-O2):
@.str = [41 x i8] c"Keyboard self test failed - result: %02x\00"
define i32 @__kbdreset() {
br label %1
1: ; preds = %6, %0
%2 = phi i32 [ 2000, %0 ], [ %8, %6 ]
%3 = tail call i32 @inb(i32 100)
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = tail call i32 @inb(i32 96)
%8 = add nsw i32 %2, -1
%9 = icmp eq i32 %8, 0
br i1 %9, label %114, label %1
10: ; preds = %1, %15
%11 = phi i32 [ %16, %15 ], [ 20000, %1 ]
%12 = tail call i32 @inb(i32 100)
%13 = and i32 %12, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = add nsw i32 %11, -1
%17 = icmp eq i32 %16, 0
br i1 %17, label %114, label %10
18: ; preds = %10
%19 = tail call i32 @outb(i32 100, i32 170)
br label %20
20: ; preds = %25, %18
%21 = phi i32 [ 200000, %18 ], [ %26, %25 ]
%22 = tail call i32 @inb(i32 100)
%23 = and i32 %22, 1
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = add nsw i32 %21, -1
%27 = icmp eq i32 %26, 0
br i1 %27, label %114, label %20
28: ; preds = %20
%29 = tail call i32 @inb(i32 96)
%30 = and i32 %29, 255
%31 = icmp eq i32 %30, 85
br i1 %31, label %35, label %32
32: ; preds = %28
%33 = trunc i32 %29 to i8
%34 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8 zeroext %33)
br label %35
35: ; preds = %32, %28
br label %36
36: ; preds = %35, %41
%37 = phi i32 [ %42, %41 ], [ 20000, %35 ]
%38 = tail call i32 @inb(i32 100)
%39 = and i32 %38, 2
%40 = icmp eq i32 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %36
%42 = add nsw i32 %37, -1
%43 = icmp eq i32 %42, 0
br i1 %43, label %114, label %36
44: ; preds = %36
%45 = tail call i32 @outb(i32 100, i32 96)
br label %46
46: ; preds = %51, %44
%47 = phi i32 [ 20000, %44 ], [ %52, %51 ]
%48 = tail call i32 @inb(i32 100)
%49 = and i32 %48, 2
%50 = icmp eq i32 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %46
%52 = add nsw i32 %47, -1
%53 = icmp eq i32 %52, 0
br i1 %53, label %114, label %46
54: ; preds = %46
%55 = tail call i32 @outb(i32 96, i32 69)
br label %56
56: ; preds = %54, %56
%57 = phi i32 [ 0, %54 ], [ %59, %56 ]
%58 = tail call i32 @udelay(i32 1)
%59 = add nuw nsw i32 %57, 1
%60 = icmp eq i32 %59, 10000
br i1 %60, label %61, label %56
61: ; preds = %56, %66
%62 = phi i32 [ %67, %66 ], [ 20000, %56 ]
%63 = tail call i32 @inb(i32 100)
%64 = and i32 %63, 2
%65 = icmp eq i32 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %61
%67 = add nsw i32 %62, -1
%68 = icmp eq i32 %67, 0
br i1 %68, label %114, label %61
69: ; preds = %61
%70 = tail call i32 @outb(i32 100, i32 32)
br label %71
71: ; preds = %76, %69
%72 = phi i32 [ 200000, %69 ], [ %77, %76 ]
%73 = tail call i32 @inb(i32 100)
%74 = and i32 %73, 1
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = add nsw i32 %72, -1
%78 = icmp eq i32 %77, 0
br i1 %78, label %114, label %71
79: ; preds = %71
%80 = tail call i32 @inb(i32 96)
%81 = and i32 %80, 64
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %103
83: ; preds = %79, %88
%84 = phi i32 [ %89, %88 ], [ 200000, %79 ]
%85 = tail call i32 @inb(i32 100)
%86 = and i32 %85, 3
%87 = icmp eq i32 %86, 0
br i1 %87, label %91, label %88
88: ; preds = %83
%89 = add nsw i32 %84, -1
%90 = icmp eq i32 %89, 0
br i1 %90, label %114, label %83
91: ; preds = %83
%92 = tail call i32 @outb(i32 96, i32 240)
br label %93
93: ; preds = %98, %91
%94 = phi i32 [ 200000, %91 ], [ %99, %98 ]
%95 = tail call i32 @inb(i32 100)
%96 = and i32 %95, 3
%97 = icmp eq i32 %96, 0
br i1 %97, label %101, label %98
98: ; preds = %93
%99 = add nsw i32 %94, -1
%100 = icmp eq i32 %99, 0
br i1 %100, label %114, label %93
101: ; preds = %93
%102 = tail call i32 @outb(i32 96, i32 1)
br label %103
103: ; preds = %101, %79
br label %104
104: ; preds = %103, %109
%105 = phi i32 [ %110, %109 ], [ 20000, %103 ]
%106 = tail call i32 @inb(i32 100)
%107 = and i32 %106, 2
%108 = icmp eq i32 %107, 0
br i1 %108, label %112, label %109
109: ; preds = %104
%110 = add nsw i32 %105, -1
%111 = icmp eq i32 %110, 0
br i1 %111, label %114, label %104
112: ; preds = %104
%113 = tail call i32 @outb(i32 100, i32 174)
br label %114
114: ; preds = %6, %15, %25, %41, %51, %66, %76, %88, %98, %109, %112
%115 = phi i32 [ 0, %112 ], [ 10, %109 ], [ 9, %98 ], [ 8, %88 ], [ 7, %76 ], [ 6, %66 ], [ 5, %51 ], [ 4, %41 ], [ 3, %25 ], [ 2, %15 ], [ 1, %6 ]
ret i32 %115
}