#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *gets(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  const char table[] = {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6,
                        6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9};
  int i;
  char string[30 + 1];
  fflush(stdin);
  while (gets(string) != NULL) {
    for (i = 0; string[i]; i++) {
      if (string[i] >= 'A' && string[i] <= 'Z')
        string[i] = table[string[i] - 'A'] + '0';
    }
    puts(string);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeaa(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    -0x60(%rbp),%rdi
call   1040 <gets@plt>
cmp    $0x0,%rax
je     120e <main+0xde>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmpb   $0x0,-0x60(%rbp,%rax,1)
je     1200 <main+0xd0>
movslq -0x34(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x41,%eax
jl     11ed <main+0xbd>
movslq -0x34(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x5a,%eax
jg     11ed <main+0xbd>
movslq -0x34(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
sub    $0x41,%eax
cltq
movsbl -0x30(%rbp,%rax,1),%eax
add    $0x30,%eax
mov    %al,%cl
movslq -0x34(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
jmp    11f2 <main+0xc2>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119a <main+0x6a>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     11c5 <main+0x95>
lea    0x1(%rsp),%r14
mov    %rsp,%r15
lea    0xe9d(%rip),%rbx
jmp    1185 <main+0x55>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     11c5 <main+0x95>
mov    (%rsp),%cl
test   %cl,%cl
je     1170 <main+0x40>
mov    %r14,%rax
jmp    11ab <main+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1170 <main+0x40>
lea    -0x41(%rcx),%edx
cmp    $0x19,%dl
ja     11a0 <main+0x70>
movzbl %cl,%ecx
add    $0xffffffbf,%ecx
movzbl (%rcx,%rbx,1),%ecx
add    $0x30,%cl
mov    %cl,-0x1(%rax)
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.table = [26 x i8] c"\02\02\02\03\03\03\04\04\04\05\05\05\06\06\06\07\07\07\07\08\08\08\09\09\09\09"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [26 x i8]
%7 = alloca i32
%8 = alloca [31 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [26 x i8]* %6 to i8*
%10 = load i32, i32* @stdin
%11 = call i32 @fflush(i32 %10)
br label %12
12: ; preds = %57, %2
%13 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 0
%14 = call i32* @gets(i8* %13)
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %60
16: ; preds = %12
store i32 0, i32* %7
br label %17
17: ; preds = %54, %16
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = icmp ne i8 %21, 0
br i1 %22, label %23, label %57
23: ; preds = %17
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sge i32 %28, 65
br i1 %29, label %30, label %53
30: ; preds = %23
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp sle i32 %35, 90
br i1 %36, label %37, label %53
37: ; preds = %30
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = sub nsw i32 %42, 65
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [26 x i8], [26 x i8]* %6, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = add nsw i32 %47, 48
%49 = trunc i32 %48 to i8
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 %51
store i8 %49, i8* %52
br label %53
53: ; preds = %37, %30, %23
br label %54
54: ; preds = %53
%55 = load i32, i32* %7
%56 = add nsw i32 %55, 1
store i32 %56, i32* %7
br label %17
57: ; preds = %17
%58 = getelementptr inbounds [31 x i8], [31 x i8]* %8, i64 0, i64 0
%59 = call i32 @puts(i8* %58)
br label %12
60: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@__const.main.table = [26 x i8] c"\02\02\02\03\03\03\04\04\04\05\05\05\06\06\06\07\07\07\07\08\08\08\09\09\09\09"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [31 x i8]
%4 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = tail call i32 @fflush(i32 %5)
%7 = call i32* @gets(i8* %4)
%8 = icmp eq i32* %7, null
br i1 %8, label %34, label %9
9: ; preds = %2, %30
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 0
br i1 %11, label %30, label %12
12: ; preds = %9, %25
%13 = phi i64 [ %26, %25 ], [ 0, %9 ]
%14 = phi i8 [ %28, %25 ], [ %10, %9 ]
%15 = phi i8* [ %27, %25 ], [ %4, %9 ]
%16 = add i8 %14, -65
%17 = icmp ult i8 %16, 26
br i1 %17, label %18, label %25
18: ; preds = %12
%19 = zext i8 %14 to i64
%20 = add nuw nsw i64 %19, 4294967231
%21 = and i64 %20, 4294967295
%22 = getelementptr inbounds [26 x i8], [26 x i8]* @__const.main.table, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = add i8 %23, 48
store i8 %24, i8* %15
br label %25
25: ; preds = %12, %18
%26 = add nuw i64 %13, 1
%27 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %12
30: ; preds = %25, %9
%31 = call i32 @puts(i8* %4)
%32 = call i32* @gets(i8* %4)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %9
34: ; preds = %30, %2
ret i32 0
}