#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;
  printf("Enter phone number: ");
  while ((ch = getchar()) != '\n') {
    if (ch == '-') {
      printf("-");
      continue;
    }
    if (ch >= '0' && ch <= '9') {
      printf("%c", ch);
    } else {
      if (ch == 'A' || ch == 'B' || ch == 'C') {
        printf("2");
        continue;
      } else if (ch == 'D' || ch == 'E' || ch == 'F') {
        printf("3");
        continue;
      } else if (ch == 'G' || ch == 'H' || ch == 'I') {
        printf("4");
        continue;
      } else if (ch == 'J' || ch == 'K' || ch == 'L') {
        printf("5");
        continue;
      } else if (ch == 'M' || ch == 'N' || ch == 'O') {
        printf("6");
        continue;
      } else if (ch == 'P' || ch == 'R' || ch == 'S') {
        printf("7");
        continue;
      } else if (ch == 'T' || ch == 'U' || ch == 'V') {
        printf("8");
        continue;
      } else if (ch == 'W' || ch == 'X' || ch == 'Y') {
        printf("9");
        continue;
      }
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     13a1 <main+0x281>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    1173 <main+0x53>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11a4 <main+0x84>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11a4 <main+0x84>
movsbl -0x5(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    139c <main+0x27c>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
je     11cb <main+0xab>
movsbl -0x5(%rbp),%eax
cmp    $0x42,%eax
je     11cb <main+0xab>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
jne    11de <main+0xbe>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x44,%eax
je     1205 <main+0xe5>
movsbl -0x5(%rbp),%eax
cmp    $0x45,%eax
je     1205 <main+0xe5>
movsbl -0x5(%rbp),%eax
cmp    $0x46,%eax
jne    1218 <main+0xf8>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x47,%eax
je     123f <main+0x11f>
movsbl -0x5(%rbp),%eax
cmp    $0x48,%eax
je     123f <main+0x11f>
movsbl -0x5(%rbp),%eax
cmp    $0x49,%eax
jne    1252 <main+0x132>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x4a,%eax
je     1279 <main+0x159>
movsbl -0x5(%rbp),%eax
cmp    $0x4b,%eax
je     1279 <main+0x159>
movsbl -0x5(%rbp),%eax
cmp    $0x4c,%eax
jne    128c <main+0x16c>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x4d,%eax
je     12b3 <main+0x193>
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
je     12b3 <main+0x193>
movsbl -0x5(%rbp),%eax
cmp    $0x4f,%eax
jne    12c6 <main+0x1a6>
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x50,%eax
je     12ed <main+0x1cd>
movsbl -0x5(%rbp),%eax
cmp    $0x52,%eax
je     12ed <main+0x1cd>
movsbl -0x5(%rbp),%eax
cmp    $0x53,%eax
jne    1300 <main+0x1e0>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x54,%eax
je     1327 <main+0x207>
movsbl -0x5(%rbp),%eax
cmp    $0x55,%eax
je     1327 <main+0x207>
movsbl -0x5(%rbp),%eax
cmp    $0x56,%eax
jne    133a <main+0x21a>
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
movsbl -0x5(%rbp),%eax
cmp    $0x57,%eax
je     1361 <main+0x241>
movsbl -0x5(%rbp),%eax
cmp    $0x58,%eax
je     1361 <main+0x241>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
jne    1374 <main+0x254>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
jmp    1379 <main+0x259>
jmp    137e <main+0x25e>
jmp    1383 <main+0x263>
jmp    1388 <main+0x268>
jmp    138d <main+0x26d>
jmp    1392 <main+0x272>
jmp    1397 <main+0x277>
jmp    139c <main+0x27c>
jmp    113d <main+0x1d>
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7d,%ebx
lea    0xeca(%rip),%r14
jmp    1165 <main+0x35>
movsbq %cl,%rax
mov    (%r14,%rax,4),%edi
nopl   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x2d,%edi
cmp    $0x2d,%al
je     1160 <main+0x30>
cmp    $0xa,%al
je     11f9 <main+0xc9>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jae    1190 <main+0x60>
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1165 <main+0x35>
nop
lea    -0x41(%rax),%ecx
mov    $0x32,%edi
cmp    $0x3,%cl
jb     1160 <main+0x30>
lea    -0x44(%rax),%ecx
mov    $0x33,%edi
cmp    $0x3,%cl
jb     1160 <main+0x30>
lea    -0x47(%rax),%ecx
mov    $0x34,%edi
cmp    $0x3,%cl
jb     1160 <main+0x30>
lea    -0x4a(%rax),%ecx
mov    $0x35,%edi
cmp    $0x3,%cl
jb     1160 <main+0x30>
lea    -0x4d(%rax),%ecx
mov    $0x36,%edi
cmp    $0x3,%cl
jb     1160 <main+0x30>
lea    -0x50(%rax),%ecx
cmp    $0x7,%cl
jae    11e5 <main+0xb5>
movzbl %cl,%edx
bt     %edx,%ebx
jb     1150 <main+0x20>
add    $0xa9,%al
mov    $0x39,%edi
cmp    $0x3,%al
jae    1165 <main+0x35>
jmp    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter phone number: \00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [2 x i8] c"5\00"
@.str.7 = [2 x i8] c"6\00"
@.str.8 = [2 x i8] c"7\00"
@.str.9 = [2 x i8] c"8\00"
@.str.10 = [2 x i8] c"9\00"
@.str.11 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %146, %136, %122, %108, %94, %80, %66, %52, %38, %12, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %147
8: ; preds = %4
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 45
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %4
14: ; preds = %8
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 48
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 57
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %146
26: ; preds = %18, %14
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 65
br i1 %29, label %38, label %30
30: ; preds = %26
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 66
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 67
br i1 %37, label %38, label %40
38: ; preds = %34, %30, %26
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %4
40: ; preds = %34
%41 = load i8, i8* %2
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 68
br i1 %43, label %52, label %44
44: ; preds = %40
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 69
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = load i8, i8* %2
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 70
br i1 %51, label %52, label %54
52: ; preds = %48, %44, %40
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %4
54: ; preds = %48
%55 = load i8, i8* %2
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 71
br i1 %57, label %66, label %58
58: ; preds = %54
%59 = load i8, i8* %2
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 72
br i1 %61, label %66, label %62
62: ; preds = %58
%63 = load i8, i8* %2
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 73
br i1 %65, label %66, label %68
66: ; preds = %62, %58, %54
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %4
68: ; preds = %62
%69 = load i8, i8* %2
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 74
br i1 %71, label %80, label %72
72: ; preds = %68
%73 = load i8, i8* %2
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 75
br i1 %75, label %80, label %76
76: ; preds = %72
%77 = load i8, i8* %2
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 76
br i1 %79, label %80, label %82
80: ; preds = %76, %72, %68
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %4
82: ; preds = %76
%83 = load i8, i8* %2
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 77
br i1 %85, label %94, label %86
86: ; preds = %82
%87 = load i8, i8* %2
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 78
br i1 %89, label %94, label %90
90: ; preds = %86
%91 = load i8, i8* %2
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 79
br i1 %93, label %94, label %96
94: ; preds = %90, %86, %82
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %4
96: ; preds = %90
%97 = load i8, i8* %2
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 80
br i1 %99, label %108, label %100
100: ; preds = %96
%101 = load i8, i8* %2
%102 = sext i8 %101 to i32
%103 = icmp eq i32 %102, 82
br i1 %103, label %108, label %104
104: ; preds = %100
%105 = load i8, i8* %2
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 83
br i1 %107, label %108, label %110
108: ; preds = %104, %100, %96
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %4
110: ; preds = %104
%111 = load i8, i8* %2
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 84
br i1 %113, label %122, label %114
114: ; preds = %110
%115 = load i8, i8* %2
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 85
br i1 %117, label %122, label %118
118: ; preds = %114
%119 = load i8, i8* %2
%120 = sext i8 %119 to i32
%121 = icmp eq i32 %120, 86
br i1 %121, label %122, label %124
122: ; preds = %118, %114, %110
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %4
124: ; preds = %118
%125 = load i8, i8* %2
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %126, 87
br i1 %127, label %136, label %128
128: ; preds = %124
%129 = load i8, i8* %2
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 88
br i1 %131, label %136, label %132
132: ; preds = %128
%133 = load i8, i8* %2
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 89
br i1 %135, label %136, label %138
136: ; preds = %132, %128, %124
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %4
138: ; preds = %132
br label %139
139: ; preds = %138
br label %140
140: ; preds = %139
br label %141
141: ; preds = %140
br label %142
142: ; preds = %141
br label %143
143: ; preds = %142
br label %144
144: ; preds = %143
br label %145
145: ; preds = %144
br label %146
146: ; preds = %145, %22
br label %4
147: ; preds = %4
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter phone number: \00"
@switch.table.main = [7 x i32] [i32 55, i32 55, i32 55, i32 55, i32 56, i32 56, i32 56]
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %15, %0
%3 = tail call signext i8 (...) @getchar()
switch i8 %3, label %16 [
i8 10, label %41
i8 45, label %12
]
4: ; preds = %35
%5 = lshr i8 125, %36
%6 = and i8 %5, 1
%7 = icmp eq i8 %6, 0
br i1 %7, label %38, label %8
8: ; preds = %4
%9 = sext i8 %36 to i64
%10 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.main, i64 0, i64 %9
%11 = load i32, i32* %10
br label %12
12: ; preds = %8, %2, %38, %32, %29, %26, %23, %20, %16
%13 = phi i32 [ %17, %16 ], [ 50, %20 ], [ 51, %23 ], [ 52, %26 ], [ 53, %29 ], [ 54, %32 ], [ 57, %38 ], [ 45, %2 ], [ %11, %8 ]
%14 = tail call i32 @putchar(i32 %13)
br label %15
15: ; preds = %12, %38
br label %2
16: ; preds = %2
%17 = sext i8 %3 to i32
%18 = add i8 %3, -48
%19 = icmp ult i8 %18, 10
br i1 %19, label %12, label %20
20: ; preds = %16
%21 = add i8 %3, -65
%22 = icmp ult i8 %21, 3
br i1 %22, label %12, label %23
23: ; preds = %20
%24 = add i8 %3, -68
%25 = icmp ult i8 %24, 3
br i1 %25, label %12, label %26
26: ; preds = %23
%27 = add i8 %3, -71
%28 = icmp ult i8 %27, 3
br i1 %28, label %12, label %29
29: ; preds = %26
%30 = add i8 %3, -74
%31 = icmp ult i8 %30, 3
br i1 %31, label %12, label %32
32: ; preds = %29
%33 = add i8 %3, -77
%34 = icmp ult i8 %33, 3
br i1 %34, label %12, label %35
35: ; preds = %32
%36 = add i8 %3, -80
%37 = icmp ult i8 %36, 7
br i1 %37, label %4, label %38
38: ; preds = %4, %35
%39 = add i8 %3, -87
%40 = icmp ult i8 %39, 3
br i1 %40, label %12, label %15
41: ; preds = %2
%42 = tail call i32 @putchar(i32 10)
ret i32 0
}