#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*/ printf(char *, int);
int /*<<< orphan*/ usleep(int);
void toggle_io(volatile unsigned int *port) {
  int keyval = 0;
  int temp_key = 0;
  int flag = 0;
  while (1) {
    *port = 0x0000000E << 5;
    usleep(1000);
    temp_key = (*port & 0x000001eF);
    if ((keyval != temp_key) && ((temp_key & 0x0000000F) < 0xF)) {
      keyval = temp_key;
      flag = 1;
    }
    *port = 0x0000000D << 5;
    usleep(1000);
    temp_key = (*port & 0x000001eF);
    if ((keyval != temp_key) && ((temp_key & 0x0000000F) < 0xF)) {
      keyval = temp_key;
      flag = 1;
    }
    *port = 0x0000000B << 5;
    usleep(1000);
    temp_key = (*port & 0x000001eF);
    if ((keyval != temp_key) && ((temp_key & 0x0000000F) < 0xF)) {
      keyval = temp_key;
      flag = 1;
    }
    *port = 0x00000007 << 5;
    usleep(1);
    temp_key = (*port & 0x000001eF);
    if ((keyval != temp_key) && ((temp_key & 0x0000000F) < 0xF)) {
      keyval = temp_key;
      flag = 1;
    }
    printf("flag = %d\n", flag);
    if (flag) {
      switch (keyval) {
      case 0x1CE:
        printf("-> %d\n", keyval);
        break;
      case 0x1CD:
        printf("<- %d\n", keyval);
        break;
      case 0x1CB:
        printf("blank %d\n", keyval);
        break;
      case 0x1C7:
        printf(". %d\n", keyval);
        break;
      case 0x1AE:
        printf("9 %d\n", keyval);
        break;
      case 0x1AD:
        printf("6 %d\n", keyval);
        break;
      case 0x1AB:
        printf("3 %d\n", keyval);
        break;
      case 0x1A7:
        printf("ent %d\n", keyval);
        break;
      case 0x16E:
        printf("8 %d\n", keyval);
        break;
      case 0x16D:
        printf("5 %d\n", keyval);
        break;
      case 0x16B:
        printf("2 %d\n", keyval);
        break;
      case 0x167:
        printf("0 %d\n", keyval);
        break;
      case 0xEE:
        printf("7 %d\n", keyval);
        break;
      case 0xED:
        printf("4 %d\n", keyval);
        break;
      case 0xEB:
        printf("1 %d\n", keyval);
        break;
      case 0xE7:
        printf("clr %d\n", keyval);
        break;
      default:
        printf("keyval %d\n", keyval);
      }
      flag = 0;
    }
  }
}


x86 assembly (clang, -O0):
<toggle_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1c0,(%rax)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1ef,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     118b <toggle_io+0x6b>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    118b <toggle_io+0x6b>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1a0,(%rax)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1ef,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11d5 <toggle_io+0xb5>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    11d5 <toggle_io+0xb5>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x160,(%rax)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1ef,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     121f <toggle_io+0xff>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    121f <toggle_io+0xff>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xe0,(%rax)
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1ef,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1269 <toggle_io+0x149>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    1269 <toggle_io+0x149>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     150b <toggle_io+0x3eb>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xe7,%eax
je     14e1 <toggle_io+0x3c1>
jmp    1298 <toggle_io+0x178>
mov    -0x18(%rbp),%eax
sub    $0xeb,%eax
je     14cd <toggle_io+0x3ad>
jmp    12ab <toggle_io+0x18b>
mov    -0x18(%rbp),%eax
sub    $0xed,%eax
je     14b9 <toggle_io+0x399>
jmp    12be <toggle_io+0x19e>
mov    -0x18(%rbp),%eax
sub    $0xee,%eax
je     14a5 <toggle_io+0x385>
jmp    12d1 <toggle_io+0x1b1>
mov    -0x18(%rbp),%eax
sub    $0x167,%eax
je     1491 <toggle_io+0x371>
jmp    12e4 <toggle_io+0x1c4>
mov    -0x18(%rbp),%eax
sub    $0x16b,%eax
je     147d <toggle_io+0x35d>
jmp    12f7 <toggle_io+0x1d7>
mov    -0x18(%rbp),%eax
sub    $0x16d,%eax
je     1469 <toggle_io+0x349>
jmp    130a <toggle_io+0x1ea>
mov    -0x18(%rbp),%eax
sub    $0x16e,%eax
je     1455 <toggle_io+0x335>
jmp    131d <toggle_io+0x1fd>
mov    -0x18(%rbp),%eax
sub    $0x1a7,%eax
je     1441 <toggle_io+0x321>
jmp    1330 <toggle_io+0x210>
mov    -0x18(%rbp),%eax
sub    $0x1ab,%eax
je     142d <toggle_io+0x30d>
jmp    1343 <toggle_io+0x223>
mov    -0x18(%rbp),%eax
sub    $0x1ad,%eax
je     1419 <toggle_io+0x2f9>
jmp    1356 <toggle_io+0x236>
mov    -0x18(%rbp),%eax
sub    $0x1ae,%eax
je     1405 <toggle_io+0x2e5>
jmp    1369 <toggle_io+0x249>
mov    -0x18(%rbp),%eax
sub    $0x1c7,%eax
je     13f1 <toggle_io+0x2d1>
jmp    137c <toggle_io+0x25c>
mov    -0x18(%rbp),%eax
sub    $0x1cb,%eax
je     13dd <toggle_io+0x2bd>
jmp    138f <toggle_io+0x26f>
mov    -0x18(%rbp),%eax
sub    $0x1cd,%eax
je     13c9 <toggle_io+0x2a9>
jmp    13a2 <toggle_io+0x282>
mov    -0x18(%rbp),%eax
sub    $0x1ce,%eax
jne    14f5 <toggle_io+0x3d5>
jmp    13b5 <toggle_io+0x295>
mov    -0xc(%rbp),%esi
lea    0xc4c(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xc3f(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xc32(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xc28(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xc1a(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xc0c(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbfe(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbf0(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbe4(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbd6(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbc8(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbba(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xbac(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xb9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xb90(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xb82(%rip),%rdi
call   1030 <printf@plt>
jmp    1504 <toggle_io+0x3e4>
mov    -0xc(%rbp),%esi
lea    0xb76(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    1141 <toggle_io+0x21>

x86 assembly (clang, -O2):
<toggle_io>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r15d,%r15d
jmp    1150 <toggle_io+0x30>
lea    0x10db(%rip),%rdi
mov    $0x167,%esi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x1c0,(%rbx)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    (%rbx),%ecx
mov    %ecx,%eax
and    $0x1ef,%eax
cmp    %eax,%r15d
sete   %dl
not    %ecx
test   $0xf,%cl
sete   %r13b
or     %dl,%r13b
jne    1180 <toggle_io+0x60>
mov    %eax,%r15d
movl   $0x1a0,(%rbx)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    (%rbx),%ecx
mov    %ecx,%eax
and    $0x1ef,%eax
cmp    %eax,%r15d
sete   %dl
not    %ecx
test   $0xf,%cl
sete   %bpl
or     %dl,%bpl
jne    11b0 <toggle_io+0x90>
mov    %eax,%r15d
movl   $0x160,(%rbx)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    (%rbx),%ecx
mov    %ecx,%eax
and    $0x1ef,%eax
cmp    %eax,%r15d
sete   %dl
not    %ecx
test   $0xf,%cl
sete   %r12b
or     %dl,%r12b
jne    11e0 <toggle_io+0xc0>
mov    %eax,%r15d
movl   $0xe0,(%rbx)
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    (%rbx),%ecx
mov    %ecx,%eax
and    $0x1ef,%eax
cmp    %eax,%r15d
sete   %dl
not    %ecx
test   $0xf,%cl
sete   %r14b
or     %dl,%r14b
jne    1210 <toggle_io+0xf0>
mov    %eax,%r15d
and    %bpl,%r12b
and    %r13b,%r12b
and    %r12b,%r14b
mov    %r14d,%eax
xor    $0x1,%al
movzbl %al,%esi
lea    0xf98(%rip),%rdi
call   1030 <printf@plt>
test   %r14b,%r14b
jne    1150 <toggle_io+0x30>
lea    -0x167(%r15),%eax
cmp    $0x67,%eax
ja     1268 <toggle_io+0x148>
lea    0xdd7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfb6(%rip),%rdi
mov    $0x16b,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    -0xe7(%r15),%eax
cmp    $0x7,%eax
ja     137a <toggle_io+0x25a>
lea    0xd81(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf9e(%rip),%rdi
mov    $0xe7,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf64(%rip),%rdi
mov    $0x16d,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf48(%rip),%rdi
mov    $0x16e,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf2a(%rip),%rdi
mov    $0x1a7,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf0e(%rip),%rdi
mov    $0x1ab,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xef2(%rip),%rdi
mov    $0x1ad,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xed6(%rip),%rdi
mov    $0x1ae,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xeba(%rip),%rdi
mov    $0x1c7,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe9a(%rip),%rdi
mov    $0x1cb,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe7d(%rip),%rdi
mov    $0x1cd,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe60(%rip),%rdi
mov    $0x1ce,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xeb4(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe92(%rip),%rdi
mov    $0xeb,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe76(%rip),%rdi
mov    $0xed,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe5a(%rip),%rdi
mov    $0xee,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>

LLVM IR (-O0):
@.str = [11 x i8] c"flag = %d\0A\00"
@.str.1 = [7 x i8] c"-> %d\0A\00"
@.str.2 = [7 x i8] c"<- %d\0A\00"
@.str.3 = [10 x i8] c"blank %d\0A\00"
@.str.4 = [6 x i8] c". %d\0A\00"
@.str.5 = [6 x i8] c"9 %d\0A\00"
@.str.6 = [6 x i8] c"6 %d\0A\00"
@.str.7 = [6 x i8] c"3 %d\0A\00"
@.str.8 = [8 x i8] c"ent %d\0A\00"
@.str.9 = [6 x i8] c"8 %d\0A\00"
@.str.10 = [6 x i8] c"5 %d\0A\00"
@.str.11 = [6 x i8] c"2 %d\0A\00"
@.str.12 = [6 x i8] c"0 %d\0A\00"
@.str.13 = [6 x i8] c"7 %d\0A\00"
@.str.14 = [6 x i8] c"4 %d\0A\00"
@.str.15 = [6 x i8] c"1 %d\0A\00"
@.str.16 = [8 x i8] c"clr %d\0A\00"
@.str.17 = [11 x i8] c"keyval %d\0A\00"
define void @toggle_io(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %1, %125
%7 = load i32*, i32** %2
store volatile i32 448, i32* %7
%8 = call i32 @usleep(i32 1000)
%9 = load i32*, i32** %2
%10 = load volatile i32, i32* %9
%11 = and i32 %10, 495
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %6
%16 = load i32, i32* %4
%17 = and i32 %16, 15
%18 = icmp slt i32 %17, 15
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i32, i32* %4
store i32 %20, i32* %3
store i32 1, i32* %5
br label %21
21: ; preds = %19, %15, %6
%22 = load i32*, i32** %2
store volatile i32 416, i32* %22
%23 = call i32 @usleep(i32 1000)
%24 = load i32*, i32** %2
%25 = load volatile i32, i32* %24
%26 = and i32 %25, 495
store i32 %26, i32* %4
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = icmp ne i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %21
%31 = load i32, i32* %4
%32 = and i32 %31, 15
%33 = icmp slt i32 %32, 15
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load i32, i32* %4
store i32 %35, i32* %3
store i32 1, i32* %5
br label %36
36: ; preds = %34, %30, %21
%37 = load i32*, i32** %2
store volatile i32 352, i32* %37
%38 = call i32 @usleep(i32 1000)
%39 = load i32*, i32** %2
%40 = load volatile i32, i32* %39
%41 = and i32 %40, 495
store i32 %41, i32* %4
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = icmp ne i32 %42, %43
br i1 %44, label %45, label %51
45: ; preds = %36
%46 = load i32, i32* %4
%47 = and i32 %46, 15
%48 = icmp slt i32 %47, 15
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = load i32, i32* %4
store i32 %50, i32* %3
store i32 1, i32* %5
br label %51
51: ; preds = %49, %45, %36
%52 = load i32*, i32** %2
store volatile i32 224, i32* %52
%53 = call i32 @usleep(i32 1)
%54 = load i32*, i32** %2
%55 = load volatile i32, i32* %54
%56 = and i32 %55, 495
store i32 %56, i32* %4
%57 = load i32, i32* %3
%58 = load i32, i32* %4
%59 = icmp ne i32 %57, %58
br i1 %59, label %60, label %66
60: ; preds = %51
%61 = load i32, i32* %4
%62 = and i32 %61, 15
%63 = icmp slt i32 %62, 15
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = load i32, i32* %4
store i32 %65, i32* %3
store i32 1, i32* %5
br label %66
66: ; preds = %64, %60, %51
%67 = load i32, i32* %5
%68 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %5
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %125
71: ; preds = %66
%72 = load i32, i32* %3
switch i32 %72, label %121 [
i32 462, label %73
i32 461, label %76
i32 459, label %79
i32 455, label %82
i32 430, label %85
i32 429, label %88
i32 427, label %91
i32 423, label %94
i32 366, label %97
i32 365, label %100
i32 363, label %103
i32 359, label %106
i32 238, label %109
i32 237, label %112
i32 235, label %115
i32 231, label %118
]
73: ; preds = %71
%74 = load i32, i32* %3
%75 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %74)
br label %124
76: ; preds = %71
%77 = load i32, i32* %3
%78 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %77)
br label %124
79: ; preds = %71
%80 = load i32, i32* %3
%81 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %80)
br label %124
82: ; preds = %71
%83 = load i32, i32* %3
%84 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %83)
br label %124
85: ; preds = %71
%86 = load i32, i32* %3
%87 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %86)
br label %124
88: ; preds = %71
%89 = load i32, i32* %3
%90 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %89)
br label %124
91: ; preds = %71
%92 = load i32, i32* %3
%93 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %92)
br label %124
94: ; preds = %71
%95 = load i32, i32* %3
%96 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %95)
br label %124
97: ; preds = %71
%98 = load i32, i32* %3
%99 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 %98)
br label %124
100: ; preds = %71
%101 = load i32, i32* %3
%102 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %101)
br label %124
103: ; preds = %71
%104 = load i32, i32* %3
%105 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %104)
br label %124
106: ; preds = %71
%107 = load i32, i32* %3
%108 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %107)
br label %124
109: ; preds = %71
%110 = load i32, i32* %3
%111 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %110)
br label %124
112: ; preds = %71
%113 = load i32, i32* %3
%114 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 %113)
br label %124
115: ; preds = %71
%116 = load i32, i32* %3
%117 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i32 %116)
br label %124
118: ; preds = %71
%119 = load i32, i32* %3
%120 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32 %119)
br label %124
121: ; preds = %71
%122 = load i32, i32* %3
%123 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 %122)
br label %124
124: ; preds = %121, %118, %115, %112, %109, %106, %103, %100, %97, %94, %91, %88, %85, %82, %79, %76, %73
store i32 0, i32* %5
br label %125
125: ; preds = %124, %66
br label %6
}

LLVM IR (-O2):
@.str = [11 x i8] c"flag = %d\0A\00"
@.str.1 = [7 x i8] c"-> %d\0A\00"
@.str.2 = [7 x i8] c"<- %d\0A\00"
@.str.3 = [10 x i8] c"blank %d\0A\00"
@.str.4 = [6 x i8] c". %d\0A\00"
@.str.5 = [6 x i8] c"9 %d\0A\00"
@.str.6 = [6 x i8] c"6 %d\0A\00"
@.str.7 = [6 x i8] c"3 %d\0A\00"
@.str.8 = [8 x i8] c"ent %d\0A\00"
@.str.9 = [6 x i8] c"8 %d\0A\00"
@.str.10 = [6 x i8] c"5 %d\0A\00"
@.str.11 = [6 x i8] c"2 %d\0A\00"
@.str.12 = [6 x i8] c"0 %d\0A\00"
@.str.13 = [6 x i8] c"7 %d\0A\00"
@.str.14 = [6 x i8] c"4 %d\0A\00"
@.str.15 = [6 x i8] c"1 %d\0A\00"
@.str.16 = [8 x i8] c"clr %d\0A\00"
@.str.17 = [11 x i8] c"keyval %d\0A\00"
define void @toggle_io(i32* %0) {
br label %2
2: ; preds = %45, %1
%3 = phi i32 [ 0, %1 ], [ %35, %45 ]
store volatile i32 448, i32* %0
%4 = tail call i32 @usleep(i32 1000)
%5 = load volatile i32, i32* %0
%6 = and i32 %5, 495
%7 = icmp eq i32 %3, %6
%8 = and i32 %5, 15
%9 = icmp eq i32 %8, 15
%10 = or i1 %7, %9
%11 = select i1 %10, i32 %3, i32 %6
store volatile i32 416, i32* %0
%12 = tail call i32 @usleep(i32 1000)
%13 = load volatile i32, i32* %0
%14 = and i32 %13, 495
%15 = icmp eq i32 %11, %14
%16 = and i32 %13, 15
%17 = icmp eq i32 %16, 15
%18 = or i1 %15, %17
%19 = select i1 %18, i32 %11, i32 %14
store volatile i32 352, i32* %0
%20 = tail call i32 @usleep(i32 1000)
%21 = load volatile i32, i32* %0
%22 = and i32 %21, 495
%23 = icmp eq i32 %19, %22
%24 = and i32 %21, 15
%25 = icmp eq i32 %24, 15
%26 = or i1 %23, %25
%27 = select i1 %26, i32 %19, i32 %22
store volatile i32 224, i32* %0
%28 = tail call i32 @usleep(i32 1)
%29 = load volatile i32, i32* %0
%30 = and i32 %29, 495
%31 = icmp eq i32 %27, %30
%32 = and i32 %29, 15
%33 = icmp eq i32 %32, 15
%34 = or i1 %31, %33
%35 = select i1 %34, i32 %27, i32 %30
%36 = select i1 %34, i1 %26, i1 false
%37 = select i1 %36, i1 %18, i1 false
%38 = select i1 %37, i1 %10, i1 false
%39 = xor i1 %38, true
%40 = zext i1 %39 to i32
%41 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %40)
br i1 %38, label %45, label %42
42: ; preds = %2
switch i32 %35, label %76 [
i32 462, label %43
i32 461, label %46
i32 459, label %48
i32 455, label %50
i32 430, label %52
i32 429, label %54
i32 427, label %56
i32 423, label %58
i32 366, label %60
i32 365, label %62
i32 363, label %64
i32 359, label %66
i32 238, label %68
i32 237, label %70
i32 235, label %72
i32 231, label %74
]
43: ; preds = %42
%44 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 462)
br label %45
45: ; preds = %43, %46, %48, %50, %52, %54, %56, %58, %60, %62, %64, %66, %68, %70, %72, %74, %76, %2
br label %2
46: ; preds = %42
%47 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 461)
br label %45
48: ; preds = %42
%49 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 459)
br label %45
50: ; preds = %42
%51 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 455)
br label %45
52: ; preds = %42
%53 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 430)
br label %45
54: ; preds = %42
%55 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 429)
br label %45
56: ; preds = %42
%57 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 427)
br label %45
58: ; preds = %42
%59 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 423)
br label %45
60: ; preds = %42
%61 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 366)
br label %45
62: ; preds = %42
%63 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 365)
br label %45
64: ; preds = %42
%65 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 363)
br label %45
66: ; preds = %42
%67 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 359)
br label %45
68: ; preds = %42
%69 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 238)
br label %45
70: ; preds = %42
%71 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 237)
br label %45
72: ; preds = %42
%73 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i32 235)
br label %45
74: ; preds = %42
%75 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32 231)
br label %45
76: ; preds = %42
%77 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 %35)
br label %45
}