#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*/ code();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int counter = 1;
  char opt;
  printf("Insert option: c-code a text, d-decode a text, q-quit ");
  scanf("%c", &opt);
  while (opt != 'q') {
    if (opt == 'c') {
      code();
    }
    if (opt == 'd') {
      code();
    }
    printf("\nInsert option: ");
    scanf("%c", &opt);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x71,%eax
je     11b8 <main+0x88>
movsbl -0x9(%rbp),%eax
cmp    $0x63,%eax
jne    1183 <main+0x53>
mov    $0x0,%al
call   1050 <code@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x64,%eax
jne    1197 <main+0x67>
mov    $0x0,%al
call   1050 <code@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xeeb(%rip),%r14
lea    0xf(%rsp),%r15
lea    0xee2(%rip),%rbx
jmp    1168 <main+0x38>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x63,%al
je     1190 <main+0x60>
cmp    $0x71,%al
je     11a9 <main+0x79>
cmp    $0x64,%al
jne    1160 <main+0x30>
jmp    11a0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <code@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x64,%al
jne    1160 <main+0x30>
xor    %eax,%eax
call   1050 <code@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Insert option: c-code a text, d-decode a text, q-quit \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [17 x i8] c"\0AInsert option: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 1, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 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* %3)
br label %6
6: ; preds = %22, %0
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 113
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 99
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (...) @code()
br label %16
16: ; preds = %14, %10
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 100
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (...) @code()
br label %22
22: ; preds = %20, %16
%23 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %6
25: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [55 x i8] c"Insert option: c-code a text, d-decode a text, q-quit \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [17 x i8] c"\0AInsert option: \00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %14, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
switch i8 %5, label %9 [
i8 113, label %16
i8 99, label %6
]
6: ; preds = %3
%7 = call i32 (...) @code()
%8 = load i8, i8* %1
br label %9
9: ; preds = %3, %6
%10 = phi i8 [ %5, %3 ], [ %8, %6 ]
%11 = icmp eq i8 %10, 100
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @code()
br label %14
14: ; preds = %12, %9
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %3
16: ; preds = %3
ret i32 0
}