#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 *);
void wordofdigit() {
  char z;
  printf("Enter your digit:");
  scanf("%c", &z);
  switch (z) {
  case '0':
    printf("this is zero");
    break;
  case '1':
    printf("this is One");
    break;
  case '2':
    printf("this is Two");
    break;
  case '3':
    printf("this is Three");
    break;
  case '4':
    printf("this is Four");
    break;
  case '5':
    printf("this is Five");
    break;
  case '6':
    printf("this is Six");
    break;
  case '7':
    printf("this is Seven");
    break;
  case '8':
    printf("this is Eight");
    break;
  case '9':
    printf("this is Nine");
    break;
  default:
    printf("This is not in 0 to 9 Range");
  }
}


x86 assembly (clang, -O0):
<wordofdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     1218 <wordofdigit+0xf8>
mov    -0x10(%rbp),%rax
lea    0xe9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <wordofdigit+0x104>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"Enter your digit:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [13 x i8] c"this is zero\00"
@.str.3 = [12 x i8] c"this is One\00"
@.str.4 = [12 x i8] c"this is Two\00"
@.str.5 = [14 x i8] c"this is Three\00"
@.str.6 = [13 x i8] c"this is Four\00"
@.str.7 = [13 x i8] c"this is Five\00"
@.str.8 = [12 x i8] c"this is Six\00"
@.str.9 = [14 x i8] c"this is Seven\00"
@.str.10 = [14 x i8] c"this is Eight\00"
@.str.11 = [13 x i8] c"this is Nine\00"
@.str.12 = [28 x i8] c"This is not in 0 to 9 Range\00"
define void @wordofdigit() {
%1 = alloca i8
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%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 ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %28
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %28
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %28
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %28
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %28
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %28
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %28
20: ; preds = %0
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
br label %28
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %28
24: ; preds = %0
%25 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
br label %28
26: ; preds = %0
%27 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
br label %28
28: ; preds = %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter your digit:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [13 x i8] c"this is zero\00"
@.str.3 = [12 x i8] c"this is One\00"
@.str.4 = [12 x i8] c"this is Two\00"
@.str.5 = [14 x i8] c"this is Three\00"
@.str.6 = [13 x i8] c"this is Four\00"
@.str.7 = [13 x i8] c"this is Five\00"
@.str.8 = [12 x i8] c"this is Six\00"
@.str.9 = [14 x i8] c"this is Seven\00"
@.str.10 = [14 x i8] c"this is Eight\00"
@.str.11 = [13 x i8] c"this is Nine\00"
@.str.12 = [28 x i8] c"This is not in 0 to 9 Range\00"
@reltable.wordofdigit = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.10 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.11 to i64), i64 ptrtoint ([10 x i32]* @reltable.wordofdigit to i64)) to i32)]
define void @wordofdigit() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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.wordofdigit to i8*), i64 %10)
br label %12
12: ; preds = %0, %8
%13 = phi i8* [ %11, %8 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), %0 ]
%14 = call i32 @printf(i8* dereferenceable(1) %13)
ret void
}