#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 EXIT_SUCCESS;
int /*<<< orphan*/ printUsage(char *);
int /*<<< orphan*/ runProgram(char *, char *);
int main(int argc, char *argv[]) {
  switch (argc) {
  case 3:
    runProgram(argv[1], argv[2]);
    break;
  case 2:
    runProgram(argv[1], "out.bin");
    break;
  case 1:
  default:
    printUsage(argv[0]);
    break;
  }
  return EXIT_SUCCESS;
}


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)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     119f <main+0x7f>
jmp    114a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1186 <main+0x66>
jmp    115b <main+0x3b>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
jne    11a4 <main+0x84>
jmp    116c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <runProgram@plt>
jmp    11b0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <runProgram@plt>
jmp    11b0 <main+0x90>
jmp    11a4 <main+0x84>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <printUsage@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
je     113a <main+0x1a>
cmp    $0x3,%edi
jne    114c <main+0x2c>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <runProgram@plt>
jmp    1154 <main+0x34>
mov    0x8(%rsi),%rdi
lea    0xebb(%rip),%rsi
call   1030 <runProgram@plt>
jmp    1154 <main+0x34>
mov    (%rsi),%rdi
call   1040 <printUsage@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"out.bin\00"
@EXIT_SUCCESS = global i32 0
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
switch i32 %6, label %21 [
i32 3, label %7
i32 2, label %15
i32 1, label %20
]
7: ; preds = %2
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @runProgram(i8* %10, i8* %13)
br label %26
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @runProgram(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %26
20: ; preds = %2
br label %21
21: ; preds = %2, %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @printUsage(i8* %24)
br label %26
26: ; preds = %21, %15, %7
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}

LLVM IR (-O2):
@.str = [8 x i8] c"out.bin\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %13 [
i32 3, label %3
i32 2, label %9
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @runProgram(i8* %5, i8* %7)
br label %16
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @runProgram(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %16
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = tail call i32 @printUsage(i8* %14)
br label %16
16: ; preds = %13, %9, %3
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}