#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 *, int *);
int main() {
  int digit;
  printf("Enter digit: ");
  scanf("%d", &digit);
  if (digit <= 9 && digit >= 0) {
    switch (digit) {
    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");
    }
  } else {
    printf("Not a digit.\n");
  }
  return 0;
}


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    0xef4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x9,-0x8(%rbp)
jg     123f <main+0x11f>
cmpl   $0x0,-0x8(%rbp)
jl     123f <main+0x11f>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     122e <main+0x10e>
mov    -0x10(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
jmp    124b <main+0x12b>
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rax
cmp    $0x9,%rax
ja     1169 <main+0x39>
lea    0xefc(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1170 <main+0x40>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter digit: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"Zero.\0A\00"
@.str.3 = [6 x i8] c"One.\0A\00"
@.str.4 = [6 x i8] c"Two.\0A\00"
@.str.5 = [8 x i8] c"Three.\0A\00"
@.str.6 = [7 x i8] c"Four.\0A\00"
@.str.7 = [7 x i8] c"Five.\0A\00"
@.str.8 = [6 x i8] c"Six.\0A\00"
@.str.9 = [8 x i8] c"Seven.\0A\00"
@.str.10 = [8 x i8] c"Eight.\0A\00"
@.str.11 = [7 x i8] c"Nine.\0A\00"
@.str.12 = [14 x i8] c"Not a digit.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 9
br i1 %6, label %7, label %35
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %35
10: ; preds = %7
%11 = load i32, i32* %2
switch i32 %11, label %32 [
i32 0, label %12
i32 1, label %14
i32 2, label %16
i32 3, label %18
i32 4, label %20
i32 5, label %22
i32 6, label %24
i32 7, label %26
i32 8, label %28
i32 9, label %30
]
12: ; preds = %10
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %34
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %34
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %34
18: ; preds = %10
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %34
20: ; preds = %10
%21 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %34
22: ; preds = %10
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %34
24: ; preds = %10
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %34
26: ; preds = %10
%27 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %34
28: ; preds = %10
%29 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %34
30: ; preds = %10
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %34
32: ; preds = %10
%33 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
br label %34
34: ; preds = %32, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12
br label %37
35: ; preds = %7, %0
%36 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
br label %37
37: ; preds = %35, %34
ret i32 0
}

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