#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 opt, txt[1000], txtt[1000];
  int i, n;
  printf("Enter an option (c - coding; d - decoding; q)");
  scanf("%c", &opt);
  while (opt == 'c') {
    printf("Enter your text for coding:\n");
    scanf("%s", &txt[i]);
    for (i = 0; txt[i] != '\0'; i++) {
      int num = txt[i];
      if ((num > 64 && num < 78) || (num > 96 && num < 110))
        num = num + 13;
      else if ((num >= 78 && num <= 90) || (num >= 110 && num <= 122))
        num = num - 13;
      txt[i] = num;
    }
    printf("%s", txt);
    printf("\n");
    break;
  }
  while (opt == 'd') {
    printf("Enter your text for decoding:\n");
    scanf("%s", &txtt[n]);
    for (n = 0; txtt[n] != '\0'; n++) {
      int numz = txtt[n];
      if ((numz > 64 && numz < 78) || (numz > 96 && numz < 110))
        numz = numz + 13;
      else if ((numz >= 78 && numz <= 90) || (numz >= 110 && numz <= 122))
        numz = numz - 13;
      txtt[n] = numz;
    }
    printf("%s", txtt);
    printf("\n");
    break;
  }
  if (opt == 'q')
    return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    129c <main+0x17c>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x7e4(%rbp),%rax
lea    -0x3f0(%rbp),%rsi
add    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x7e4(%rbp)
movslq -0x7e4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1279 <main+0x159>
movslq -0x7e4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
mov    %eax,-0x7ec(%rbp)
cmpl   $0x40,-0x7ec(%rbp)
jle    11d9 <main+0xb9>
cmpl   $0x4e,-0x7ec(%rbp)
jl     11f3 <main+0xd3>
cmpl   $0x60,-0x7ec(%rbp)
jle    1207 <main+0xe7>
cmpl   $0x6e,-0x7ec(%rbp)
jge    1207 <main+0xe7>
mov    -0x7ec(%rbp),%eax
add    $0xd,%eax
mov    %eax,-0x7ec(%rbp)
jmp    124f <main+0x12f>
cmpl   $0x4e,-0x7ec(%rbp)
jl     1221 <main+0x101>
cmpl   $0x5a,-0x7ec(%rbp)
jle    123b <main+0x11b>
cmpl   $0x6e,-0x7ec(%rbp)
jl     124a <main+0x12a>
cmpl   $0x7a,-0x7ec(%rbp)
jg     124a <main+0x12a>
mov    -0x7ec(%rbp),%eax
sub    $0xd,%eax
mov    %eax,-0x7ec(%rbp)
jmp    124f <main+0x12f>
mov    -0x7ec(%rbp),%eax
mov    %al,%cl
movslq -0x7e4(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x7e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e4(%rbp)
jmp    1192 <main+0x72>
lea    -0x3f0(%rbp),%rsi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a1 <main+0x181>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    13ed <main+0x2cd>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x7e8(%rbp),%rax
lea    -0x7e0(%rbp),%rsi
add    %rax,%rsi
lea    0xd7a(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x7e8(%rbp)
movslq -0x7e8(%rbp),%rax
movsbl -0x7e0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     13ca <main+0x2aa>
movslq -0x7e8(%rbp),%rax
movsbl -0x7e0(%rbp,%rax,1),%eax
ff
mov    %eax,-0x7f0(%rbp)
cmpl   $0x40,-0x7f0(%rbp)
jle    132a <main+0x20a>
cmpl   $0x4e,-0x7f0(%rbp)
jl     1344 <main+0x224>
cmpl   $0x60,-0x7f0(%rbp)
jle    1358 <main+0x238>
cmpl   $0x6e,-0x7f0(%rbp)
jge    1358 <main+0x238>
mov    -0x7f0(%rbp),%eax
add    $0xd,%eax
mov    %eax,-0x7f0(%rbp)
jmp    13a0 <main+0x280>
cmpl   $0x4e,-0x7f0(%rbp)
jl     1372 <main+0x252>
cmpl   $0x5a,-0x7f0(%rbp)
jle    138c <main+0x26c>
cmpl   $0x6e,-0x7f0(%rbp)
jl     139b <main+0x27b>
cmpl   $0x7a,-0x7f0(%rbp)
jg     139b <main+0x27b>
mov    -0x7f0(%rbp),%eax
sub    $0xd,%eax
mov    %eax,-0x7f0(%rbp)
jmp    13a0 <main+0x280>
mov    -0x7f0(%rbp),%eax
mov    %al,%cl
movslq -0x7e8(%rbp),%rax
mov    %cl,-0x7e0(%rbp,%rax,1)
mov    -0x7e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e8(%rbp)
jmp    12e3 <main+0x1c3>
lea    -0x7e0(%rbp),%rsi
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    1401 <main+0x2e1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x7e8,%rsp
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0x63,%al
jne    1207 <main+0xc7>
lea    0xed9(%rip),%rdi
call   1040 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x400(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x400(%rsp),%al
test   %al,%al
je     11e3 <main+0xa3>
lea    0x401(%rsp),%rcx
jmp    11d1 <main+0x91>
nopw   0x0(%rax,%rax,1)
add    $0xb2,%dl
lea    -0xd(%rax),%esi
cmp    $0xd,%dl
movzbl %al,%edx
movzbl %sil,%eax
cmovae %edx,%eax
mov    %al,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     11e3 <main+0xa3>
mov    %eax,%edx
and    $0xdf,%dl
lea    -0x41(%rdx),%esi
cmp    $0xc,%sil
ja     11b0 <main+0x70>
add    $0xd,%al
jmp    11c3 <main+0x83>
lea    0xe47(%rip),%rdi
lea    0x400(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xf(%rsp),%al
cmp    $0x64,%al
jne    1290 <main+0x150>
lea    0xe1e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe0f(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x10(%rsp),%al
test   %al,%al
je     1273 <main+0x133>
lea    0x11(%rsp),%rcx
jmp    1261 <main+0x121>
nopl   0x0(%rax,%rax,1)
add    $0xb2,%dl
lea    -0xd(%rax),%esi
cmp    $0xd,%dl
movzbl %al,%edx
movzbl %sil,%eax
cmovae %edx,%eax
mov    %al,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     1273 <main+0x133>
mov    %eax,%edx
and    $0xdf,%dl
lea    -0x41(%rdx),%esi
cmp    $0xc,%sil
ja     1240 <main+0x100>
add    $0xd,%al
jmp    1253 <main+0x113>
lea    0xdb7(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x7e8,%rsp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Enter an option (c - coding; d - decoding; q)\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [29 x i8] c"Enter your text for coding:\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [31 x i8] c"Enter your text for decoding:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %11
11: ; preds = %0
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 99
br i1 %14, label %15, label %77
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %19)
store i32 0, i32* %5
br label %21
21: ; preds = %70, %15
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %73
28: ; preds = %21
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
store i32 %33, i32* %7
%34 = load i32, i32* %7
%35 = icmp sgt i32 %34, 64
br i1 %35, label %36, label %39
36: ; preds = %28
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 78
br i1 %38, label %45, label %39
39: ; preds = %36, %28
%40 = load i32, i32* %7
%41 = icmp sgt i32 %40, 96
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load i32, i32* %7
%44 = icmp slt i32 %43, 110
br i1 %44, label %45, label %48
45: ; preds = %42, %36
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 13
store i32 %47, i32* %7
br label %64
48: ; preds = %42, %39
%49 = load i32, i32* %7
%50 = icmp sge i32 %49, 78
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* %7
%53 = icmp sle i32 %52, 90
br i1 %53, label %60, label %54
54: ; preds = %51, %48
%55 = load i32, i32* %7
%56 = icmp sge i32 %55, 110
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load i32, i32* %7
%59 = icmp sle i32 %58, 122
br i1 %59, label %60, label %63
60: ; preds = %57, %51
%61 = load i32, i32* %7
%62 = sub nsw i32 %61, 13
store i32 %62, i32* %7
br label %63
63: ; preds = %60, %57, %54
br label %64
64: ; preds = %63, %45
%65 = load i32, i32* %7
%66 = trunc i32 %65 to i8
%67 = load i32, i32* %5
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %68
store i8 %66, i8* %69
br label %70
70: ; preds = %64
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %21
73: ; preds = %21
%74 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %74)
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %77
77: ; preds = %73, %11
br label %78
78: ; preds = %77
%79 = load i8, i8* %2
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 100
br i1 %81, label %82, label %144
82: ; preds = %78
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%84 = load i32, i32* %6
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %85
%87 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %86)
store i32 0, i32* %6
br label %88
88: ; preds = %137, %82
%89 = load i32, i32* %6
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %140
95: ; preds = %88
%96 = load i32, i32* %6
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %97
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
store i32 %100, i32* %8
%101 = load i32, i32* %8
%102 = icmp sgt i32 %101, 64
br i1 %102, label %103, label %106
103: ; preds = %95
%104 = load i32, i32* %8
%105 = icmp slt i32 %104, 78
br i1 %105, label %112, label %106
106: ; preds = %103, %95
%107 = load i32, i32* %8
%108 = icmp sgt i32 %107, 96
br i1 %108, label %109, label %115
109: ; preds = %106
%110 = load i32, i32* %8
%111 = icmp slt i32 %110, 110
br i1 %111, label %112, label %115
112: ; preds = %109, %103
%113 = load i32, i32* %8
%114 = add nsw i32 %113, 13
store i32 %114, i32* %8
br label %131
115: ; preds = %109, %106
%116 = load i32, i32* %8
%117 = icmp sge i32 %116, 78
br i1 %117, label %118, label %121
118: ; preds = %115
%119 = load i32, i32* %8
%120 = icmp sle i32 %119, 90
br i1 %120, label %127, label %121
121: ; preds = %118, %115
%122 = load i32, i32* %8
%123 = icmp sge i32 %122, 110
br i1 %123, label %124, label %130
124: ; preds = %121
%125 = load i32, i32* %8
%126 = icmp sle i32 %125, 122
br i1 %126, label %127, label %130
127: ; preds = %124, %118
%128 = load i32, i32* %8
%129 = sub nsw i32 %128, 13
store i32 %129, i32* %8
br label %130
130: ; preds = %127, %124, %121
br label %131
131: ; preds = %130, %112
%132 = load i32, i32* %8
%133 = trunc i32 %132 to i8
%134 = load i32, i32* %6
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %135
store i8 %133, i8* %136
br label %137
137: ; preds = %131
%138 = load i32, i32* %6
%139 = add nsw i32 %138, 1
store i32 %139, i32* %6
br label %88
140: ; preds = %88
%141 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %141)
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %144
144: ; preds = %140, %78
%145 = load i8, i8* %2
%146 = sext i8 %145 to i32
%147 = icmp eq i32 %146, 113
br i1 %147, label %148, label %149
148: ; preds = %144
store i32 0, i32* %1
br label %149
149: ; preds = %148, %144
%150 = load i32, i32* %1
ret i32 %150
}

LLVM IR (-O2):
@.str = [46 x i8] c"Enter an option (c - coding; d - decoding; q)\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.3 = [3 x i8] c"%s\00"
@str = [30 x i8] c"Enter your text for decoding:\00"
@str.6 = [28 x i8] c"Enter your text for coding:\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 99
br i1 %9, label %10, label %39
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%13 = load i8, i8* %4
%14 = icmp eq i8 %13, 0
br i1 %14, label %35, label %15
15: ; preds = %10, %29
%16 = phi i64 [ %31, %29 ], [ 0, %10 ]
%17 = phi i8 [ %33, %29 ], [ %13, %10 ]
%18 = phi i8* [ %32, %29 ], [ %4, %10 ]
%19 = and i8 %17, -33
%20 = add i8 %19, -65
%21 = icmp ult i8 %20, 13
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = add nuw nsw i8 %17, 13
br label %29
24: ; preds = %15
%25 = add i8 %19, -78
%26 = icmp ult i8 %25, 13
%27 = add i8 %17, -13
%28 = select i1 %26, i8 %27, i8 %17
br label %29
29: ; preds = %24, %22
%30 = phi i8 [ %23, %22 ], [ %28, %24 ]
store i8 %30, i8* %18
%31 = add nuw i64 %16, 1
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %15
35: ; preds = %29, %10
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%37 = call i32 @putchar(i32 10)
%38 = load i8, i8* %1
br label %39
39: ; preds = %0, %35
%40 = phi i8 [ %8, %0 ], [ %38, %35 ]
%41 = icmp eq i8 %40, 100
br i1 %41, label %42, label %70
42: ; preds = %39
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%45 = load i8, i8* %5
%46 = icmp eq i8 %45, 0
br i1 %46, label %67, label %47
47: ; preds = %42, %61
%48 = phi i64 [ %63, %61 ], [ 0, %42 ]
%49 = phi i8 [ %65, %61 ], [ %45, %42 ]
%50 = phi i8* [ %64, %61 ], [ %5, %42 ]
%51 = and i8 %49, -33
%52 = add i8 %51, -65
%53 = icmp ult i8 %52, 13
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = add nuw nsw i8 %49, 13
br label %61
56: ; preds = %47
%57 = add i8 %51, -78
%58 = icmp ult i8 %57, 13
%59 = add i8 %49, -13
%60 = select i1 %58, i8 %59, i8 %49
br label %61
61: ; preds = %56, %54
%62 = phi i8 [ %55, %54 ], [ %60, %56 ]
store i8 %62, i8* %50
%63 = add nuw i64 %48, 1
%64 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 0
br i1 %66, label %67, label %47
67: ; preds = %61, %42
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%69 = call i32 @putchar(i32 10)
br label %70
70: ; preds = %39, %67
ret i32 0
}