#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 /*<<< orphan*/ scanf(char *, char *);
main() {
  char num;
  printf("Please input a single digit: ");
  scanf("%1s", &num);
  switch (num) {
  case '0':
    printf("Zero");
    break;
  case '1':
    printf("One");
    break;
  case '2':
    printf("Two");
    break;
  case '3':
    printf("Three");
    break;
  case '4':
    printf("Four");
    break;
  case '5':
    printf("Five");
    break;
  case '6':
    printf("Six");
    break;
  case '7':
    printf("Seven");
    break;
  case '8':
    printf("Eight");
    break;
  case '9':
    printf("Nine");
    break;
  default:
    printf("That's not a numerical digit!");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     121f <main+0xff>
mov    -0x10(%rbp),%rax
lea    0xe94(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbq 0x7(%rsp),%rax
add    $0xffffffffffffffd0,%rax
cmp    $0x9,%eax
ja     115d <main+0x3d>
lea    0xf20(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1164 <main+0x44>
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [30 x i8] c"Please input a single digit: \00"
@.str.1 = [4 x i8] c"%1s\00"
@.str.2 = [5 x i8] c"Zero\00"
@.str.3 = [4 x i8] c"One\00"
@.str.4 = [4 x i8] c"Two\00"
@.str.5 = [6 x i8] c"Three\00"
@.str.6 = [5 x i8] c"Four\00"
@.str.7 = [5 x i8] c"Five\00"
@.str.8 = [4 x i8] c"Six\00"
@.str.9 = [6 x i8] c"Seven\00"
@.str.10 = [6 x i8] c"Eight\00"
@.str.11 = [5 x i8] c"Nine\00"
@.str.12 = [30 x i8] c"That's not a numerical digit!\00"
@reltable.main = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.10 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.11 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, -48
%7 = icmp ult i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = sext i32 %6 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.main to i8*), i64 %10)
br label %12
12: ; preds = %0, %8
%13 = phi i8* [ %11, %8 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), %0 ]
%14 = call i32 @printf(i8* dereferenceable(1) %13)
ret i32 0
}