#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*/ bernstein(char *);
int /*<<< orphan*/ certify();
int /*<<< orphan*/ decrypt(char *, char *);
int /*<<< orphan*/ encrypt(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ tables();
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("aescoder [cedbt]\n");
    return 0;
  }
  switch (argv[1][0]) {
  case 'c':
    certify();
    break;
  case 'e':
    encrypt(argv[2], argv[3]);
    break;
  case 'd':
    decrypt(argv[2], argv[3]);
    break;
  case 'b':
    bernstein(argv[2]);
    break;
  case 't':
    tables();
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1198 <main+0x38>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1229 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x12,%eax
ja     1222 <main+0xc2>
mov    -0x18(%rbp),%rax
lea    0xe40(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <certify@plt>
jmp    1222 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1050 <encrypt@plt>
jmp    1222 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <decrypt@plt>
jmp    1222 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <bernstein@plt>
jmp    1222 <main+0xc2>
mov    $0x0,%al
call   1060 <tables@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     1176 <main+0x16>
lea    0xedf(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x8(%rsi),%rax
movsbl (%rax),%eax
add    $0xffffff9e,%eax
cmp    $0x12,%eax
ja     1172 <main+0x12>
lea    0xe74(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x10(%rsi),%rdi
call   1080 <bernstein@plt>
jmp    1172 <main+0x12>
xor    %eax,%eax
call   1070 <certify@plt>
jmp    1172 <main+0x12>
mov    0x10(%rsi),%rdi
mov    0x18(%rsi),%rsi
call   1030 <decrypt@plt>
jmp    1172 <main+0x12>
mov    0x10(%rsi),%rdi
mov    0x18(%rsi),%rsi
call   1050 <encrypt@plt>
jmp    1172 <main+0x12>
xor    %eax,%eax
call   1060 <tables@plt>
jmp    1172 <main+0x12>

LLVM IR (-O0):
@.str = [18 x i8] c"aescoder [cedbt]\0A\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 slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %43
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
switch i32 %16, label %42 [
i32 99, label %17
i32 101, label %19
i32 100, label %27
i32 98, label %35
i32 116, label %40
]
17: ; preds = %10
%18 = call i32 (...) @certify()
br label %42
19: ; preds = %10
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @encrypt(i8* %22, i8* %25)
br label %42
27: ; preds = %10
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
%34 = call i32 @decrypt(i8* %30, i8* %33)
br label %42
35: ; preds = %10
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @bernstein(i8* %38)
br label %42
40: ; preds = %10
%41 = call i32 (...) @tables()
br label %42
42: ; preds = %10, %40, %35, %27, %19, %17
store i32 0, i32* %3
br label %43
43: ; preds = %42, %8
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@str = [17 x i8] c"aescoder [cedbt]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %31
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %31 [
i32 99, label %11
i32 101, label %13
i32 100, label %19
i32 98, label %25
i32 116, label %29
]
11: ; preds = %6
%12 = tail call i32 (...) @certify()
br label %31
13: ; preds = %6
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @encrypt(i8* %15, i8* %17)
br label %31
19: ; preds = %6
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = tail call i32 @decrypt(i8* %21, i8* %23)
br label %31
25: ; preds = %6
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32 @bernstein(i8* %27)
br label %31
29: ; preds = %6
%30 = tail call i32 (...) @tables()
br label %31
31: ; preds = %11, %13, %19, %25, %29, %6, %4
ret i32 0
}