#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*/ decryption(char *);
int /*<<< orphan*/ encryption(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char b, chr[1000];
  printf("Enter option 'c' for encryption the text, 'd' for decryption the "
         "text or 'q' for exit the program:");
  scanf("%c", &b);
  while (b == 'c') {
    printf("Input the text for ecnryption.\n");
    encryption(chr);
  }
  while (b == 'd') {
    printf("Input the text for decryption.\n");
    decryption(chr);
  }
  while (b == 'q') {
    printf("You exit the program.\n");
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
call   1050 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    1198 <main+0x58>
lea    0xee4(%rip),%rdi
call   1050 <printf@plt>
lea    -0x3f0(%rbp),%rdi
call   1040 <encryption@plt>
jmp    116e <main+0x2e>
jmp    119d <main+0x5d>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    11c7 <main+0x87>
lea    0xed5(%rip),%rdi
call   1050 <printf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <decryption@plt>
jmp    119d <main+0x5d>
jmp    11cc <main+0x8c>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    11f1 <main+0xb1>
lea    0xec6(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f8 <main+0xb8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
lea    0xe9f(%rip),%rdi
call   1060 <printf@plt>
lea    0xef6(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0x63,%al
jne    11a9 <main+0x59>
lea    0xf15(%rip),%r14
lea    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <encryption@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x63,%al
je     1190 <main+0x40>
lea    0xecc(%rip),%r14
lea    0x10(%rsp),%rbx
cmp    $0x64,%al
jne    11d9 <main+0x89>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <decryption@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x64,%al
je     11c0 <main+0x70>
cmp    $0x71,%al
jne    11e9 <main+0x99>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [99 x i8] c"Enter option 'c' for encryption the text, 'd' for decryption the text or 'q' for exit the program:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [32 x i8] c"Input the text for ecnryption.\0A\00"
@.str.3 = [32 x i8] c"Input the text for decryption.\0A\00"
@.str.4 = [23 x i8] c"You exit the program.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [1000 x i8]
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %6
6: ; preds = %10, %0
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 99
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%13 = call i32 @encryption(i8* %12)
br label %6
14: ; preds = %6
br label %15
15: ; preds = %19, %14
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 100
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%22 = call i32 @decryption(i8* %21)
br label %15
23: ; preds = %15
br label %24
24: ; preds = %23
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 113
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %31
30: ; preds = %24
store i32 0, i32* %1
br label %31
31: ; preds = %30, %28
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [99 x i8] c"Enter option 'c' for encryption the text, 'd' for decryption the text or 'q' for exit the program:\00"
@.str.1 = [3 x i8] c"%c\00"
@str = [22 x i8] c"You exit the program.\00"
@str.5 = [31 x i8] c"Input the text for decryption.\00"
@str.6 = [31 x i8] c"Input the text for ecnryption.\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 99
br i1 %7, label %8, label %13
8: ; preds = %0, %8
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.6, i64 0, i64 0))
%10 = call i32 @encryption(i8* %3)
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 99
br i1 %12, label %8, label %13
13: ; preds = %8, %0
%14 = phi i8 [ %6, %0 ], [ %11, %8 ]
br label %15
15: ; preds = %13, %17
%16 = phi i8 [ %20, %17 ], [ %14, %13 ]
switch i8 %16, label %23 [
i8 100, label %17
i8 113, label %21
]
17: ; preds = %15
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.5, i64 0, i64 0))
%19 = call i32 @decryption(i8* %3)
%20 = load i8, i8* %1
br label %15
21: ; preds = %15
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %15, %21
ret i32 0
}