#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char c[5];
  int i;
  printf("Please input 5 characters:\n");
  for (i = 0; i < 5; i++) {
    scanf("%c", &c[i]);
    if (('W' <= c[i] && c[i] <= 'Z') || ('w' <= c[i] && c[i] <= 'z'))
      c[i] -= 22;
    else
      c[i] += 4;
  }
  for (i = 0; i < 5; i++)
    printf("%c", c[i]);
  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>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    11ed <main+0xcd>
movslq -0x10(%rbp),%rax
lea    -0x9(%rbp),%rsi
add    %rax,%rsi
lea    0xebc(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%ecx
mov    $0x57,%eax
cmp    %ecx,%eax
jg     118d <main+0x6d>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%eax
cmp    $0x5a,%eax
jle    11b5 <main+0x95>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%ecx
mov    $0x77,%eax
cmp    %ecx,%eax
jg     11ca <main+0xaa>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11ca <main+0xaa>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%ecx
sub    $0x16,%ecx
mov    %cl,-0x9(%rbp,%rax,1)
jmp    11da <main+0xba>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%ecx
add    $0x4,%ecx
mov    %cl,-0x9(%rbp,%rax,1)
jmp    11df <main+0xbf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x24>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1223 <main+0x103>
movslq -0x10(%rbp),%rax
movsbl -0x9(%rbp,%rax,1),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f4 <main+0xd4>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb5(%rip),%rbx
lea    0xb(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xb(%rsp),%al
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xa9,%cl
cmp    $0x4,%cl
mov    $0xea,%r14d
mov    $0x4,%ecx
cmovb  %r14d,%ecx
mov    $0x4,%ebp
add    %al,%cl
mov    %cl,0xb(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%al
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xa9,%cl
cmp    $0x4,%cl
mov    $0x4,%ecx
cmovb  %r14d,%ecx
add    %al,%cl
mov    %cl,0xc(%rsp)
lea    0xd(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xd(%rsp),%al
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xa9,%cl
cmp    $0x4,%cl
mov    $0x4,%ecx
cmovb  %r14d,%ecx
add    %al,%cl
mov    %cl,0xd(%rsp)
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xe(%rsp),%al
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xa9,%cl
cmp    $0x4,%cl
mov    $0x4,%ecx
cmovb  %r14d,%ecx
add    %al,%cl
mov    %cl,0xe(%rsp)
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xf(%rsp),%al
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xa9,%cl
cmp    $0x4,%cl
cmovb  %r14d,%ebp
add    %al,%bpl
mov    %bpl,0xf(%rsp)
movsbl 0xb(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xc(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xd(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xe(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xf(%rsp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@str = [27 x i8] c"Please input 5 characters:\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = and i8 %5, -33
%7 = add i8 %6, -87
%8 = icmp ult i8 %7, 4
%9 = select i1 %8, i8 -22, i8 4
%10 = add i8 %5, %9
store i8 %10, i8* %2
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i8, i8* %11
%14 = and i8 %13, -33
%15 = add i8 %14, -87
%16 = icmp ult i8 %15, 4
%17 = select i1 %16, i8 -22, i8 4
%18 = add i8 %13, %17
store i8 %18, i8* %11
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 2
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8, i8* %19
%22 = and i8 %21, -33
%23 = add i8 %22, -87
%24 = icmp ult i8 %23, 4
%25 = select i1 %24, i8 -22, i8 4
%26 = add i8 %21, %25
store i8 %26, i8* %19
%27 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 3
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i8, i8* %27
%30 = and i8 %29, -33
%31 = add i8 %30, -87
%32 = icmp ult i8 %31, 4
%33 = select i1 %32, i8 -22, i8 4
%34 = add i8 %29, %33
store i8 %34, i8* %27
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 4
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = load i8, i8* %35
%38 = and i8 %37, -33
%39 = add i8 %38, -87
%40 = icmp ult i8 %39, 4
%41 = select i1 %40, i8 -22, i8 4
%42 = add i8 %37, %41
store i8 %42, i8* %35
%43 = load i8, i8* %2
%44 = sext i8 %43 to i32
%45 = call i32 @putchar(i32 %44)
%46 = load i8, i8* %11
%47 = sext i8 %46 to i32
%48 = call i32 @putchar(i32 %47)
%49 = load i8, i8* %19
%50 = sext i8 %49 to i32
%51 = call i32 @putchar(i32 %50)
%52 = load i8, i8* %27
%53 = sext i8 %52 to i32
%54 = call i32 @putchar(i32 %53)
%55 = load i8, i8* %35
%56 = sext i8 %55 to i32
%57 = call i32 @putchar(i32 %56)
ret i32 0
}