#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 EOF;
char getc(int /*<<< orphan*/);
scalar_t__ isalpha(char);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  char ch;
  int dig;
  while ((ch = getc(stdin)) != EOF) {
    if (isalpha(ch)) {
      if (ch >= 'Q') {
        ch--;
      }
      dig = (ch - 'A') / 3;
      putc('2' + dig, stdout);
    } else {
      putc(ch, stdout);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e86(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11d4 <main+0xa4>
movsbl -0x5(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     11bb <main+0x8b>
movsbl -0x5(%rbp),%eax
cmp    $0x51,%eax
jl     118d <main+0x5d>
mov    -0x5(%rbp),%al
add    $0xff,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x32,%eax
mov    0x2e24(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    11cf <main+0x9f>
mov    -0x5(%rbp),%al
mov    0x2e0b(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2ea9(%rip),%r14
mov    (%r14),%edi
call   1050 <getc@plt>
mov    0x2e92(%rip),%r15
cmp    (%r15),%al
jne    1161 <main+0x31>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %eax,%ebx
mov    0x2e66(%rip),%r12
jmp    118b <main+0x5b>
nopl   0x0(%rax)
mov    (%r12),%esi
movsbl %bl,%edi
call   1030 <putc@plt>
mov    (%r14),%edi
call   1050 <getc@plt>
mov    %eax,%ebx
cmp    (%r15),%al
je     1153 <main+0x23>
movsbl %bl,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1170 <main+0x40>
cmp    $0x51,%bl
setge  %al
sub    %al,%bl
movsbl %bl,%eax
imul   $0x5556,%eax,%ebx
add    $0xffea552a,%ebx
mov    %ebx,%eax
shr    $0x1f,%eax
shr    $0x10,%ebx
add    %eax,%ebx
add    $0x32,%bl
jmp    1170 <main+0x40>

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i8 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %36, %0
%5 = load i32, i32* @stdin
%6 = call signext i8 @getc(i32 %5)
store i8 %6, i8* %2
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %37
11: ; preds = %4
%12 = load i8, i8* %2
%13 = call i64 @isalpha(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %32
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 81
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8, i8* %2
%21 = add i8 %20, -1
store i8 %21, i8* %2
br label %22
22: ; preds = %19, %15
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 65
%26 = sdiv i32 %25, 3
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = add nsw i32 50, %27
%29 = trunc i32 %28 to i8
%30 = load i32, i32* @stdout
%31 = call i32 @putc(i8 signext %29, i32 %30)
br label %36
32: ; preds = %11
%33 = load i8, i8* %2
%34 = load i32, i32* @stdout
%35 = call i32 @putc(i8 signext %33, i32 %34)
br label %36
36: ; preds = %32, %22
br label %4
37: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i8 0
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call signext i8 @getc(i32 %1)
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %26, label %5
5: ; preds = %0, %18
%6 = phi i8 [ %23, %18 ], [ %2, %0 ]
%7 = tail call i64 @isalpha(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %5
%10 = icmp sgt i8 %6, 80
%11 = sext i1 %10 to i8
%12 = add i8 %6, %11
%13 = sext i8 %12 to i16
%14 = add nsw i16 %13, -65
%15 = sdiv i16 %14, 3
%16 = trunc i16 %15 to i8
%17 = add nsw i8 %16, 50
br label %18
18: ; preds = %5, %9
%19 = phi i8 [ %17, %9 ], [ %6, %5 ]
%20 = load i32, i32* @stdout
%21 = tail call i32 @putc(i8 signext %19, i32 %20)
%22 = load i32, i32* @stdin
%23 = tail call signext i8 @getc(i32 %22)
%24 = load i8, i8* @EOF
%25 = icmp eq i8 %23, %24
br i1 %25, label %26, label %5
26: ; preds = %18, %0
ret i32 0
}