#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 /*<<< orphan*/ putchar(char);
int main() {
  int j, n;
  char ch[80];
  printf("input cipher code:\n");
  gets(ch);
  printf("\ncipher code:%s\n", ch);
  j = 0;
  while (ch[j] != '\0') {
    if ((ch[j] >= 'A') && (ch[j] <= 'Z'))
      ch[j] = 155 - ch[j];
    else if ((ch[j] >= 'a') && (ch[j] <= 'z'))
      ch[j] = 219 - ch[j];
    else
      ch[j] = ch[j];
    j++;
  }
  n = j;
  printf("original text:");
  for (j = 0; j < n; j++)
    putchar(ch[j]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     122a <main+0xfa>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x41,%eax
jl     11c4 <main+0x94>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x5a,%eax
jg     11c4 <main+0x94>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
mov    $0x9b,%eax
sub    %ecx,%eax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
jmp    121c <main+0xec>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     1207 <main+0xd7>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     1207 <main+0xd7>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
mov    $0xdb,%eax
sub    %ecx,%eax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
jmp    1217 <main+0xe7>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,1),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
jmp    121c <main+0xec>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <main+0x3f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    126d <main+0x13d>
movslq -0x8(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1245 <main+0x115>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xed2(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     11d4 <main+0x94>
xor    %ebx,%ebx
jmp    1192 <main+0x52>
nopw   0x0(%rax,%rax,1)
sub    %al,%cl
mov    %cl,(%rsp,%rbx,1)
movzbl 0x1(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     11a8 <main+0x68>
lea    -0x41(%rax),%edx
mov    $0x9b,%cl
cmp    $0x1a,%dl
jb     1180 <main+0x40>
lea    -0x61(%rax),%edx
mov    $0xdb,%cl
cmp    $0x19,%dl
jbe    1180 <main+0x40>
jmp    1185 <main+0x45>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
je     11e2 <main+0xa2>
mov    %ebx,%r14d
xor    %ebx,%ebx
nop
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    11c0 <main+0x80>
jmp    11e2 <main+0xa2>
lea    0xe36(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"input cipher code:\0A\00"
@.str.1 = [17 x i8] c"\0Acipher code:%s\0A\00"
@.str.2 = [15 x i8] c"original text:\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [80 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %8)
store i32 0, i32* %2
br label %10
10: ; preds = %76, %0
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %79
17: ; preds = %10
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sge i32 %22, 65
br i1 %23, label %24, label %42
24: ; preds = %17
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 90
br i1 %30, label %31, label %42
31: ; preds = %24
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = sub nsw i32 155, %36
%38 = trunc i32 %37 to i8
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %40
store i8 %38, i8* %41
br label %76
42: ; preds = %24, %17
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp sge i32 %47, 97
br i1 %48, label %49, label %67
49: ; preds = %42
%50 = load i32, i32* %2
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp sle i32 %54, 122
br i1 %55, label %56, label %67
56: ; preds = %49
%57 = load i32, i32* %2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = sub nsw i32 219, %61
%63 = trunc i32 %62 to i8
%64 = load i32, i32* %2
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %65
store i8 %63, i8* %66
br label %75
67: ; preds = %49, %42
%68 = load i32, i32* %2
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = load i32, i32* %2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %73
store i8 %71, i8* %74
br label %75
75: ; preds = %67, %56
br label %76
76: ; preds = %75, %31
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
br label %10
79: ; preds = %10
%80 = load i32, i32* %2
store i32 %80, i32* %3
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %82
82: ; preds = %92, %79
%83 = load i32, i32* %2
%84 = load i32, i32* %3
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %95
86: ; preds = %82
%87 = load i32, i32* %2
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = call i32 @putchar(i8 signext %90)
br label %92
92: ; preds = %86
%93 = load i32, i32* %2
%94 = add nsw i32 %93, 1
store i32 %94, i32* %2
br label %82
95: ; preds = %82
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"\0Acipher code:%s\0A\00"
@.str.2 = [15 x i8] c"original text:\00"
@str = [19 x i8] c"input cipher code:\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %40
10: ; preds = %0, %22
%11 = phi i64 [ %23, %22 ], [ 0, %0 ]
%12 = phi i8 [ %25, %22 ], [ %6, %0 ]
%13 = phi i8* [ %24, %22 ], [ %2, %0 ]
%14 = add i8 %12, -65
%15 = icmp ult i8 %14, 26
br i1 %15, label %19, label %16
16: ; preds = %10
%17 = add i8 %12, -97
%18 = icmp ult i8 %17, 26
br i1 %18, label %19, label %22
19: ; preds = %16, %10
%20 = phi i8 [ -101, %10 ], [ -37, %16 ]
%21 = sub nuw i8 %20, %12
store i8 %21, i8* %13
br label %22
22: ; preds = %19, %16
%23 = add nuw i64 %11, 1
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %10
27: ; preds = %22
%28 = trunc i64 %23 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i32 %28, 0
br i1 %30, label %40, label %31
31: ; preds = %27
%32 = and i64 %23, 4294967295
br label %33
33: ; preds = %31, %33
%34 = phi i64 [ 0, %31 ], [ %38, %33 ]
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @putchar(i8 signext %36)
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, %32
br i1 %39, label %40, label %33
40: ; preds = %33, %8, %27
%41 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret i32 0
}