#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ parse_guests(int, char **);
int /*<<< orphan*/ print_asm();
int /*<<< orphan*/ print_bin();
int /*<<< orphan*/ print_elf();
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i;
  char command;
  if (argc < 3) {
    fprintf(stderr, "Usage %s <command> <guests>\n", argv[0]);
    return 3;
  }
  command = argv[1][0];
  argv += 2;
  argc -= 2;
  parse_guests(argc, argv);
  switch (command) {
  case 'b':
    print_bin();
    break;
  case 'e':
    print_elf();
    break;
  case 'a':
    print_asm();
    break;
  default:
    fprintf(stderr, "Unknown command: %c\n", command);
    return 20;
  }
  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   $0x3,-0x8(%rbp)
jge    119a <main+0x4a>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    1251 <main+0x101>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <parse_guests@plt>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x61,%eax
je     1217 <main+0xc7>
jmp    11dd <main+0x8d>
mov    -0x1c(%rbp),%eax
sub    $0x62,%eax
je     11ff <main+0xaf>
jmp    11ee <main+0x9e>
mov    -0x1c(%rbp),%eax
sub    $0x65,%eax
je     120b <main+0xbb>
jmp    1223 <main+0xd3>
mov    $0x0,%al
call   1050 <print_bin@plt>
jmp    124a <main+0xfa>
mov    $0x0,%al
call   1060 <print_elf@plt>
jmp    124a <main+0xfa>
mov    $0x0,%al
call   1030 <print_asm@plt>
jmp    124a <main+0xfa>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
movsbl -0x15(%rbp),%edx
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x14,-0x4(%rbp)
jmp    1251 <main+0x101>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jg     1177 <main+0x27>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe97(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x3,%ebx
jmp    11d8 <main+0x88>
mov    0x8(%rsi),%rax
movsbl (%rax),%ebx
add    $0x10,%rsi
add    $0xfffffffe,%edi
call   1070 <parse_guests@plt>
cmp    $0x61,%ebx
je     11a4 <main+0x54>
cmp    $0x65,%ebx
je     11af <main+0x5f>
cmp    $0x62,%ebx
jne    11ba <main+0x6a>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <print_bin@plt>
jmp    11d8 <main+0x88>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <print_asm@plt>
jmp    11d8 <main+0x88>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <print_elf@plt>
jmp    11d8 <main+0x88>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x14,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Usage %s <command> <guests>\0A\00"
@.str.1 = [21 x i8] c"Unknown command: %c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 3, i32* %3
br label %43
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
store i8 %21, i8* %7
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
store i8** %23, i8*** %5
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 2
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @parse_guests(i32 %26, i8** %27)
%29 = load i8, i8* %7
%30 = sext i8 %29 to i32
switch i32 %30, label %37 [
i32 98, label %31
i32 101, label %33
i32 97, label %35
]
31: ; preds = %16
%32 = call i32 (...) @print_bin()
br label %42
33: ; preds = %16
%34 = call i32 (...) @print_elf()
br label %42
35: ; preds = %16
%36 = call i32 (...) @print_asm()
br label %42
37: ; preds = %16
%38 = load i32, i32* @stderr
%39 = load i8, i8* %7
%40 = sext i8 %39 to i32
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %40)
store i32 20, i32* %3
br label %43
42: ; preds = %35, %33, %31
store i32 0, i32* %3
br label %43
43: ; preds = %42, %37, %10
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Usage %s <command> <guests>\0A\00"
@.str.1 = [21 x i8] c"Unknown command: %c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %25
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = add nsw i32 %0, -2
%14 = tail call i32 @parse_guests(i32 %13, i8** %12)
%15 = sext i8 %11 to i32
switch i32 %15, label %22 [
i32 98, label %16
i32 101, label %18
i32 97, label %20
]
16: ; preds = %8
%17 = tail call i32 (...) @print_bin()
br label %25
18: ; preds = %8
%19 = tail call i32 (...) @print_elf()
br label %25
20: ; preds = %8
%21 = tail call i32 (...) @print_asm()
br label %25
22: ; preds = %8
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %25
25: ; preds = %16, %18, %20, %22, %4
%26 = phi i32 [ 3, %4 ], [ 20, %22 ], [ 0, %20 ], [ 0, %18 ], [ 0, %16 ]
ret i32 %26
}