#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 c[4];
  int i;
  printf("输入要解密的字符串\n");
  for (i = 0; i < 4; i++) {
    c[i] = getchar();
    if ('A' <= c[i] && c[i] <= 'D')
      c[i] -= 22;
    else
      c[i] -= 4;
    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,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11d1 <main+0xb1>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x8(%rbp,%rax,1)
movslq -0xc(%rbp),%rax
movsbl -0x8(%rbp,%rax,1),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     119c <main+0x7c>
movslq -0xc(%rbp),%rax
movsbl -0x8(%rbp,%rax,1),%eax
cmp    $0x44,%eax
jg     119c <main+0x7c>
movslq -0xc(%rbp),%rax
movsbl -0x8(%rbp,%rax,1),%ecx
sub    $0x16,%ecx
mov    %cl,-0x8(%rbp,%rax,1)
jmp    11ac <main+0x8c>
movslq -0xc(%rbp),%rax
movsbl -0x8(%rbp,%rax,1),%ecx
sub    $0x4,%ecx
mov    %cl,-0x8(%rbp,%rax,1)
movslq -0xc(%rbp),%rax
movsbl -0x8(%rbp,%rax,1),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x41(%rax),%ecx
cmp    $0x4,%cl
mov    $0xea,%ebp
mov    $0xfc,%ebx
mov    $0xfc,%ecx
cmovb  %ebp,%ecx
add    %al,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x41(%rax),%ecx
cmp    $0x4,%cl
mov    $0xfc,%ecx
cmovb  %ebp,%ecx
add    %al,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x41(%rax),%ecx
cmp    $0x4,%cl
mov    $0xfc,%ecx
cmovb  %ebp,%ecx
add    %al,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x41(%rax),%ecx
cmp    $0x4,%cl
cmovb  %ebp,%ebx
add    %al,%bl
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"\E8\BE\93\E5\85\A5\E8\A6\81\E8\A7\A3\E5\AF\86\E7\9A\84\E5\AD\97\E7\AC\A6\E4\B8\B2\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %49, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %52
8: ; preds = %5
%9 = call signext i8 (...) @getchar()
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %11
store i8 %9, i8* %12
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sle i32 65, %17
br i1 %18, label %19, label %34
19: ; preds = %8
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 68
br i1 %25, label %26, label %34
26: ; preds = %19
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 22
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
br label %42
34: ; preds = %19, %8
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = sub nsw i32 %39, 4
%41 = trunc i32 %40 to i8
store i8 %41, i8* %37
br label %42
42: ; preds = %34, %26
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %42
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %5
52: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"\E8\BE\93\E5\85\A5\E8\A6\81\E8\A7\A3\E5\AF\86\E7\9A\84\E5\AD\97\E7\AC\A6\E4\B8\B2\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 4
%5 = select i1 %4, i8 -22, i8 -4
%6 = add i8 %5, %2
%7 = sext i8 %6 to i32
%8 = tail call i32 @putchar(i32 %7)
%9 = tail call signext i8 (...) @getchar()
%10 = add i8 %9, -65
%11 = icmp ult i8 %10, 4
%12 = select i1 %11, i8 -22, i8 -4
%13 = add i8 %12, %9
%14 = sext i8 %13 to i32
%15 = tail call i32 @putchar(i32 %14)
%16 = tail call signext i8 (...) @getchar()
%17 = add i8 %16, -65
%18 = icmp ult i8 %17, 4
%19 = select i1 %18, i8 -22, i8 -4
%20 = add i8 %19, %16
%21 = sext i8 %20 to i32
%22 = tail call i32 @putchar(i32 %21)
%23 = tail call signext i8 (...) @getchar()
%24 = add i8 %23, -65
%25 = icmp ult i8 %24, 4
%26 = select i1 %25, i8 -22, i8 -4
%27 = add i8 %26, %23
%28 = sext i8 %27 to i32
%29 = tail call i32 @putchar(i32 %28)
ret i32 0
}