#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*/ encode(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char ch;
  char arr[1000];
  printf("Enter option (now and after the encoded or decoded text is shown): ");
  do {
    scanf("%c", &ch);
    if (ch == 'c' || ch == 'd') {
      scanf("%s", arr);
      encode(arr);
    }
  } while (ch != 'q');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
je     1178 <main+0x48>
movsbl -0x5(%rbp),%eax
cmp    $0x64,%eax
jne    1197 <main+0x67>
lea    -0x3f0(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <encode@plt>
jmp    119c <main+0x6c>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    114e <main+0x1e>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x3f8,%rsp
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    0xef3(%rip),%r14
lea    0xf(%rsp),%r12
lea    0xeea(%rip),%r15
lea    0x10(%rsp),%rbx
jmp    1174 <main+0x44>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x71,%al
je     11a6 <main+0x76>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
lea    -0x63(%rax),%ecx
cmp    $0x1,%cl
ja     1170 <main+0x40>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <encode@plt>
movzbl 0xf(%rsp),%eax
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [68 x i8] c"Enter option (now and after the encoded or decoded text is shown): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"%s\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 ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %20, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 99
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 100
br i1 %13, label %14, label %19
14: ; preds = %10, %5
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%18 = call i32 @encode(i8* %17)
br label %19
19: ; preds = %14, %10
br label %20
20: ; preds = %19
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 113
br i1 %23, label %5, label %24
24: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [68 x i8] c"Enter option (now and after the encoded or decoded text is shown): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"%s\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 ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %14, %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 = add i8 %7, -99
%9 = icmp ult i8 %8, 2
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%12 = call i32 @encode(i8* %3)
%13 = load i8, i8* %1
br label %14
14: ; preds = %10, %5
%15 = phi i8 [ %13, %10 ], [ %7, %5 ]
%16 = icmp eq i8 %15, 113
br i1 %16, label %17, label %5
17: ; preds = %14
ret i32 0
}