#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*/ rot13(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char mas[1000];
  char opt;
  while (1) {
    printf("Enter option: ");
    do {
      scanf("%c", &opt);
      if ((opt == 'c') || (opt == 'q') || (opt == 'd'))
        break;
    } while (1);
    switch (opt) {
    case 'c':
      scanf("%1000s", mas);
      rot13(mas);
      break;
    case 'd':
      scanf("%1000s", mas);
      rot13(mas);
      break;
    case 'q':
      break;
    }
    if (opt == 'q')
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x3f1(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x3f1(%rbp),%eax
cmp    $0x63,%eax
je     1191 <main+0x61>
movsbl -0x3f1(%rbp),%eax
cmp    $0x71,%eax
je     1191 <main+0x61>
movsbl -0x3f1(%rbp),%eax
cmp    $0x64,%eax
jne    1196 <main+0x66>
jmp    11aa <main+0x7a>
jmp    119b <main+0x6b>
mov    $0x1,%al
test   $0x1,%al
jne    114e <main+0x1e>
jmp    11aa <main+0x7a>
movsbl -0x3f1(%rbp),%eax
mov    %eax,-0x3f8(%rbp)
sub    $0x63,%eax
je     11ed <main+0xbd>
jmp    11c5 <main+0x95>
mov    -0x3f8(%rbp),%eax
sub    $0x64,%eax
je     1211 <main+0xe1>
jmp    11d9 <main+0xa9>
mov    -0x3f8(%rbp),%eax
sub    $0x71,%eax
je     1235 <main+0x105>
jmp    123a <main+0x10a>
lea    -0x3f0(%rbp),%rsi
lea    0xe17(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <rot13@plt>
jmp    123a <main+0x10a>
lea    -0x3f0(%rbp),%rsi
lea    0xdf3(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <rot13@plt>
jmp    123a <main+0x10a>
jmp    123a <main+0x10a>
movsbl -0x3f1(%rbp),%eax
cmp    $0x71,%eax
jne    124f <main+0x11f>
jmp    1254 <main+0x124>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
lea    0xeb9(%rip),%r14
lea    0xec1(%rip),%r15
lea    0xf(%rsp),%rbx
lea    0xeb8(%rip),%r12
lea    0x10(%rsp),%r13
jmp    118a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
call   1030 <rot13@plt>
cmpb   $0x71,0xf(%rsp)
je     11bc <main+0x8c>
mov    %r14,%rdi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
lea    -0x63(%rax),%ecx
cmp    $0x2,%cl
jb     1170 <main+0x40>
cmp    $0x71,%al
jne    11a0 <main+0x70>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter option: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [7 x i8] c"%1000s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca i8
store i32 0, i32* %1
br label %4
4: ; preds = %0, %41
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %21, %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 99
br i1 %10, label %19, label %11
11: ; preds = %6
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 113
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 100
br i1 %18, label %19, label %20
19: ; preds = %15, %11, %6
br label %22
20: ; preds = %15
br label %21
21: ; preds = %20
br i1 true, label %6, label %22
22: ; preds = %21, %19
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
switch i32 %24, label %36 [
i32 99, label %25
i32 100, label %30
i32 113, label %35
]
25: ; preds = %22
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%27 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%29 = call i32 @rot13(i8* %28)
br label %36
30: ; preds = %22
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%32 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%34 = call i32 @rot13(i8* %33)
br label %36
35: ; preds = %22
br label %36
36: ; preds = %22, %35, %30, %25
%37 = load i8, i8* %3
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 113
br i1 %39, label %40, label %41
40: ; preds = %36
br label %42
41: ; preds = %36
br label %4
42: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter option: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [7 x i8] c"%1000s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
br label %4
4: ; preds = %9, %0
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%8 = load i8, i8* %2
switch i8 %8, label %6 [
i8 99, label %9
i8 100, label %9
i8 113, label %14
]
9: ; preds = %6, %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%11 = call i32 @rot13(i8* %3)
%12 = load i8, i8* %2
%13 = icmp eq i8 %12, 113
br i1 %13, label %14, label %4
14: ; preds = %9, %6
ret i32 0
}