#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 atoi(char *);
int /*<<< orphan*/ printStats(int, int, char *);
int /*<<< orphan*/ printUsage();
int simulateAndStats(int, char *);
int /*<<< orphan*/ simulateAndStatsWithProcesses(int, int);
int main(int argc, char *argv[]) {
  if (argc == 3) {
    int inputNumSimulations = atoi(argv[1]);
    if (*argv[2] == 's') {
      int sum = simulateAndStats(inputNumSimulations,
                                 "Sequence (Single Thread / Process)");
      printStats(sum, inputNumSimulations,
                 "Sequence (Single Thread / Process)");
    } else {
      printUsage();
    }
  } else if (argc == 4) {
    int inputNumSimulations = atoi(argv[1]);
    if (*argv[2] == 'p') {
      int numProcesses = atoi(argv[3]);
      simulateAndStatsWithProcesses(inputNumSimulations, numProcesses);
    } else {
      printUsage();
    }
  } else {
    printUsage();
  }
  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)
cmpl   $0x3,-0x8(%rbp)
jne    11c9 <main+0x79>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    11bd <main+0x6d>
mov    -0x14(%rbp),%edi
lea    0xe62(%rip),%rsi
call   1040 <simulateAndStats@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    0xe4d(%rip),%rdx
call   1030 <printStats@plt>
jmp    11c4 <main+0x74>
mov    $0x0,%al
call   1060 <printUsage@plt>
jmp    122f <main+0xdf>
cmpl   $0x4,-0x8(%rbp)
jne    1223 <main+0xd3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x70,%eax
jne    1217 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <simulateAndStatsWithProcesses@plt>
jmp    121e <main+0xce>
mov    $0x0,%al
call   1060 <printUsage@plt>
jmp    122a <main+0xda>
mov    $0x0,%al
call   1060 <printUsage@plt>
jmp    122f <main+0xdf>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
je     1193 <main+0x43>
cmp    $0x3,%edi
jne    11bb <main+0x6b>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
cmpb   $0x73,(%rax)
jne    11bb <main+0x6b>
lea    0xe85(%rip),%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <simulateAndStats@plt>
mov    %eax,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printStats@plt>
jmp    11c2 <main+0x72>
mov    0x10(%rbx),%rax
cmpb   $0x70,(%rax)
jne    11bb <main+0x6b>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1070 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <simulateAndStatsWithProcesses@plt>
jmp    11c2 <main+0x72>
xor    %eax,%eax
call   1060 <printUsage@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Sequence (Single Thread / Process)\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %32
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 115
br i1 %22, label %23, label %29
23: ; preds = %12
%24 = load i32, i32* %6
%25 = call i32 @simulateAndStats(i32 %24, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = load i32, i32* %6
%28 = call i32 @printStats(i32 %26, i32 %27, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %31
29: ; preds = %12
%30 = call i32 (...) @printUsage()
br label %31
31: ; preds = %29, %23
br label %60
32: ; preds = %2
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 4
br i1 %34, label %35, label %57
35: ; preds = %32
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %8
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 112
br i1 %45, label %46, label %54
46: ; preds = %35
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 3
%49 = load i8*, i8** %48
%50 = call i32 @atoi(i8* %49)
store i32 %50, i32* %9
%51 = load i32, i32* %8
%52 = load i32, i32* %9
%53 = call i32 @simulateAndStatsWithProcesses(i32 %51, i32 %52)
br label %56
54: ; preds = %35
%55 = call i32 (...) @printUsage()
br label %56
56: ; preds = %54, %46
br label %59
57: ; preds = %32
%58 = call i32 (...) @printUsage()
br label %59
59: ; preds = %57, %56
br label %60
60: ; preds = %59, %31
%61 = load i32, i32* @EXIT_SUCCESS
ret i32 %61
}

LLVM IR (-O2):
@.str = [35 x i8] c"Sequence (Single Thread / Process)\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %31 [
i32 3, label %3
i32 4, label %16
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 115
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = tail call i32 @simulateAndStats(i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @printStats(i32 %12, i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %33
14: ; preds = %3
%15 = tail call i32 (...) @printUsage()
br label %33
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 112
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = getelementptr inbounds i8*, i8** %1, i64 3
%26 = load i8*, i8** %25
%27 = tail call i32 @atoi(i8* %26)
%28 = tail call i32 @simulateAndStatsWithProcesses(i32 %24, i32 %27)
br label %33
29: ; preds = %16
%30 = tail call i32 (...) @printUsage()
br label %33
31: ; preds = %2
%32 = tail call i32 (...) @printUsage()
br label %33
33: ; preds = %21, %29, %11, %14, %31
%34 = load i32, i32* @EXIT_SUCCESS
ret i32 %34
}