#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 scan_any(char *, int *, char);
int scanto(char *, int *, char);
int /*<<< orphan*/ show_result(char *, char const *);
int /*<<< orphan*/ vt_move(int, int);
void show_KeyboardStatus(char *report) {
  int pos = 0;
  int code;
  int save;
  const char *show = "failed";
  if ((code = scanto(report, &pos, ';')) == 27 &&
      (code = scan_any(report, &pos, 'n')) != 0) {
    switch (code) {
    case 1:
      show = "North American/ASCII";
      break;
    case 2:
      show = "British";
      break;
    case 3:
      show = "Flemish";
      break;
    case 4:
      show = "French Canadian";
      break;
    case 5:
      show = "Danish";
      break;
    case 6:
      show = "Finnish";
      break;
    case 7:
      show = "German";
      break;
    case 8:
      show = "Dutch";
      break;
    case 9:
      show = "Italian";
      break;
    case 10:
      show = "Swiss (French)";
      break;
    case 11:
      show = "Swiss (German)";
      break;
    case 12:
      show = "Swedish";
      break;
    case 13:
      show = "Norwegian/Danish";
      break;
    case 14:
      show = "French/Belgian";
      break;
    case 15:
      show = "Spanish Int.";
      break;
    case 16:
      show = "Portugese";
      break;
    case 19:
      show = "Hebrew";
      break;
    case 22:
      show = "Greek";
      break;
    case 28:
      show = "Canadian (English)";
      break;
    case 29:
      show = "Turkish Q/Turkish";
      break;
    case 30:
      show = "Turkish F/Turkish";
      break;
    case 31:
      show = "Hungarian";
      break;
    case 32:
      show = "Spanish National";
      break;
    case 33:
      show = "Slovak";
      break;
    case 34:
      show = "Czech";
      break;
    case 35:
      show = "Polish";
      break;
    case 36:
      show = "Romanian";
      break;
    case 38:
      show = "SCS";
      break;
    case 39:
      show = "Russian";
      break;
    case 40:
      show = "Latin American";
      break;
    default:
      show = "unknown";
    }
  }
  show_result("%s", show);
  save = pos;
  code = scan_any(report, &pos, 'n');
  if (save != pos) {
    vt_move(5, 10);
    switch (code) {
    case 0:
      show = "keyboard ready";
      break;
    case 3:
      show = "no keyboard";
      break;
    case 8:
      show = "keyboard busy";
      break;
    default:
      show = "unknown keyboard status";
    }
    show_result("%s", show);
    vt_move(6, 10);
    switch (scan_any(report, &pos, 'n')) {
    case 0:
      show = "LK201";
      break;
    case 1:
      show = "LK401";
      break;
    default:
      show = "unknown keyboard type";
    }
    show_result("%s", show);
  }
}


x86 assembly (clang, -O0):
<show_KeyboardStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xf46(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x3b,%edx
call   1030 <scanto@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x1b,%eax
jne    13b3 <show_KeyboardStatus+0x273>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     13b3 <show_KeyboardStatus+0x273>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x27,%eax
ja     13a3 <show_KeyboardStatus+0x263>
mov    -0x28(%rbp),%rax
lea    0xe46(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedd(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xee2(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xed2(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xf1f(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xec2(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xeb1(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xea7(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe9f(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe9e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe9d(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe95(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe96(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe95(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe92(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe8c(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe83(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe79(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe7c(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe7e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe80(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe7a(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe7b(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe72(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe68(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe5f(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe58(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe4c(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe44(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13ae <show_KeyboardStatus+0x26e>
lea    0xe43(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    13b3 <show_KeyboardStatus+0x273>
mov    -0x20(%rbp),%rsi
lea    0xe37(%rip),%rdi
call   1060 <show_result@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     14f8 <show_KeyboardStatus+0x3b8>
mov    $0x5,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
je     142e <show_KeyboardStatus+0x2ee>
jmp    140c <show_KeyboardStatus+0x2cc>
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
je     143e <show_KeyboardStatus+0x2fe>
jmp    141d <show_KeyboardStatus+0x2dd>
mov    -0x2c(%rbp),%eax
sub    $0x8,%eax
je     144e <show_KeyboardStatus+0x30e>
jmp    145e <show_KeyboardStatus+0x31e>
lea    0xdc3(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1469 <show_KeyboardStatus+0x329>
lea    0xdc2(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1469 <show_KeyboardStatus+0x329>
lea    0xdbe(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1469 <show_KeyboardStatus+0x329>
lea    0xdbc(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xd81(%rip),%rdi
call   1060 <show_result@plt>
mov    $0x6,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
mov    %eax,%ecx
mov    %ecx,-0x30(%rbp)
test   %eax,%eax
je     14bd <show_KeyboardStatus+0x37d>
jmp    14ac <show_KeyboardStatus+0x36c>
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
je     14cd <show_KeyboardStatus+0x38d>
jmp    14dd <show_KeyboardStatus+0x39d>
lea    0xd75(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    14e8 <show_KeyboardStatus+0x3a8>
lea    0xd6b(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    14e8 <show_KeyboardStatus+0x3a8>
lea    0xd61(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xd02(%rip),%rdi
call   1060 <show_result@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_KeyboardStatus>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x3b,%edx
call   1030 <scanto@plt>
cmp    $0x1b,%eax
jne    118f <show_KeyboardStatus+0x4f>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
cmp    $0x28,%eax
ja     1198 <show_KeyboardStatus+0x58>
cltq
lea    0x1036(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
jmp    119f <show_KeyboardStatus+0x5f>
lea    0xe6a(%rip),%rsi
jmp    119f <show_KeyboardStatus+0x5f>
lea    0xfae(%rip),%rsi
lea    0xfaf(%rip),%rdi
call   1060 <show_result@plt>
mov    0x4(%rsp),%ebx
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
cmp    0x4(%rsp),%ebx
je     1266 <show_KeyboardStatus+0x126>
mov    %eax,%ebp
mov    $0x5,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
test   %ebp,%ebp
je     11f3 <show_KeyboardStatus+0xb3>
cmp    $0x8,%ebp
je     11fc <show_KeyboardStatus+0xbc>
cmp    $0x3,%ebp
jne    1205 <show_KeyboardStatus+0xc5>
lea    0xf76(%rip),%rsi
jmp    120c <show_KeyboardStatus+0xcc>
lea    0xf5e(%rip),%rsi
jmp    120c <show_KeyboardStatus+0xcc>
lea    0xf70(%rip),%rsi
jmp    120c <show_KeyboardStatus+0xcc>
lea    0xf75(%rip),%rsi
lea    0xf42(%rip),%r14
mov    %r14,%rdi
call   1060 <show_result@plt>
mov    $0x6,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
cmp    $0x1,%eax
lea    0xf59(%rip),%rcx
lea    0xf58(%rip),%rdx
cmove  %rcx,%rdx
test   %eax,%eax
lea    0xf3f(%rip),%rsi
cmovne %rdx,%rsi
mov    %r14,%rdi
call   1060 <show_result@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"failed\00"
@.str.1 = [21 x i8] c"North American/ASCII\00"
@.str.2 = [8 x i8] c"British\00"
@.str.3 = [8 x i8] c"Flemish\00"
@.str.4 = [16 x i8] c"French Canadian\00"
@.str.5 = [7 x i8] c"Danish\00"
@.str.6 = [8 x i8] c"Finnish\00"
@.str.7 = [7 x i8] c"German\00"
@.str.8 = [6 x i8] c"Dutch\00"
@.str.9 = [8 x i8] c"Italian\00"
@.str.10 = [15 x i8] c"Swiss (French)\00"
@.str.11 = [15 x i8] c"Swiss (German)\00"
@.str.12 = [8 x i8] c"Swedish\00"
@.str.13 = [17 x i8] c"Norwegian/Danish\00"
@.str.14 = [15 x i8] c"French/Belgian\00"
@.str.15 = [13 x i8] c"Spanish Int.\00"
@.str.16 = [10 x i8] c"Portugese\00"
@.str.17 = [7 x i8] c"Hebrew\00"
@.str.18 = [6 x i8] c"Greek\00"
@.str.19 = [19 x i8] c"Canadian (English)\00"
@.str.20 = [18 x i8] c"Turkish Q/Turkish\00"
@.str.21 = [18 x i8] c"Turkish F/Turkish\00"
@.str.22 = [10 x i8] c"Hungarian\00"
@.str.23 = [17 x i8] c"Spanish National\00"
@.str.24 = [7 x i8] c"Slovak\00"
@.str.25 = [6 x i8] c"Czech\00"
@.str.26 = [7 x i8] c"Polish\00"
@.str.27 = [9 x i8] c"Romanian\00"
@.str.28 = [4 x i8] c"SCS\00"
@.str.29 = [8 x i8] c"Russian\00"
@.str.30 = [15 x i8] c"Latin American\00"
@.str.31 = [8 x i8] c"unknown\00"
@.str.32 = [3 x i8] c"%s\00"
@.str.33 = [15 x i8] c"keyboard ready\00"
@.str.34 = [12 x i8] c"no keyboard\00"
@.str.35 = [14 x i8] c"keyboard busy\00"
@.str.36 = [24 x i8] c"unknown keyboard status\00"
@.str.37 = [6 x i8] c"LK201\00"
@.str.38 = [6 x i8] c"LK401\00"
@.str.39 = [22 x i8] c"unknown keyboard type\00"
define void @show_KeyboardStatus(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %2
%8 = call i32 @scanto(i8* %7, i32* %3, i8 signext 59)
store i32 %8, i32* %4
%9 = icmp eq i32 %8, 27
br i1 %9, label %10, label %48
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @scan_any(i8* %11, i32* %3, i8 signext 110)
store i32 %12, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %48
14: ; preds = %10
%15 = load i32, i32* %4
switch i32 %15, label %46 [
i32 1, label %16
i32 2, label %17
i32 3, label %18
i32 4, label %19
i32 5, label %20
i32 6, label %21
i32 7, label %22
i32 8, label %23
i32 9, label %24
i32 10, label %25
i32 11, label %26
i32 12, label %27
i32 13, label %28
i32 14, label %29
i32 15, label %30
i32 16, label %31
i32 19, label %32
i32 22, label %33
i32 28, label %34
i32 29, label %35
i32 30, label %36
i32 31, label %37
i32 32, label %38
i32 33, label %39
i32 34, label %40
i32 35, label %41
i32 36, label %42
i32 38, label %43
i32 39, label %44
i32 40, label %45
]
16: ; preds = %14
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %47
17: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %6
br label %47
18: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %47
19: ; preds = %14
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %6
br label %47
20: ; preds = %14
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %6
br label %47
21: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %6
br label %47
22: ; preds = %14
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8** %6
br label %47
23: ; preds = %14
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8** %6
br label %47
24: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %6
br label %47
25: ; preds = %14
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8** %6
br label %47
26: ; preds = %14
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i8** %6
br label %47
27: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8** %6
br label %47
28: ; preds = %14
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i8** %6
br label %47
29: ; preds = %14
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8** %6
br label %47
30: ; preds = %14
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8** %6
br label %47
31: ; preds = %14
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i8** %6
br label %47
32: ; preds = %14
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8** %6
br label %47
33: ; preds = %14
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0), i8** %6
br label %47
34: ; preds = %14
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.19, i64 0, i64 0), i8** %6
br label %47
35: ; preds = %14
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0), i8** %6
br label %47
36: ; preds = %14
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8** %6
br label %47
37: ; preds = %14
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i64 0, i64 0), i8** %6
br label %47
38: ; preds = %14
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), i8** %6
br label %47
39: ; preds = %14
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0), i8** %6
br label %47
40: ; preds = %14
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.25, i64 0, i64 0), i8** %6
br label %47
41: ; preds = %14
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i64 0, i64 0), i8** %6
br label %47
42: ; preds = %14
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.27, i64 0, i64 0), i8** %6
br label %47
43: ; preds = %14
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.28, i64 0, i64 0), i8** %6
br label %47
44: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.29, i64 0, i64 0), i8** %6
br label %47
45: ; preds = %14
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.30, i64 0, i64 0), i8** %6
br label %47
46: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.31, i64 0, i64 0), i8** %6
br label %47
47: ; preds = %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16
br label %48
48: ; preds = %47, %10, %1
%49 = load i8*, i8** %6
%50 = call i32 @show_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %49)
%51 = load i32, i32* %3
store i32 %51, i32* %5
%52 = load i8*, i8** %2
%53 = call i32 @scan_any(i8* %52, i32* %3, i8 signext 110)
store i32 %53, i32* %4
%54 = load i32, i32* %5
%55 = load i32, i32* %3
%56 = icmp ne i32 %54, %55
br i1 %56, label %57, label %76
57: ; preds = %48
%58 = call i32 @vt_move(i32 5, i32 10)
%59 = load i32, i32* %4
switch i32 %59, label %63 [
i32 0, label %60
i32 3, label %61
i32 8, label %62
]
60: ; preds = %57
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.33, i64 0, i64 0), i8** %6
br label %64
61: ; preds = %57
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.34, i64 0, i64 0), i8** %6
br label %64
62: ; preds = %57
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.35, i64 0, i64 0), i8** %6
br label %64
63: ; preds = %57
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.36, i64 0, i64 0), i8** %6
br label %64
64: ; preds = %63, %62, %61, %60
%65 = load i8*, i8** %6
%66 = call i32 @show_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %65)
%67 = call i32 @vt_move(i32 6, i32 10)
%68 = load i8*, i8** %2
%69 = call i32 @scan_any(i8* %68, i32* %3, i8 signext 110)
switch i32 %69, label %72 [
i32 0, label %70
i32 1, label %71
]
70: ; preds = %64
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.37, i64 0, i64 0), i8** %6
br label %73
71: ; preds = %64
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.38, i64 0, i64 0), i8** %6
br label %73
72: ; preds = %64
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.39, i64 0, i64 0), i8** %6
br label %73
73: ; preds = %72, %71, %70
%74 = load i8*, i8** %6
%75 = call i32 @show_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %74)
br label %76
76: ; preds = %73, %48
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"failed\00"
@.str.1 = [21 x i8] c"North American/ASCII\00"
@.str.2 = [8 x i8] c"British\00"
@.str.3 = [8 x i8] c"Flemish\00"
@.str.4 = [16 x i8] c"French Canadian\00"
@.str.5 = [7 x i8] c"Danish\00"
@.str.6 = [8 x i8] c"Finnish\00"
@.str.7 = [7 x i8] c"German\00"
@.str.8 = [6 x i8] c"Dutch\00"
@.str.9 = [8 x i8] c"Italian\00"
@.str.10 = [15 x i8] c"Swiss (French)\00"
@.str.11 = [15 x i8] c"Swiss (German)\00"
@.str.12 = [8 x i8] c"Swedish\00"
@.str.13 = [17 x i8] c"Norwegian/Danish\00"
@.str.14 = [15 x i8] c"French/Belgian\00"
@.str.15 = [13 x i8] c"Spanish Int.\00"
@.str.16 = [10 x i8] c"Portugese\00"
@.str.17 = [7 x i8] c"Hebrew\00"
@.str.18 = [6 x i8] c"Greek\00"
@.str.19 = [19 x i8] c"Canadian (English)\00"
@.str.20 = [18 x i8] c"Turkish Q/Turkish\00"
@.str.21 = [18 x i8] c"Turkish F/Turkish\00"
@.str.22 = [10 x i8] c"Hungarian\00"
@.str.23 = [17 x i8] c"Spanish National\00"
@.str.24 = [7 x i8] c"Slovak\00"
@.str.25 = [6 x i8] c"Czech\00"
@.str.26 = [7 x i8] c"Polish\00"
@.str.27 = [9 x i8] c"Romanian\00"
@.str.28 = [4 x i8] c"SCS\00"
@.str.29 = [8 x i8] c"Russian\00"
@.str.30 = [15 x i8] c"Latin American\00"
@.str.31 = [8 x i8] c"unknown\00"
@.str.32 = [3 x i8] c"%s\00"
@.str.33 = [15 x i8] c"keyboard ready\00"
@.str.34 = [12 x i8] c"no keyboard\00"
@.str.35 = [14 x i8] c"keyboard busy\00"
@.str.36 = [24 x i8] c"unknown keyboard status\00"
@.str.37 = [6 x i8] c"LK201\00"
@.str.38 = [6 x i8] c"LK401\00"
@.str.39 = [22 x i8] c"unknown keyboard type\00"
@reltable.show_KeyboardStatus = [41 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.1 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.4 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.7 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.8 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.9 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.10 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.11 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.12 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.13 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.14 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.15 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.16 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.17 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.18 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.19 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.20 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.21 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.22 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.23 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.24 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.25 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.26 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.27 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.31 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.28 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.29 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.30 to i64), i64 ptrtoint ([41 x i32]* @reltable.show_KeyboardStatus to i64)) to i32)]
define void @show_KeyboardStatus(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @scanto(i8* %0, i32* %2, i8 signext 59)
%5 = icmp eq i32 %4, 27
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = call i32 @scan_any(i8* %0, i32* %2, i8 signext 110)
%8 = icmp ult i32 %7, 41
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = sext i32 %7 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([41 x i32]* @reltable.show_KeyboardStatus to i8*), i64 %11)
br label %13
13: ; preds = %6, %9, %1
%14 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %1 ], [ %12, %9 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.31, i64 0, i64 0), %6 ]
%15 = call i32 @show_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %2
%17 = call i32 @scan_any(i8* %0, i32* %2, i8 signext 110)
%18 = load i32, i32* %2
%19 = icmp eq i32 %16, %18
br i1 %19, label %35, label %20
20: ; preds = %13
%21 = call i32 @vt_move(i32 5, i32 10)
switch i32 %17, label %24 [
i32 0, label %25
i32 3, label %22
i32 8, label %23
]
22: ; preds = %20
br label %25
23: ; preds = %20
br label %25
24: ; preds = %20
br label %25
25: ; preds = %20, %24, %23, %22
%26 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.36, i64 0, i64 0), %24 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.35, i64 0, i64 0), %23 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.34, i64 0, i64 0), %22 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.33, i64 0, i64 0), %20 ]
%27 = call i32 @show_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %26)
%28 = call i32 @vt_move(i32 6, i32 10)
%29 = call i32 @scan_any(i8* %0, i32* %2, i8 signext 110)
%30 = icmp eq i32 %29, 1
%31 = select i1 %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.38, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.39, i64 0, i64 0)
%32 = icmp eq i32 %29, 0
%33 = select i1 %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.37, i64 0, i64 0), i8* %31
%34 = call i32 @show_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %25, %13
ret void
}