#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 str = getchar();
  while (str != '\n') {
    if (str >= 'A' && str <= 'Z')
      printf("%02d", str - 'A' + 1);
    else if (str >= 'a' && str <= 'z')
      printf("%02d", 'a' - str + 52);
    else if (str >= '0' && str <= '9')
      printf("%02d", str - '0' + 90);
    else if (str == ' ')
      printf("#");
    else
      printf("*");
    str = getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     123b <main+0x11b>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     117d <main+0x5d>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     117d <main+0x5d>
movsbl -0x5(%rbp),%esi
sub    $0x41,%esi
add    $0x1,%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0x10c>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11b8 <main+0x98>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     11b8 <main+0x98>
movsbl -0x5(%rbp),%eax
mov    $0x61,%esi
sub    %eax,%esi
add    $0x34,%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1227 <main+0x107>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11ef <main+0xcf>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11ef <main+0xcf>
movsbl -0x5(%rbp),%esi
sub    $0x30,%esi
add    $0x5a,%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1222 <main+0x102>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    120f <main+0xef>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121d <main+0xfd>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1222 <main+0x102>
jmp    1227 <main+0x107>
jmp    122c <main+0x10c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1140 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret
lea    0xeb9(%rip),%rbx
jmp    116e <main+0x3e>
nopl   0x0(%rax)
mov    $0x95,%eax
sub    %esi,%eax
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     113c <main+0xc>
movsbl %al,%esi
lea    -0x41(%rsi),%ecx
cmp    $0x19,%cl
ja     1190 <main+0x60>
add    $0xffffffc0,%esi
mov    %rbx,%rdi
jmp    115c <main+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
jbe    1150 <main+0x20>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     11a5 <main+0x75>
add    $0x2a,%esi
jmp    117c <main+0x4c>
cmp    $0x20,%al
jne    11b0 <main+0x80>
mov    $0x23,%edi
jmp    11b5 <main+0x85>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    1163 <main+0x33>

LLVM IR (-O0):
@.str = [5 x i8] c"%02d\00"
@.str.1 = [2 x i8] c"#\00"
@.str.2 = [2 x i8] c"*\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
br label %4
4: ; preds = %61, %0
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %63
8: ; preds = %4
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 65
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 90
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 65
%20 = add nsw i32 %19, 1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %61
22: ; preds = %12, %8
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 97
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 122
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = sub nsw i32 97, %32
%34 = add nsw i32 %33, 52
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %34)
br label %60
36: ; preds = %26, %22
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = icmp sge i32 %38, 48
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load i8, i8* %2
%42 = sext i8 %41 to i32
%43 = icmp sle i32 %42, 57
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = sub nsw i32 %46, 48
%48 = add nsw i32 %47, 90
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %48)
br label %59
50: ; preds = %40, %36
%51 = load i8, i8* %2
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 32
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %58
56: ; preds = %50
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56, %54
br label %59
59: ; preds = %58, %44
br label %60
60: ; preds = %59, %30
br label %61
61: ; preds = %60, %16
%62 = call signext i8 (...) @getchar()
store i8 %62, i8* %2
br label %4
63: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02d\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 10
br i1 %2, label %32, label %3
3: ; preds = %0, %29
%4 = phi i8 [ %30, %29 ], [ %1, %0 ]
%5 = sext i8 %4 to i32
%6 = add i8 %4, -65
%7 = icmp ult i8 %6, 26
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = add nsw i32 %5, -64
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %29
11: ; preds = %3
%12 = add i8 %4, -97
%13 = icmp ult i8 %12, 26
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = sub nsw i32 149, %5
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %29
17: ; preds = %11
%18 = add i8 %4, -48
%19 = icmp ult i8 %18, 10
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = add nsw i32 %5, 42
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %29
23: ; preds = %17
%24 = icmp eq i8 %4, 32
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = tail call i32 @putchar(i32 35)
br label %29
27: ; preds = %23
%28 = tail call i32 @putchar(i32 42)
br label %29
29: ; preds = %14, %25, %27, %20, %8
%30 = tail call signext i8 (...) @getchar()
%31 = icmp eq i8 %30, 10
br i1 %31, label %32, label %3
32: ; preds = %29, %0
ret i32 0
}