#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 */
#define KEY_0 153
#define KEY_1 152
#define KEY_2 151
#define KEY_3 150
#define KEY_4 149
#define KEY_5 148
#define KEY_6 147
#define KEY_7 146
#define KEY_8 145
#define KEY_9 144
#define KEY_BLUE 143
#define KEY_DOWN 142
#define KEY_GREEN 141
#define KEY_HELP 140
#define KEY_HOME 139
#define KEY_LEFT 138
#define KEY_MUTE 137
#define KEY_OK 136
#define KEY_POWER 135
#define KEY_RED 134
#define KEY_RIGHT 133
#define KEY_SETUP 132
#define KEY_UP 131
#define KEY_VOLUMEDOWN 130
#define KEY_VOLUMEUP 129
#define KEY_YELLOW 128
int Translate(int gkey) {
  int rv = 'X';
  switch (gkey) {
  case KEY_UP:
    rv = 0x43;
    break;
  case KEY_DOWN:
    rv = 0x44;
    break;
  case KEY_LEFT:
    rv = 0x42;
    break;
  case KEY_RIGHT:
    rv = 0x41;
    break;
  case KEY_OK:
    rv = 0x45;
    break;
  case KEY_0:
    rv = 0x30;
    break;
  case KEY_1:
    rv = 0x31;
    break;
  case KEY_2:
    rv = 0x32;
    break;
  case KEY_3:
    rv = 0x33;
    break;
  case KEY_4:
    rv = 0x34;
    break;
  case KEY_5:
    rv = 0x35;
    break;
  case KEY_6:
    rv = 0x36;
    break;
  case KEY_7:
    rv = 0x37;
    break;
  case KEY_8:
    rv = 0x38;
    break;
  case KEY_9:
    rv = 0x39;
    break;
  case KEY_RED:
    rv = 0x4A;
    break;
  case KEY_GREEN:
    rv = 0x48;
    break;
  case KEY_YELLOW:
    rv = 0x49;
    break;
  case KEY_BLUE:
    rv = 0x4B;
    break;
  case KEY_VOLUMEUP:
    rv = 0x4C;
    break;
  case KEY_VOLUMEDOWN:
    rv = 0x4D;
    break;
  case KEY_MUTE:
    rv = 0x46;
    break;
  case KEY_HELP:
    rv = 0x4E;
    break;
  case KEY_SETUP:
    rv = 0x4F;
    break;
  case KEY_HOME:
    rv = 0x50;
    break;
  case KEY_POWER:
    rv = 0x47;
    break;
  }
  return rv;
}


x86 assembly (clang, -O0):
<Translate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x58,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x19,%eax
ja     126a <Translate+0x16a>
mov    -0x10(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x43,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x44,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x42,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x41,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x45,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x30,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x31,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x32,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x33,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x34,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x35,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x36,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x37,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x38,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x39,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x4a,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x48,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x49,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x4b,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x4c,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x4d,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x46,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x4e,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x4f,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x50,-0x8(%rbp)
jmp    126a <Translate+0x16a>
movl   $0x47,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Translate>:
add    $0xffffff80,%edi
mov    $0x58,%eax
cmp    $0x19,%edi
ja     111a <Translate+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @Translate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 88, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %31 [
i32 131, label %5
i32 142, label %6
i32 138, label %7
i32 133, label %8
i32 136, label %9
i32 153, label %10
i32 152, label %11
i32 151, label %12
i32 150, label %13
i32 149, label %14
i32 148, label %15
i32 147, label %16
i32 146, label %17
i32 145, label %18
i32 144, label %19
i32 134, label %20
i32 141, label %21
i32 128, label %22
i32 143, label %23
i32 129, label %24
i32 130, label %25
i32 137, label %26
i32 140, label %27
i32 132, label %28
i32 139, label %29
i32 135, label %30
]
5: ; preds = %1
store i32 67, i32* %3
br label %31
6: ; preds = %1
store i32 68, i32* %3
br label %31
7: ; preds = %1
store i32 66, i32* %3
br label %31
8: ; preds = %1
store i32 65, i32* %3
br label %31
9: ; preds = %1
store i32 69, i32* %3
br label %31
10: ; preds = %1
store i32 48, i32* %3
br label %31
11: ; preds = %1
store i32 49, i32* %3
br label %31
12: ; preds = %1
store i32 50, i32* %3
br label %31
13: ; preds = %1
store i32 51, i32* %3
br label %31
14: ; preds = %1
store i32 52, i32* %3
br label %31
15: ; preds = %1
store i32 53, i32* %3
br label %31
16: ; preds = %1
store i32 54, i32* %3
br label %31
17: ; preds = %1
store i32 55, i32* %3
br label %31
18: ; preds = %1
store i32 56, i32* %3
br label %31
19: ; preds = %1
store i32 57, i32* %3
br label %31
20: ; preds = %1
store i32 74, i32* %3
br label %31
21: ; preds = %1
store i32 72, i32* %3
br label %31
22: ; preds = %1
store i32 73, i32* %3
br label %31
23: ; preds = %1
store i32 75, i32* %3
br label %31
24: ; preds = %1
store i32 76, i32* %3
br label %31
25: ; preds = %1
store i32 77, i32* %3
br label %31
26: ; preds = %1
store i32 70, i32* %3
br label %31
27: ; preds = %1
store i32 78, i32* %3
br label %31
28: ; preds = %1
store i32 79, i32* %3
br label %31
29: ; preds = %1
store i32 80, i32* %3
br label %31
30: ; preds = %1
store i32 71, i32* %3
br label %31
31: ; preds = %1, %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
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@switch.table.Translate = [26 x i32] [i32 73, i32 76, i32 77, i32 67, i32 79, i32 65, i32 74, i32 71, i32 69, i32 70, i32 66, i32 80, i32 78, i32 72, i32 68, i32 75, i32 57, i32 56, i32 55, i32 54, i32 53, i32 52, i32 51, i32 50, i32 49, i32 48]
define i32 @Translate(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 26
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [26 x i32], [26 x i32]* @switch.table.Translate, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 88, %1 ], [ %7, %4 ]
ret i32 %9
}