#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*/ framebuffer_update_display();
int /*<<< orphan*/ linefeed();
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ println_hex(char);
char scancode_to_mycode(char scancode, char modifiers) {
  switch (scancode) {
  case 0x5a:
    return 0;
  case 0x1c:
    return 1;
  case 0x32:
    return 2;
  case 0x21:
    return 3;
  case 0x23:
    return 4;
  case 0x24:
    return 5;
  case 0x2b:
    return 6;
  case 0x34:
    return 7;
  case 0x33:
    return 8;
  case 0x43:
    return 9;
  case 0x3b:
    return 10;
  case 0x42:
    return 11;
  case 0x4b:
    return 12;
  case 0x3a:
    return 13;
  case 0x31:
    return 14;
  case 0x44:
    return 15;
  case 0x4d:
    return 16;
  case 0x15:
    return 17;
  case 0x2d:
    return 18;
  case 0x1b:
    return 19;
  case 0x2c:
    return 20;
  case 0x3c:
    return 21;
  case 0x2a:
    return 22;
  case 0x1d:
    return 23;
  case 0x22:
    return 24;
  case 0x35:
    return 25;
  case 0x1a:
    return 26;
  case 0x29:
    return 27;
  case 0x3e:
    if ((modifiers & (1 << 5)) != 0) {
      return 28;
    } else if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 29;
    }
    return 30;
  case 0x46:
    if ((modifiers & (1 << 5)) != 0) {
      return 31;
    } else if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 32;
    }
    return 33;
  case 0x16:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 34;
    }
    return 35;
  case 0x1e:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 36;
    }
    return 37;
  case 0x5d:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 38;
    }
    return 39;
  case 0x2e:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 42;
    }
    return 43;
  case 0x36:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 44;
    }
    return 45;
  case 0x5b:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 46;
    }
    return 47;
  case 0x41:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 48;
    }
    return 49;
  case 0x4a:
    return 50;
  case 0x49:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 57;
    }
    return 51;
  case 0x3d:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 52;
    }
    return 53;
  case 0x45:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 54;
    }
    return 55;
  case 0x26:
    return 56;
  case 0x61:
    if ((modifiers & ((1 << 0) | (1 << 1))) != 0) {
      return 58;
    }
    return 59;
  case 0x4e:
    return 60;
  default:
    linefeed();
    print("unmapped: ");
    println_hex(scancode);
    framebuffer_update_display();
    return 0xff;
  }
}


x86 assembly (clang, -O0):
<scancode_to_mycode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xffffffeb,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4c,%eax
ja     148b <scancode_to_mycode+0x34b>
mov    -0x10(%rbp),%rax
lea    0xe8b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x0,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x1,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x2,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x3,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x4,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x5,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x6,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x7,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x8,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x9,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0xa,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0xb,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0xc,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0xd,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0xe,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0xf,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x10,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x11,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x12,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x13,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x14,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x15,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x16,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x17,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x18,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x19,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x1a,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x1b,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1293 <scancode_to_mycode+0x153>
movb   $0x1c,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     12ac <scancode_to_mycode+0x16c>
movb   $0x1d,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
jmp    12b1 <scancode_to_mycode+0x171>
movb   $0x1e,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     12d3 <scancode_to_mycode+0x193>
movb   $0x1f,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     12ec <scancode_to_mycode+0x1ac>
movb   $0x20,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
jmp    12f1 <scancode_to_mycode+0x1b1>
movb   $0x21,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1313 <scancode_to_mycode+0x1d3>
movb   $0x22,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x23,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1335 <scancode_to_mycode+0x1f5>
movb   $0x24,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x25,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1357 <scancode_to_mycode+0x217>
movb   $0x26,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x27,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1379 <scancode_to_mycode+0x239>
movb   $0x2a,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x2b,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     139b <scancode_to_mycode+0x25b>
movb   $0x2c,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x2d,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     13bd <scancode_to_mycode+0x27d>
movb   $0x2e,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x2f,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     13df <scancode_to_mycode+0x29f>
movb   $0x30,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x31,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x32,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     140a <scancode_to_mycode+0x2ca>
movb   $0x39,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x33,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     142c <scancode_to_mycode+0x2ec>
movb   $0x34,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x35,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     144e <scancode_to_mycode+0x30e>
movb   $0x36,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x37,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x38,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movsbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1479 <scancode_to_mycode+0x339>
movb   $0x3a,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x3b,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
movb   $0x3c,-0x1(%rbp)
jmp    14b2 <scancode_to_mycode+0x372>
mov    $0x0,%al
call   1050 <linefeed@plt>
lea    0xc9b(%rip),%rdi
call   1040 <print@plt>
movsbl -0x2(%rbp),%edi
call   1030 <println_hex@plt>
mov    $0x0,%al
call   1060 <framebuffer_update_display@plt>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scancode_to_mycode>:
push   %rbx
mov    %edi,%ebx
lea    -0x15(%rbx),%ecx
cmp    $0x4c,%ecx
ja     128d <scancode_to_mycode+0x14d>
xor    %eax,%eax
lea    0xea8(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x11,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x22,%al
pop    %rbx
ret
mov    $0x1a,%al
pop    %rbx
ret
mov    $0x13,%al
pop    %rbx
ret
mov    $0x1,%al
pop    %rbx
ret
mov    $0x17,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x24,%al
pop    %rbx
ret
mov    $0x3,%al
pop    %rbx
ret
mov    $0x18,%al
pop    %rbx
ret
mov    $0x4,%al
pop    %rbx
ret
mov    $0x5,%al
pop    %rbx
ret
mov    $0x38,%al
pop    %rbx
ret
mov    $0x1b,%al
pop    %rbx
ret
mov    $0x16,%al
pop    %rbx
ret
mov    $0x6,%al
pop    %rbx
ret
mov    $0x14,%al
pop    %rbx
ret
mov    $0x12,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x2a,%al
pop    %rbx
ret
mov    $0xe,%al
pop    %rbx
ret
mov    $0x2,%al
pop    %rbx
ret
mov    $0x8,%al
pop    %rbx
ret
mov    $0x7,%al
pop    %rbx
ret
mov    $0x19,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x2c,%al
pop    %rbx
ret
mov    $0xd,%al
pop    %rbx
ret
mov    $0xa,%al
pop    %rbx
ret
mov    $0x15,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x34,%al
pop    %rbx
ret
mov    $0x1c,%al
test   $0x20,%sil
jne    1163 <scancode_to_mycode+0x23>
movzbl %sil,%eax
and    $0x3,%eax
cmp    $0x1,%eax
mov    $0x1d,%al
adc    $0x0,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x30,%al
pop    %rbx
ret
mov    $0xb,%al
pop    %rbx
ret
mov    $0x9,%al
pop    %rbx
ret
mov    $0xf,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x36,%al
pop    %rbx
ret
mov    $0x1f,%al
test   $0x20,%sil
jne    1163 <scancode_to_mycode+0x23>
test   $0x3,%sil
sete   %al
or     $0x20,%al
pop    %rbx
ret
test   $0x3,%sil
mov    $0x33,%ecx
mov    $0x39,%eax
cmove  %ecx,%eax
pop    %rbx
ret
mov    $0x32,%al
pop    %rbx
ret
mov    $0xc,%al
pop    %rbx
ret
mov    $0x10,%al
pop    %rbx
ret
mov    $0x3c,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x2e,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x26,%al
pop    %rbx
ret
test   $0x3,%sil
sete   %al
or     $0x3a,%al
pop    %rbx
ret
xor    %eax,%eax
call   1050 <linefeed@plt>
lea    0xe99(%rip),%rdi
call   1040 <print@plt>
movsbl %bl,%edi
call   1030 <println_hex@plt>
xor    %eax,%eax
call   1060 <framebuffer_update_display@plt>
mov    $0xff,%al
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"unmapped: \00"
define signext i8 @scancode_to_mycode(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %94 [
i32 90, label %99
i32 28, label %4
i32 50, label %5
i32 33, label %6
i32 35, label %7
i32 36, label %8
i32 43, label %9
i32 52, label %10
i32 51, label %11
i32 67, label %12
i32 59, label %13
i32 66, label %14
i32 75, label %15
i32 58, label %16
i32 49, label %17
i32 68, label %18
i32 77, label %19
i32 21, label %20
i32 45, label %21
i32 27, label %22
i32 44, label %23
i32 60, label %24
i32 42, label %25
i32 29, label %26
i32 34, label %27
i32 53, label %28
i32 26, label %29
i32 41, label %30
i32 62, label %31
i32 70, label %39
i32 22, label %47
i32 30, label %51
i32 93, label %55
i32 46, label %59
i32 54, label %63
i32 91, label %67
i32 65, label %71
i32 74, label %75
i32 73, label %76
i32 61, label %80
i32 69, label %84
i32 38, label %88
i32 97, label %89
i32 78, label %93
]
4: ; preds = %2
br label %99
5: ; preds = %2
br label %99
6: ; preds = %2
br label %99
7: ; preds = %2
br label %99
8: ; preds = %2
br label %99
9: ; preds = %2
br label %99
10: ; preds = %2
br label %99
11: ; preds = %2
br label %99
12: ; preds = %2
br label %99
13: ; preds = %2
br label %99
14: ; preds = %2
br label %99
15: ; preds = %2
br label %99
16: ; preds = %2
br label %99
17: ; preds = %2
br label %99
18: ; preds = %2
br label %99
19: ; preds = %2
br label %99
20: ; preds = %2
br label %99
21: ; preds = %2
br label %99
22: ; preds = %2
br label %99
23: ; preds = %2
br label %99
24: ; preds = %2
br label %99
25: ; preds = %2
br label %99
26: ; preds = %2
br label %99
27: ; preds = %2
br label %99
28: ; preds = %2
br label %99
29: ; preds = %2
br label %99
30: ; preds = %2
br label %99
31: ; preds = %2
%32 = zext i8 %1 to i32
%33 = and i32 %32, 32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %99
35: ; preds = %31
%36 = and i32 %32, 3
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i8 30, i8 29
br label %99
39: ; preds = %2
%40 = zext i8 %1 to i32
%41 = and i32 %40, 32
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %99
43: ; preds = %39
%44 = and i32 %40, 3
%45 = icmp eq i32 %44, 0
%46 = select i1 %45, i8 33, i8 32
br label %99
47: ; preds = %2
%48 = and i8 %1, 3
%49 = icmp eq i8 %48, 0
%50 = select i1 %49, i8 35, i8 34
br label %99
51: ; preds = %2
%52 = and i8 %1, 3
%53 = icmp eq i8 %52, 0
%54 = select i1 %53, i8 37, i8 36
br label %99
55: ; preds = %2
%56 = and i8 %1, 3
%57 = icmp eq i8 %56, 0
%58 = select i1 %57, i8 39, i8 38
br label %99
59: ; preds = %2
%60 = and i8 %1, 3
%61 = icmp eq i8 %60, 0
%62 = select i1 %61, i8 43, i8 42
br label %99
63: ; preds = %2
%64 = and i8 %1, 3
%65 = icmp eq i8 %64, 0
%66 = select i1 %65, i8 45, i8 44
br label %99
67: ; preds = %2
%68 = and i8 %1, 3
%69 = icmp eq i8 %68, 0
%70 = select i1 %69, i8 47, i8 46
br label %99
71: ; preds = %2
%72 = and i8 %1, 3
%73 = icmp eq i8 %72, 0
%74 = select i1 %73, i8 49, i8 48
br label %99
75: ; preds = %2
br label %99
76: ; preds = %2
%77 = and i8 %1, 3
%78 = icmp eq i8 %77, 0
%79 = select i1 %78, i8 51, i8 57
br label %99
80: ; preds = %2
%81 = and i8 %1, 3
%82 = icmp eq i8 %81, 0
%83 = select i1 %82, i8 53, i8 52
br label %99
84: ; preds = %2
%85 = and i8 %1, 3
%86 = icmp eq i8 %85, 0
%87 = select i1 %86, i8 55, i8 54
br label %99
88: ; preds = %2
br label %99
89: ; preds = %2
%90 = and i8 %1, 3
%91 = icmp eq i8 %90, 0
%92 = select i1 %91, i8 59, i8 58
br label %99
93: ; preds = %2
br label %99
94: ; preds = %2
%95 = tail call i32 (...) @linefeed()
%96 = tail call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%97 = tail call i32 @println_hex(i8 signext %0)
%98 = tail call i32 (...) @framebuffer_update_display()
br label %99
99: ; preds = %89, %84, %80, %76, %71, %67, %63, %59, %55, %51, %47, %43, %39, %35, %31, %2, %94, %93, %88, %75, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4
%100 = phi i8 [ -1, %94 ], [ 60, %93 ], [ 56, %88 ], [ 50, %75 ], [ 27, %30 ], [ 26, %29 ], [ 25, %28 ], [ 24, %27 ], [ 23, %26 ], [ 22, %25 ], [ 21, %24 ], [ 20, %23 ], [ 19, %22 ], [ 18, %21 ], [ 17, %20 ], [ 16, %19 ], [ 15, %18 ], [ 14, %17 ], [ 13, %16 ], [ 12, %15 ], [ 11, %14 ], [ 10, %13 ], [ 9, %12 ], [ 8, %11 ], [ 7, %10 ], [ 6, %9 ], [ 5, %8 ], [ 4, %7 ], [ 3, %6 ], [ 2, %5 ], [ 1, %4 ], [ 0, %2 ], [ 28, %31 ], [ %38, %35 ], [ 31, %39 ], [ %46, %43 ], [ %50, %47 ], [ %54, %51 ], [ %58, %55 ], [ %62, %59 ], [ %66, %63 ], [ %70, %67 ], [ %74, %71 ], [ %79, %76 ], [ %83, %80 ], [ %87, %84 ], [ %92, %89 ]
ret i8 %100
}