#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 flag = 0;
  while (1) {
    int keyval = 0;
    int temp_key = 0;
    *port = 0x0000000E << 5;
    usleep(1000);
    temp_key = (*port & 0x000001eF);
    printf("Temp key: %d \n", temp_key);
    printf("Keyval: %d \n", keyval);
    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);
      }
    }
  }
}


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,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11a9 <toggle_io+0x89>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    11a9 <toggle_io+0x89>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%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,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11f3 <toggle_io+0xd3>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    11f3 <toggle_io+0xd3>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%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,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     123d <toggle_io+0x11d>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    123d <toggle_io+0x11d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%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,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1287 <toggle_io+0x167>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
cmp    $0xf,%eax
jge    1287 <toggle_io+0x167>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd8b(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     1527 <toggle_io+0x407>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xe7,%eax
je     14ff <toggle_io+0x3df>
jmp    12b6 <toggle_io+0x196>
mov    -0x18(%rbp),%eax
sub    $0xeb,%eax
je     14eb <toggle_io+0x3cb>
jmp    12c9 <toggle_io+0x1a9>
mov    -0x18(%rbp),%eax
sub    $0xed,%eax
je     14d7 <toggle_io+0x3b7>
jmp    12dc <toggle_io+0x1bc>
mov    -0x18(%rbp),%eax
sub    $0xee,%eax
je     14c3 <toggle_io+0x3a3>
jmp    12ef <toggle_io+0x1cf>
mov    -0x18(%rbp),%eax
sub    $0x167,%eax
je     14af <toggle_io+0x38f>
jmp    1302 <toggle_io+0x1e2>
mov    -0x18(%rbp),%eax
sub    $0x16b,%eax
je     149b <toggle_io+0x37b>
jmp    1315 <toggle_io+0x1f5>
mov    -0x18(%rbp),%eax
sub    $0x16d,%eax
je     1487 <toggle_io+0x367>
jmp    1328 <toggle_io+0x208>
mov    -0x18(%rbp),%eax
sub    $0x16e,%eax
je     1473 <toggle_io+0x353>
jmp    133b <toggle_io+0x21b>
mov    -0x18(%rbp),%eax
sub    $0x1a7,%eax
je     145f <toggle_io+0x33f>
jmp    134e <toggle_io+0x22e>
mov    -0x18(%rbp),%eax
sub    $0x1ab,%eax
je     144b <toggle_io+0x32b>
jmp    1361 <toggle_io+0x241>
mov    -0x18(%rbp),%eax
sub    $0x1ad,%eax
je     1437 <toggle_io+0x317>
jmp    1374 <toggle_io+0x254>
mov    -0x18(%rbp),%eax
sub    $0x1ae,%eax
je     1423 <toggle_io+0x303>
jmp    1387 <toggle_io+0x267>
mov    -0x18(%rbp),%eax
sub    $0x1c7,%eax
je     140f <toggle_io+0x2ef>
jmp    139a <toggle_io+0x27a>
mov    -0x18(%rbp),%eax
sub    $0x1cb,%eax
je     13fb <toggle_io+0x2db>
jmp    13ad <toggle_io+0x28d>
mov    -0x18(%rbp),%eax
sub    $0x1cd,%eax
je     13e7 <toggle_io+0x2c7>
jmp    13c0 <toggle_io+0x2a0>
mov    -0x18(%rbp),%eax
sub    $0x1ce,%eax
jne    1513 <toggle_io+0x3f3>
jmp    13d3 <toggle_io+0x2b3>
mov    -0x10(%rbp),%esi
lea    0xc4a(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xc3d(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xc30(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xc26(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xc18(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xc0a(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbfc(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbee(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbe2(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbd4(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbc6(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbb8(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xbaa(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xb9c(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xb8e(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xb80(%rip),%rdi
call   1030 <printf@plt>
jmp    1522 <toggle_io+0x402>
mov    -0x10(%rbp),%esi
lea    0xb74(%rip),%rdi
call   1030 <printf@plt>
jmp    1527 <toggle_io+0x407>
jmp    1133 <toggle_io+0x13>

x86 assembly (clang, -O2):
<toggle_io>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
xor    %r14d,%r14d
mov    (%rsp),%r12
jmp    1150 <toggle_io+0x30>
lea    0x10f2(%rip),%rdi
mov    $0x167,%esi
call   1030 <printf@plt>
nopl   0x0(%rax)
movl   $0x1c0,(%r12)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    (%r12),%r15d
mov    %r15d,%r13d
and    $0x1ef,%r13d
lea    0x1049(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
lea    0x1049(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
test   %r13d,%r13d
sete   %al
not    %r15d
test   $0xf,%r15b
sete   %bl
or     %al,%bl
movl   $0x1a0,(%r12)
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    (%r12),%eax
mov    %eax,%ebp
and    $0x1ef,%ebp
test   %bl,%bl
mov    $0x0,%ecx
cmovne %ecx,%r13d
mov    $0x1,%ecx
cmove  %ecx,%r14d
cmp    %ebp,%r13d
not    %eax
sete   %cl
test   $0xf,%al
movl   $0x160,(%r12)
sete   %bl
or     %cl,%bl
mov    $0x3e8,%edi
call   1040 <usleep@plt>
mov    (%r12),%eax
mov    %eax,%r15d
and    $0x1ef,%r15d
test   %bl,%bl
cmove  %ebp,%r13d
mov    $0x1,%ecx
cmove  %ecx,%r14d
cmp    %r15d,%r13d
not    %eax
sete   %cl
test   $0xf,%al
movl   $0xe0,(%r12)
sete   %bl
or     %cl,%bl
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    (%r12),%eax
mov    %eax,%ecx
and    $0x1ef,%ecx
test   %bl,%bl
cmove  %r15d,%r13d
mov    $0x1,%esi
cmove  %esi,%r14d
cmp    %ecx,%r13d
not    %eax
sete   %dl
test   $0xf,%al
sete   %al
or     %dl,%al
cmove  %esi,%r14d
cmove  %ecx,%r13d
lea    0xf73(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
test   %r14d,%r14d
je     1150 <toggle_io+0x30>
lea    -0x167(%r13),%eax
cmp    $0x67,%eax
ja     12ac <toggle_io+0x18c>
lea    0xd93(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf8e(%rip),%rdi
mov    $0x16b,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    -0xe7(%r13),%eax
cmp    $0x7,%eax
ja     13be <toggle_io+0x29e>
lea    0xd3d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf76(%rip),%rdi
mov    $0xe7,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf3c(%rip),%rdi
mov    $0x16d,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf20(%rip),%rdi
mov    $0x16e,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xf02(%rip),%rdi
mov    $0x1a7,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xee6(%rip),%rdi
mov    $0x1ab,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xeca(%rip),%rdi
mov    $0x1ad,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xeae(%rip),%rdi
mov    $0x1ae,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe92(%rip),%rdi
mov    $0x1c7,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe72(%rip),%rdi
mov    $0x1cb,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe55(%rip),%rdi
mov    $0x1cd,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe38(%rip),%rdi
mov    $0x1ce,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe8c(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe6a(%rip),%rdi
mov    $0xeb,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe4e(%rip),%rdi
mov    $0xed,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>
lea    0xe32(%rip),%rdi
mov    $0xee,%esi
call   1030 <printf@plt>
jmp    1150 <toggle_io+0x30>

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

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