#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(char *);
int /*<<< orphan*/ decode(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char option;
  char text[100];
  while (option != 'q') {
    printf("Please input an option (c - code a text, d - decode a text, q - "
           "quit\n");
    scanf("%c", &option);
    switch (option) {
    case 'c':
      code(text);
      break;
    case 'd':
      decode(text);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
je     11bd <main+0x7d>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x74(%rbp)
sub    $0x63,%eax
je     11a1 <main+0x61>
jmp    1190 <main+0x50>
mov    -0x74(%rbp),%eax
sub    $0x64,%eax
je     11af <main+0x6f>
jmp    11b8 <main+0x78>
lea    -0x70(%rbp),%rdi
call   1060 <code@plt>
jmp    11b8 <main+0x78>
lea    -0x70(%rbp),%rdi
call   1040 <decode@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeb1(%rip),%r14
lea    0xea7(%rip),%r15
lea    0xf(%rsp),%rbx
lea    0x10(%rsp),%r12
jmp    1181 <main+0x41>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
call   1040 <decode@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x71,%al
je     11b0 <main+0x70>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
movsbl %al,%ecx
cmp    $0x64,%ecx
je     1170 <main+0x30>
cmp    $0x63,%ecx
jne    117d <main+0x3d>
mov    %r12,%rdi
call   1060 <code@plt>
jmp    1178 <main+0x38>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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