#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  char ch = getchar();
  switch (ch) {
  case '0':
    printf("Zero\n");
    break;
  case '1':
    printf("One\n");
    break;
  case '2':
    printf("Two\n");
    break;
  case '3':
    printf("Three\n");
    break;
  case '4':
    printf("Four\n");
    break;
  case '5':
    printf("Five\n");
    break;
  case '6':
    printf("Six\n");
    break;
  case '7':
    printf("Seven\n");
    break;
  case '8':
    printf("Eight\n");
    break;
  case '9':
    printf("Nine\n");
    break;
  default:
    printf("Not a digit\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     120d <main+0xed>
mov    -0x10(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    1219 <main+0xf9>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1145 <main+0x25>
cltq
lea    0xf04(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    114c <main+0x2c>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Zero\0A\00"
@.str.1 = [5 x i8] c"One\0A\00"
@.str.2 = [5 x i8] c"Two\0A\00"
@.str.3 = [7 x i8] c"Three\0A\00"
@.str.4 = [6 x i8] c"Four\0A\00"
@.str.5 = [6 x i8] c"Five\0A\00"
@.str.6 = [5 x i8] c"Six\0A\00"
@.str.7 = [7 x i8] c"Seven\0A\00"
@.str.8 = [7 x i8] c"Eight\0A\00"
@.str.9 = [6 x i8] c"Nine\0A\00"
@.str.10 = [13 x i8] c"Not a digit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %26 [
i32 48, label %6
i32 49, label %8
i32 50, label %10
i32 51, label %12
i32 52, label %14
i32 53, label %16
i32 54, label %18
i32 55, label %20
i32 56, label %22
i32 57, label %24
]
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %28
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %28
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %28
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %28
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %28
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %28
20: ; preds = %0
%21 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %28
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %28
24: ; preds = %0
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %28
26: ; preds = %0
%27 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %28
28: ; preds = %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"Nine\00"
@str.11 = [6 x i8] c"Eight\00"
@str.12 = [6 x i8] c"Seven\00"
@str.13 = [4 x i8] c"Six\00"
@str.14 = [5 x i8] c"Five\00"
@str.15 = [5 x i8] c"Four\00"
@str.16 = [6 x i8] c"Three\00"
@str.17 = [4 x i8] c"Two\00"
@str.18 = [4 x i8] c"One\00"
@str.19 = [5 x i8] c"Zero\00"
@str.20 = [12 x i8] c"Not a digit\00"
@reltable.main = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.19 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @str.18 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @str.17 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.16 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.15 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str.14 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @str.13 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.12 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @str.11 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @str to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = sext i8 %1 to i32
%3 = add nsw i32 %2, -48
%4 = icmp ult i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.main to i8*), i64 %7)
br label %9
9: ; preds = %0, %5
%10 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.20, i64 0, i64 0), %0 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
ret i32 0
}