#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*/ exit(int);
int /*<<< orphan*/ keynote_keygen(int, char **);
int /*<<< orphan*/ keynote_sign(int, char **);
int /*<<< orphan*/ keynote_sigver(int, char **);
int /*<<< orphan*/ keynote_verify(int, char **);
int /*<<< orphan*/ mainusage();
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    mainusage();
    exit(-1);
  }
  if (!strcmp(argv[1], "sign"))
    keynote_sign(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "verify"))
    keynote_verify(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "sigver"))
    keynote_sigver(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "keygen"))
    keynote_keygen(argc - 1, argv + 1);
  mainusage();
  exit(-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a1 <main+0x31>
mov    $0x0,%al
call   1060 <mainusage@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d6 <main+0x66>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <keynote_sign@plt>
jmp    127f <main+0x10f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe20(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    120b <main+0x9b>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1080 <keynote_verify@plt>
jmp    127a <main+0x10a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1240 <main+0xd0>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1070 <keynote_sigver@plt>
jmp    1275 <main+0x105>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc4(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1270 <main+0x100>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <keynote_keygen@plt>
jmp    1275 <main+0x105>
jmp    127a <main+0x10a>
jmp    127f <main+0x10f>
mov    $0x0,%al
call   1060 <mainusage@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jle    1210 <main+0xa0>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%r14
add    $0x8,%rbx
lea    0xe6f(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    11ac <main+0x3c>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <keynote_sign@plt>
jmp    1210 <main+0xa0>
lea    0xe52(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    11ce <main+0x5e>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <keynote_verify@plt>
jmp    1210 <main+0xa0>
lea    0xe37(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    11f0 <main+0x80>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <keynote_sigver@plt>
jmp    1210 <main+0xa0>
lea    0xe1c(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1210 <main+0xa0>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <keynote_keygen@plt>
xor    %eax,%eax
call   1060 <mainusage@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"sign\00"
@.str.1 = [7 x i8] c"verify\00"
@.str.2 = [7 x i8] c"sigver\00"
@.str.3 = [7 x i8] c"keygen\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 %11
8: ; preds = %2
%9 = call i32 (...) @mainusage()
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %11
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = call i32 @keynote_sign(i32 %19, i8** %21)
br label %62
23: ; preds = %11
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %35, label %29
29: ; preds = %23
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = call i32 @keynote_verify(i32 %31, i8** %33)
br label %61
35: ; preds = %23
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %47, label %41
41: ; preds = %35
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 1
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = call i32 @keynote_sigver(i32 %43, i8** %45)
br label %60
47: ; preds = %35
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 @strcmp(i8* %50, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%52 = icmp ne i32 %51, 0
br i1 %52, label %59, label %53
53: ; preds = %47
%54 = load i32, i32* %4
%55 = sub nsw i32 %54, 1
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = call i32 @keynote_keygen(i32 %55, i8** %57)
br label %59
59: ; preds = %53, %47
br label %60
60: ; preds = %59, %41
br label %61
61: ; preds = %60, %29
br label %62
62: ; preds = %61, %17
%63 = call i32 (...) @mainusage()
%64 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"sign\00"
@.str.1 = [7 x i8] c"verify\00"
@.str.2 = [7 x i8] c"sigver\00"
@.str.3 = [7 x i8] c"keygen\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 (...) @mainusage()
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = add nsw i32 %0, -1
%14 = tail call i32 @keynote_sign(i32 %13, i8** %8)
br label %33
15: ; preds = %7
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = add nsw i32 %0, -1
%20 = tail call i32 @keynote_verify(i32 %19, i8** %8)
br label %33
21: ; preds = %15
%22 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = add nsw i32 %0, -1
%26 = tail call i32 @keynote_sigver(i32 %25, i8** %8)
br label %33
27: ; preds = %21
%28 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = add nsw i32 %0, -1
%32 = tail call i32 @keynote_keygen(i32 %31, i8** %8)
br label %33
33: ; preds = %18, %27, %30, %24, %12
%34 = tail call i32 (...) @mainusage()
%35 = tail call i32 @exit(i32 -1)
unreachable
}