#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run_simulation(char *, int);
int /*<<< orphan*/ run_tests();
int /*<<< orphan*/ show_help();
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int i;
  if (argc <= 1) {
    show_help();
    return 0;
  }
  for (i = 1; i < argc; i++) {
    if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
      show_help();
      return 0;
    }
    if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "--tests") == 0)) {
      run_tests();
      return 0;
    }
    if (((strcmp(argv[i], "-r") == 0) || (strcmp(argv[i], "--run") == 0)) &&
        argc == 4) {
      char *repos_dir;
      int generation_max;
      repos_dir = argv[i + 1];
      generation_max = atoi(argv[i + 2]);
      run_simulation(repos_dir, generation_max);
      return 0;
    }
  }
  printf("Error: Unexpected arguments\n\n");
  printf("%d passed\n", argc);
  show_help();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1193 <main+0x33>
mov    $0x0,%al
call   1050 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1328 <main+0x1c8>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12fb <main+0x19b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe47(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11ea <main+0x8a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe28(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11fd <main+0x9d>
mov    $0x0,%al
call   1050 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1328 <main+0x1c8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdfa(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1241 <main+0xe1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xddb(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1254 <main+0xf4>
mov    $0x0,%al
call   1080 <run_tests@plt>
movl   $0x0,-0x4(%rbp)
jmp    1328 <main+0x1c8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdae(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1298 <main+0x138>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd8f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12e8 <main+0x188>
cmpl   $0x4,-0x8(%rbp)
jne    12e8 <main+0x188>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1060 <run_simulation@plt>
movl   $0x0,-0x4(%rbp)
jmp    1328 <main+0x1c8>
jmp    12ed <main+0x18d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119a <main+0x3a>
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <show_help@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    1198 <main+0x28>
xor    %eax,%eax
call   1060 <show_help@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %edi,%r12d
mov    $0x1,%r13d
lea    0xe53(%rip),%r14
lea    0xe4f(%rip),%r15
jmp    11d6 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x4,%ebp
je     1259 <main+0xe9>
add    $0x1,%r13
cmp    %r13,%r12
je     1283 <main+0x113>
mov    (%rbx,%r13,8),%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1180 <main+0x10>
mov    (%rbx,%r13,8),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1180 <main+0x10>
mov    (%rbx,%r13,8),%rdi
lea    0xe07(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1277 <main+0x107>
mov    (%rbx,%r13,8),%rdi
lea    0xdf5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1277 <main+0x107>
mov    (%rbx,%r13,8),%rdi
lea    0xde8(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c0 <main+0x50>
mov    (%rbx,%r13,8),%rdi
lea    0xdd6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x4,%ebp
jne    11c9 <main+0x59>
test   %rax,%rax
jne    11c9 <main+0x59>
mov    0x8(%rbx,%r13,8),%rbp
mov    0x10(%rbx,%r13,8),%rdi
call   1080 <atoi@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1070 <run_simulation@plt>
jmp    1187 <main+0x17>
xor    %eax,%eax
call   1090 <run_tests@plt>
jmp    1187 <main+0x17>
lea    0xd9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xd88(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <main+0x10>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-t\00"
@.str.3 = [8 x i8] c"--tests\00"
@.str.4 = [3 x i8] c"-r\00"
@.str.5 = [6 x i8] c"--run\00"
@.str.6 = [30 x i8] c"Error: Unexpected arguments\0A\0A\00"
@.str.7 = [11 x i8] c"%d passed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @show_help()
store i32 0, i32* %3
br label %99
13: ; preds = %2
store i32 1, i32* %6
br label %14
14: ; preds = %91, %13
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %94
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %34, label %26
26: ; preds = %18
%27 = load i8**, i8*** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %26, %18
%35 = call i32 (...) @show_help()
store i32 0, i32* %3
br label %99
36: ; preds = %26
%37 = load i8**, i8*** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %52, label %44
44: ; preds = %36
%45 = load i8**, i8*** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %44, %36
%53 = call i32 (...) @run_tests()
store i32 0, i32* %3
br label %99
54: ; preds = %44
%55 = load i8**, i8*** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %70, label %62
62: ; preds = %54
%63 = load i8**, i8*** %5
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %63, i64 %65
%67 = load i8*, i8** %66
%68 = call i64 @strcmp(i8* %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %90
70: ; preds = %62, %54
%71 = load i32, i32* %4
%72 = icmp eq i32 %71, 4
br i1 %72, label %73, label %90
73: ; preds = %70
%74 = load i8**, i8*** %5
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %74, i64 %77
%79 = load i8*, i8** %78
store i8* %79, i8** %7
%80 = load i8**, i8*** %5
%81 = load i32, i32* %6
%82 = add nsw i32 %81, 2
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8*, i8** %80, i64 %83
%85 = load i8*, i8** %84
%86 = call i32 @atoi(i8* %85)
store i32 %86, i32* %8
%87 = load i8*, i8** %7
%88 = load i32, i32* %8
%89 = call i32 @run_simulation(i8* %87, i32 %88)
store i32 0, i32* %3
br label %99
90: ; preds = %70, %62
br label %91
91: ; preds = %90
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
store i32 %93, i32* %6
br label %14
94: ; preds = %14
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%96 = load i32, i32* %4
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %96)
%98 = call i32 (...) @show_help()
store i32 0, i32* %3
br label %99
99: ; preds = %94, %73, %52, %34, %11
%100 = load i32, i32* %3
ret i32 %100
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-t\00"
@.str.3 = [8 x i8] c"--tests\00"
@.str.4 = [3 x i8] c"-r\00"
@.str.5 = [6 x i8] c"--run\00"
@.str.7 = [11 x i8] c"%d passed\0A\00"
@str = [29 x i8] c"Error: Unexpected arguments\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = icmp eq i32 %0, 4
%6 = zext i32 %0 to i64
br label %9
7: ; preds = %2
%8 = tail call i32 (...) @show_help()
br label %59
9: ; preds = %4, %52
%10 = phi i64 [ 1, %4 ], [ %53, %52 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %9
%16 = load i8*, i8** %11
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15, %9
%20 = tail call i32 (...) @show_help()
br label %59
21: ; preds = %15
%22 = load i8*, i8** %11
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %11
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25, %21
%30 = tail call i32 (...) @run_tests()
br label %59
31: ; preds = %25
%32 = load i8*, i8** %11
%33 = tail call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %31
%36 = load i8*, i8** %11
%37 = tail call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
%39 = and i1 %5, %38
br i1 %39, label %41, label %52
40: ; preds = %31
br i1 %5, label %41, label %52
41: ; preds = %35, %40
%42 = add nuw i64 %10, 1
%43 = and i64 %42, 4294967295
%44 = getelementptr inbounds i8*, i8** %1, i64 %43
%45 = load i8*, i8** %44
%46 = add nuw i64 %10, 2
%47 = and i64 %46, 4294967295
%48 = getelementptr inbounds i8*, i8** %1, i64 %47
%49 = load i8*, i8** %48
%50 = tail call i32 @atoi(i8* %49)
%51 = tail call i32 @run_simulation(i8* %45, i32 %50)
br label %59
52: ; preds = %35, %40
%53 = add nuw nsw i64 %10, 1
%54 = icmp eq i64 %53, %6
br i1 %54, label %55, label %9
55: ; preds = %52
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %0)
%58 = tail call i32 (...) @show_help()
br label %59
59: ; preds = %55, %41, %29, %19, %7
ret i32 0
}