#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*/ *gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int code[26] = {0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5,
                  5, 0, 1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2};
  char line[32];
  while (gets(line) != NULL) {
    char *ptr;
    int codeVal, prevCodeVal;
    prevCodeVal = -1;
    for (ptr = &line[0]; *ptr != '\0'; ptr++) {
      if ((codeVal = code[*ptr - 'A']) != 0 && codeVal != prevCodeVal) {
        printf("%d", code[*ptr - 'A']);
      }
      prevCodeVal = codeVal;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
lea    -0x90(%rbp),%rdi
call   1050 <gets@plt>
cmp    $0x0,%rax
je     1223 <main+0xf3>
movl   $0xffffffff,-0xa0(%rbp)
ff ff ff
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1210 <main+0xe0>
mov    -0x98(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
cltq
mov    -0x70(%rbp,%rax,4),%eax
mov    %eax,-0x9c(%rbp)
cmp    $0x0,%eax
je     11ed <main+0xbd>
mov    -0x9c(%rbp),%eax
cmp    -0xa0(%rbp),%eax
je     11ed <main+0xbd>
mov    -0x98(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
cltq
mov    -0x70(%rbp,%rax,4),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x9c(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
jmp    1185 <main+0x55>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1157 <main+0x27>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11d6 <main+0xa6>
mov    %rsp,%r14
lea    0xea7(%rip),%r13
mov    $0x1504191,%ebx
lea    0xf03(%rip),%r12
jmp    1187 <main+0x57>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11d6 <main+0xa6>
mov    (%rsp),%al
test   %al,%al
je     1170 <main+0x40>
mov    $0xffffffff,%ebp
lea    0x1(%rsp),%r15
jmp    11ac <main+0x7c>
nopw   0x0(%rax,%rax,1)
movzbl (%r15),%eax
add    $0x1,%r15
test   %al,%al
je     1170 <main+0x40>
mov    %ebp,%ecx
movsbq %al,%rax
mov    -0x104(%r13,%rax,4),%ebp
ff
add    $0xffffffffffffffbf,%rax
bt     %rax,%rbx
jb     11a0 <main+0x70>
cmp    %ecx,%ebp
je     11a0 <main+0x70>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.code = [26 x i32] [i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 0, i32 0, i32 2, i32 2, i32 4, i32 5, i32 5, i32 0, i32 1, i32 2, i32 6, i32 2, i32 3, i32 0, i32 1, i32 0, i32 2, i32 0, i32 2]
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [26 x i32]
%3 = alloca [32 x i8]
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [26 x i32]* %2 to i8*
br label %8
8: ; preds = %46, %0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%10 = call i32* @gets(i8* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %48
12: ; preds = %8
store i32 -1, i32* %6
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
store i8* %13, i8** %4
br label %14
14: ; preds = %43, %12
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %46
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 65
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
store i32 %26, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %41
28: ; preds = %19
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = icmp ne i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = sub nsw i32 %35, 65
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %32, %28, %19
%42 = load i32, i32* %5
store i32 %42, i32* %6
br label %43
43: ; preds = %41
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %4
br label %14
46: ; preds = %14
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %8
48: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@__const.main.code = [26 x i32] [i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 0, i32 0, i32 2, i32 2, i32 4, i32 5, i32 5, i32 0, i32 1, i32 2, i32 6, i32 2, i32 3, i32 0, i32 1, i32 0, i32 2, i32 0, i32 2]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = call i32* @gets(i8* %2)
%4 = icmp eq i32* %3, null
br i1 %4, label %31, label %5
5: ; preds = %0, %27
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %27, label %8
8: ; preds = %5, %23
%9 = phi i8 [ %25, %23 ], [ %6, %5 ]
%10 = phi i32 [ %15, %23 ], [ -1, %5 ]
%11 = phi i8* [ %24, %23 ], [ %2, %5 ]
%12 = sext i8 %9 to i64
%13 = add nsw i64 %12, -65
%14 = getelementptr inbounds [26 x i32], [26 x i32]* @__const.main.code, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = lshr i64 22036881, %13
%17 = and i64 %16, 1
%18 = icmp ne i64 %17, 0
%19 = icmp eq i32 %15, %10
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %23, label %21
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %23
23: ; preds = %21, %8
%24 = getelementptr inbounds i8, i8* %11, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %8
27: ; preds = %23, %5
%28 = call i32 @putchar(i32 10)
%29 = call i32* @gets(i8* %2)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %5
31: ; preds = %27, %0
ret i32 0
}