#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*/ atoi(char *);
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fdecrypt(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fencrypt(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char toupper(char);
int main(int argc, char *argv[]) {
  if (argc != 5) {
    fprintf(stderr, "Usage: %s <e/d> <input-file> <output-file> <beta>\n",
            argv[0]);
    exit(1);
  }
  if (toupper(*argv[1]) == 'E')
    fencrypt(argv[2], argv[3], atoi(argv[4]));
  else if (toupper(*argv[1]) == 'D')
    fdecrypt(argv[2], argv[3], atoi(argv[4]));
  else
    die("Invlaid Option");
  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)
cmpl   $0x5,-0x8(%rbp)
je     11b6 <main+0x46>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe59(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x45,%eax
jne    120b <main+0x9b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <atoi@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1070 <fencrypt@plt>
jmp    1271 <main+0x101>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
cmp    $0x44,%eax
jne    1260 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <atoi@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1030 <fdecrypt@plt>
jmp    126c <main+0xfc>
lea    0xdcc(%rip),%rdi
call   1060 <die@plt>
jmp    1271 <main+0x101>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x5,%edi
jne    11f1 <main+0x81>
mov    0x8(%rbx),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
cmp    $0x45,%al
jne    11ad <main+0x3d>
mov    0x10(%rbx),%r14
mov    0x18(%rbx),%r15
mov    0x20(%rbx),%rdi
call   1080 <atoi@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1070 <fencrypt@plt>
jmp    11e9 <main+0x79>
mov    0x8(%rbx),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
cmp    $0x44,%al
jne    11dd <main+0x6d>
mov    0x10(%rbx),%r14
mov    0x18(%rbx),%r15
mov    0x20(%rbx),%rdi
call   1080 <atoi@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <fdecrypt@plt>
jmp    11e9 <main+0x79>
lea    0xe4f(%rip),%rdi
call   1060 <die@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdfc(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"Usage: %s <e/d> <input-file> <output-file> <beta>\0A\00"
@.str.1 = [15 x i8] c"Invlaid Option\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 5
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = call signext i8 @toupper(i8 signext %19)
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 69
br i1 %22, label %23, label %35
23: ; preds = %15
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 4
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = call i32 @fencrypt(i8* %26, i8* %29, i32 %33)
br label %58
35: ; preds = %15
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = load i8, i8* %38
%40 = call signext i8 @toupper(i8 signext %39)
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 68
br i1 %42, label %43, label %55
43: ; preds = %35
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 3
%49 = load i8*, i8** %48
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 4
%52 = load i8*, i8** %51
%53 = call i32 @atoi(i8* %52)
%54 = call i32 @fdecrypt(i8* %46, i8* %49, i32 %53)
br label %57
55: ; preds = %35
%56 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %57
57: ; preds = %55, %43
br label %58
58: ; preds = %57, %23
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"Usage: %s <e/d> <input-file> <output-file> <beta>\0A\00"
@.str.1 = [15 x i8] c"Invlaid Option\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 5
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = tail call signext i8 @toupper(i8 signext %12)
%14 = icmp eq i8 %13, 69
br i1 %14, label %15, label %24
15: ; preds = %9
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = tail call i32 @fencrypt(i8* %17, i8* %19, i32 %22)
br label %40
24: ; preds = %9
%25 = load i8*, i8** %10
%26 = load i8, i8* %25
%27 = tail call signext i8 @toupper(i8 signext %26)
%28 = icmp eq i8 %27, 68
br i1 %28, label %29, label %38
29: ; preds = %24
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8*, i8** %1, i64 3
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8*, i8** %1, i64 4
%35 = load i8*, i8** %34
%36 = tail call i32 @atoi(i8* %35)
%37 = tail call i32 @fdecrypt(i8* %31, i8* %33, i32 %36)
br label %40
38: ; preds = %24
%39 = tail call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %29, %38, %15
ret i32 0
}