#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 atoi(char *);
int /*<<< orphan*/ crypt(int /*<<< orphan*/);
int /*<<< orphan*/ decrypt(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ instruc();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ value();
int main(int argc, char *argv[]) {
  int opt;
  char opti[2];
  system("clear");
  do {
    printf("*** PASS-CRYPT ***\nChoose an option: \n1) Crypt\t2) Decrypt\t3) "
           "Instructions\t4)exit\n");
    fflush(stdin);
    fgets(opti, 2, stdin);
    opt = atoi(opti);
    switch (opt) {
    case 1:
      crypt(value());
      break;
    case 2:
      decrypt(value());
      break;
    case 3:
      instruc();
      break;
    default:
      system("clear");
      if (opt != 4)
        puts("Choose a correct option.");
      break;
    }
  } while (opt != 4);
  printf("\n\nBe Low Key...\n\nBy Krhertz.\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rdi
call   1060 <system@plt>
lea    0xe3d(%rip),%rdi
call   1070 <printf@plt>
mov    0x2e13(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    (%rax),%edi
call   10b0 <fflush@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
lea    -0x16(%rbp),%rdi
mov    %rdi,-0x28(%rbp)
mov    $0x2,%esi
call   1090 <fgets@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     123a <main+0x9a>
jmp    1218 <main+0x78>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     124d <main+0xad>
jmp    1229 <main+0x89>
mov    -0x1c(%rbp),%eax
sub    $0x3,%eax
je     1260 <main+0xc0>
jmp    126c <main+0xcc>
mov    $0x0,%al
call   10a0 <value@plt>
mov    %eax,%edi
call   1050 <crypt@plt>
jmp    1293 <main+0xf3>
mov    $0x0,%al
call   10a0 <value@plt>
mov    %eax,%edi
call   1030 <decrypt@plt>
jmp    1293 <main+0xf3>
mov    $0x0,%al
call   1080 <instruc@plt>
jmp    1293 <main+0xf3>
lea    0xd8d(%rip),%rdi
call   1060 <system@plt>
cmpl   $0x4,-0x14(%rbp)
je     128e <main+0xee>
lea    0xdcf(%rip),%rdi
call   1040 <puts@plt>
jmp    1293 <main+0xf3>
jmp    1298 <main+0xf8>
cmpl   $0x4,-0x14(%rbp)
jne    11c2 <main+0x22>
lea    0xdc8(%rip),%rdi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe5e(%rip),%r14
mov    %r14,%rdi
call   1060 <system@plt>
lea    0xe6e(%rip),%r15
mov    0x2e30(%rip),%r13
lea    0x6(%rsp),%rbx
lea    0xe42(%rip),%r12
jmp    11d7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <instruc@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    0x0(%r13),%edi
call   10a0 <fflush@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1080 <fgets@plt>
mov    %rbx,%rdi
call   10b0 <atoi@plt>
cmp    $0x3,%eax
je     11d0 <main+0x40>
mov    %eax,%ebp
cmp    $0x2,%eax
je     1230 <main+0xa0>
cmp    $0x1,%ebp
jne    1240 <main+0xb0>
xor    %eax,%eax
call   1090 <value@plt>
mov    %eax,%edi
call   1050 <crypt@plt>
jmp    11d7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1090 <value@plt>
mov    %eax,%edi
call   1030 <decrypt@plt>
jmp    11d7 <main+0x47>
mov    %r14,%rdi
call   1060 <system@plt>
cmp    $0x4,%ebp
je     1257 <main+0xc7>
mov    %r12,%rdi
call   1040 <puts@plt>
jmp    11d7 <main+0x47>
lea    0xe12(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [82 x i8] c"*** PASS-CRYPT ***\0AChoose an option: \0A1) Crypt\092) Decrypt\093) Instructions\094)exit\0A\00"
@stdin = global i32 0
@.str.2 = [25 x i8] c"Choose a correct option.\00"
@.str.3 = [31 x i8] c"\0A\0ABe Low Key...\0A\0ABy Krhertz.\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [2 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %35, %2
%10 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fflush(i32 %11)
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 2, i32 %14)
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
switch i32 %18, label %27 [
i32 1, label %19
i32 2, label %22
i32 3, label %25
]
19: ; preds = %9
%20 = call i32 (...) @value()
%21 = call i32 @crypt(i32 %20)
br label %34
22: ; preds = %9
%23 = call i32 (...) @value()
%24 = call i32 @decrypt(i32 %23)
br label %34
25: ; preds = %9
%26 = call i32 (...) @instruc()
br label %34
27: ; preds = %9
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 4
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
br label %34
34: ; preds = %33, %25, %22, %19
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = icmp ne i32 %36, 4
br i1 %37, label %9, label %38
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@stdin = global i32 0
@.str.2 = [25 x i8] c"Choose a correct option.\00"
@str = [81 x i8] c"*** PASS-CRYPT ***\0AChoose an option: \0A1) Crypt\092) Decrypt\093) Instructions\094)exit\00"
@str.4 = [30 x i8] c"\0A\0ABe Low Key...\0A\0ABy Krhertz.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %16, %2
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fflush(i32 %8)
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %4, i32 2, i32 %10)
%12 = call i32 @atoi(i8* %4)
switch i32 %12, label %22 [
i32 1, label %13
i32 2, label %17
i32 3, label %20
]
13: ; preds = %6
%14 = call i32 (...) @value()
%15 = call i32 @crypt(i32 %14)
br label %16
16: ; preds = %13, %17, %20, %25
br label %6
17: ; preds = %6
%18 = call i32 (...) @value()
%19 = call i32 @decrypt(i32 %18)
br label %16
20: ; preds = %6
%21 = call i32 (...) @instruc()
br label %16
22: ; preds = %6
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i32 %12, 4
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %16
27: ; preds = %22
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}