#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 *, char *);
int /*<<< orphan*/ parse_command_line(int, char **, char **, char **, char **,
                                      char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ run_mandelbrot(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ run_msort(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char mode_select = NULL;
  char *mandel_params = NULL;
  char *sort_params = NULL;
  char *query_params = NULL;
  parse_command_line(argc, argv, &mandel_params, &sort_params, &query_params,
                     &mode_select);
  switch (mode_select) {
  case 'm':
    if (mandel_params != NULL) {
      run_mandelbrot(mandel_params, NULL);
    } else {
      fprintf(stderr, "invalid set passed!%s\n", mandel_params);
    }
    break;
  case 's':
    if (sort_params != NULL) {
      run_msort(sort_params, NULL);
      ;
    } else {
      fprintf(stderr, "invalid set passed!%s", mandel_params);
    }
    break;
  case 'q':
    if (query_params != NULL) {
      printf("insert query implementation here\n");
    } else {
      fprintf(stderr, "invalid set passed!%s", mandel_params);
    }
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x11(%rbp),%r9
call   1070 <parse_command_line@plt>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x6d,%eax
je     11d5 <main+0x85>
jmp    11b3 <main+0x63>
mov    -0x34(%rbp),%eax
sub    $0x71,%eax
je     124b <main+0xfb>
jmp    11c4 <main+0x74>
mov    -0x34(%rbp),%eax
sub    $0x73,%eax
je     1210 <main+0xc0>
jmp    1285 <main+0x135>
cmpq   $0x0,-0x20(%rbp)
je     11f2 <main+0xa2>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <run_mandelbrot@plt>
jmp    120b <main+0xbb>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdfa(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1285 <main+0x135>
cmpq   $0x0,-0x28(%rbp)
je     122d <main+0xdd>
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <run_msort@plt>
jmp    1246 <main+0xf6>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdd6(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1285 <main+0x135>
cmpq   $0x0,-0x30(%rbp)
je     1267 <main+0x117>
lea    0xdd0(%rip),%rdi
call   1030 <printf@plt>
jmp    1280 <main+0x130>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd9c(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1285 <main+0x135>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movb   $0x0,0xf(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x10(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0xf(%rsp),%r9
call   1070 <parse_command_line@plt>
movsbl 0xf(%rsp),%eax
cmp    $0x73,%eax
je     11b4 <main+0x64>
cmp    $0x71,%eax
je     11c7 <main+0x77>
cmp    $0x6d,%eax
jne    120b <main+0xbb>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     11f4 <main+0xa4>
xor    %esi,%esi
call   1040 <run_mandelbrot@plt>
jmp    120b <main+0xbb>
mov    0x20(%rsp),%rdi
test   %rdi,%rdi
je     11dd <main+0x8d>
xor    %esi,%esi
call   1050 <run_msort@plt>
jmp    120b <main+0xbb>
cmpq   $0x0,0x18(%rsp)
je     11dd <main+0x8d>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
jmp    120b <main+0xbb>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rdx
lea    0xe25(%rip),%rsi
jmp    1206 <main+0xb6>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xdfc(%rip),%rsi
xor    %edx,%edx
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"invalid set passed!%s\0A\00"
@.str.1 = [22 x i8] c"invalid set passed!%s\00"
@.str.2 = [34 x i8] c"insert query implementation here\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @parse_command_line(i32 %10, i8** %11, i8** %7, i8** %8, i8** %9, i8* %6)
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
switch i32 %14, label %47 [
i32 109, label %15
i32 115, label %26
i32 113, label %37
]
15: ; preds = %2
%16 = load i8*, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i8*, i8** %7
%20 = call i32 @run_mandelbrot(i8* %19, i32* null)
br label %25
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %7
%24 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %21, %18
br label %47
26: ; preds = %2
%27 = load i8*, i8** %8
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i8*, i8** %8
%31 = call i32 @run_msort(i8* %30, i32* null)
br label %36
32: ; preds = %26
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %7
%35 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %32, %29
br label %47
37: ; preds = %2
%38 = load i8*, i8** %9
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %46
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %7
%45 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %42, %40
br label %47
47: ; preds = %2, %46, %36, %25
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"invalid set passed!%s\0A\00"
@.str.1 = [22 x i8] c"invalid set passed!%s\00"
@str = [33 x i8] c"insert query implementation here\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8 0, i8* %3
%7 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%8 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%9 = bitcast i8** %6 to i8*
store i8* null, i8** %6
%10 = call i32 @parse_command_line(i32 %0, i8** %1, i8** %4, i8** %5, i8** %6, i8* %3)
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
switch i32 %12, label %39 [
i32 109, label %13
i32 115, label %21
i32 113, label %30
]
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i32 @run_mandelbrot(i8* %14, i32* null)
br label %39
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* null)
br label %39
21: ; preds = %2
%22 = load i8*, i8** %5
%23 = icmp eq i8* %22, null
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = call i32 @run_msort(i8* %22, i32* null)
br label %39
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %4
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %39
30: ; preds = %2
%31 = load i8*, i8** %6
%32 = icmp eq i8* %31, null
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %39
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %4
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %33, %35, %24, %26, %16, %18, %2
ret i32 0
}