#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(void) {
  char origin[100 + 1] = {' '}, number[100 + 1] = {' '}, ch;
  int index = 0;
  printf("enter a phone number\n");
  while ((ch = getchar()) != '\n') {
    origin[index] = ch;
    switch (ch) {
    case 'A':
    case 'B':
    case 'C':
      number[index] = '2';
      break;
    case 'D':
    case 'E':
    case 'F':
      number[index] = '3';
      break;
    case 'G':
    case 'H':
    case 'I':
      number[index] = '4';
      break;
    case 'J':
    case 'K':
    case 'L':
      number[index] = '5';
      break;
    case 'O':
    case 'M':
    case 'N':
      number[index] = '6';
      break;
    case 'P':
    case 'S':
    case 'R':
      number[index] = '7';
      break;
    case 'U':
    case 'T':
    case 'V':
      number[index] = '8';
      break;
    case 'W':
    case 'X':
    case 'Y':
      number[index] = '9';
      break;
    default:
      number[index] = ch;
    }
    index += 1;
  }
  printf("in numeric form:\n");
  for (int i = 0; i < index + 1; i++) {
    printf("%c", number[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1040 <memset@plt>
movb   $0x20,-0x70(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1040 <memset@plt>
movb   $0x20,-0xe0(%rbp)
movl   $0x0,-0xe8(%rbp)
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0xe1(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     12ad <main+0x17d>
mov    -0xe1(%rbp),%cl
movslq -0xe8(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
movsbl -0xe1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0xf8(%rbp)
sub    $0x18,%eax
ja     1285 <main+0x155>
mov    -0xf8(%rbp),%rax
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movslq -0xe8(%rbp),%rax
movb   $0x32,-0xe0(%rbp,%rax,1)
32
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x33,-0xe0(%rbp,%rax,1)
33
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x34,-0xe0(%rbp,%rax,1)
34
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x35,-0xe0(%rbp,%rax,1)
35
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x36,-0xe0(%rbp,%rax,1)
36
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x37,-0xe0(%rbp,%rax,1)
37
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x38,-0xe0(%rbp,%rax,1)
38
jmp    1299 <main+0x169>
movslq -0xe8(%rbp),%rax
movb   $0x39,-0xe0(%rbp,%rax,1)
39
jmp    1299 <main+0x169>
mov    -0xe1(%rbp),%cl
movslq -0xe8(%rbp),%rax
mov    %cl,-0xe0(%rbp,%rax,1)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    1188 <main+0x58>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xec(%rbp)
mov    -0xec(%rbp),%eax
mov    -0xe8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    130d <main+0x1dd>
movslq -0xec(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%esi
ff
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    12c5 <main+0x195>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x5d(%rsp)
movb   $0x20,(%rsp)
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x1,%ebx
cmp    $0xa,%al
je     11ce <main+0x9e>
mov    $0x1,%ebx
mov    $0x1feffff,%ebp
lea    0xe94(%rip),%r14
jmp    11b3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %al,-0x1(%rsp,%rbx,1)
xor    %eax,%eax
call   1050 <getchar@plt>
add    $0x1,%rbx
cmp    $0xa,%al
je     11cc <main+0x9c>
movsbq %al,%rcx
add    $0xffffffffffffffbf,%rcx
cmp    $0x18,%ecx
ja     11a0 <main+0x70>
bt     %ecx,%ebp
jae    11a0 <main+0x70>
movzbl (%rcx,%r14,1),%eax
jmp    11a0 <main+0x70>
mov    %ebx,%ebx
lea    0xe40(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
nopl   0x0(%rax)
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11e0 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"enter a phone number\0A\00"
@.str.1 = [18 x i8] c"in numeric form:\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x i8]
%3 = alloca [101 x i8]
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [101 x i8]* %2 to i8*
%8 = bitcast i8* %7 to <{ i8, [100 x i8] }>*
%9 = getelementptr inbounds <{ i8, [100 x i8] }>, <{ i8, [100 x i8] }>* %8, i32 0, i32 0
store i8 32, i8* %9
%10 = bitcast [101 x i8]* %3 to i8*
%11 = bitcast i8* %10 to <{ i8, [100 x i8] }>*
%12 = getelementptr inbounds <{ i8, [100 x i8] }>, <{ i8, [100 x i8] }>* %11, i32 0, i32 0
store i8 32, i8* %12
store i32 0, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %62, %0
%15 = call signext i8 (...) @getchar()
store i8 %15, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %65
18: ; preds = %14
%19 = load i8, i8* %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %21
store i8 %19, i8* %22
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
switch i32 %24, label %57 [
i32 65, label %25
i32 66, label %25
i32 67, label %25
i32 68, label %29
i32 69, label %29
i32 70, label %29
i32 71, label %33
i32 72, label %33
i32 73, label %33
i32 74, label %37
i32 75, label %37
i32 76, label %37
i32 79, label %41
i32 77, label %41
i32 78, label %41
i32 80, label %45
i32 83, label %45
i32 82, label %45
i32 85, label %49
i32 84, label %49
i32 86, label %49
i32 87, label %53
i32 88, label %53
i32 89, label %53
]
25: ; preds = %18, %18, %18
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %27
store i8 50, i8* %28
br label %62
29: ; preds = %18, %18, %18
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %31
store i8 51, i8* %32
br label %62
33: ; preds = %18, %18, %18
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %35
store i8 52, i8* %36
br label %62
37: ; preds = %18, %18, %18
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %39
store i8 53, i8* %40
br label %62
41: ; preds = %18, %18, %18
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %43
store i8 54, i8* %44
br label %62
45: ; preds = %18, %18, %18
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %47
store i8 55, i8* %48
br label %62
49: ; preds = %18, %18, %18
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %51
store i8 56, i8* %52
br label %62
53: ; preds = %18, %18, %18
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %55
store i8 57, i8* %56
br label %62
57: ; preds = %18
%58 = load i8, i8* %4
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %60
store i8 %58, i8* %61
br label %62
62: ; preds = %57, %53, %49, %45, %41, %37, %33, %29, %25
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %14
65: ; preds = %14
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %67
67: ; preds = %79, %65
%68 = load i32, i32* %6
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
%71 = icmp slt i32 %68, %70
br i1 %71, label %72, label %82
72: ; preds = %67
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %72
%80 = load i32, i32* %6
%81 = add nsw i32 %80, 1
store i32 %81, i32* %6
br label %67
82: ; preds = %67
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"enter a phone number\00"
@str.4 = [17 x i8] c"in numeric form:\00"
@switch.table.main = [25 x i8] c"2223334445556667277888999"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
store i8 32, i8* %2
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %29, label %6
6: ; preds = %0, %20
%7 = phi i64 [ %23, %20 ], [ 0, %0 ]
%8 = phi i8 [ %24, %20 ], [ %4, %0 ]
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, -65
%11 = icmp ult i32 %10, 25
br i1 %11, label %12, label %20
12: ; preds = %6
%13 = lshr i32 33488895, %10
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = sext i32 %10 to i64
%18 = getelementptr inbounds [25 x i8], [25 x i8]* @switch.table.main, i64 0, i64 %17
%19 = load i8, i8* %18
br label %20
20: ; preds = %6, %12, %16
%21 = phi i8 [ %19, %16 ], [ %8, %12 ], [ %8, %6 ]
%22 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %7
store i8 %21, i8* %22
%23 = add nuw i64 %7, 1
%24 = tail call signext i8 (...) @getchar()
%25 = icmp eq i8 %24, 10
br i1 %25, label %26, label %6
26: ; preds = %20
%27 = add i64 %7, 2
%28 = and i64 %27, 4294967295
br label %29
29: ; preds = %26, %0
%30 = phi i64 [ 1, %0 ], [ %28, %26 ]
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
br label %34
32: ; preds = %34
%33 = tail call i32 @putchar(i32 10)
ret i32 0
34: ; preds = %29, %34
%35 = phi i64 [ 0, %29 ], [ %40, %34 ]
%36 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = tail call i32 @putchar(i32 %38)
%40 = add nuw nsw i64 %35, 1
%41 = icmp eq i64 %40, %30
br i1 %41, label %32, label %34
}