#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*/ atoi(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ run(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ run_with_mapping(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  srand(time(NULL));
  if (argc != 3)
    printf("jdv: invalid arguments: must take 2 arguments which represents "
           "width and height or --map/-m then the mapping file\n");
  else if (!strcmp(argv[1], "-m") || !strcmp(argv[1], "--map"))
    run_with_mapping(argv[2]);
  else
    run(atoi(argv[1]), atoi(argv[2]));
  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)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmpl   $0x3,-0x8(%rbp)
je     11b1 <main+0x41>
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
jmp    1229 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     11eb <main+0x7b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe99(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11fd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <run_with_mapping@plt>
jmp    1224 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1030 <run@plt>
jmp    1229 <main+0xb9>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmp    $0x3,%ebx
jne    11d4 <main+0x64>
mov    0x8(%r14),%rbx
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     11e2 <main+0x72>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     11e2 <main+0x72>
mov    %rbx,%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r14),%rdi
call   1090 <atoi@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <run@plt>
jmp    11eb <main+0x7b>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
jmp    11eb <main+0x7b>
mov    0x10(%r14),%rdi
call   1080 <run_with_mapping@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [115 x i8] c"jdv: invalid arguments: must take 2 arguments which represents width and height or --map/-m then the mapping file\0A\00"
@.str.1 = [3 x i8] c"-m\00"
@.str.2 = [6 x i8] c"--map\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 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0))
br label %40
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %18, %12
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @run_with_mapping(i8* %27)
br label %39
29: ; preds = %18
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = call i32 @run(i32 %33, i32 %37)
br label %39
39: ; preds = %29, %24
br label %40
40: ; preds = %39, %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-m\00"
@.str.2 = [6 x i8] c"--map\00"
@str = [114 x i8] c"jdv: invalid arguments: must take 2 arguments which represents width and height or --map/-m then the mapping file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp eq i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @str, i64 0, i64 0))
br label %26
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13, %8
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @run_with_mapping(i8* %18)
br label %26
20: ; preds = %13
%21 = tail call i32 @atoi(i8* %10)
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = tail call i32 @run(i32 %21, i32 %24)
br label %26
26: ; preds = %16, %20, %6
ret i32 0
}