#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 generateController();
int generateFramework();
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    printf("No arguments given\n");
    return 0;
  }
  if (strcmp(argv[1], "--version") == 0) {
    printf("Version 0.1\nGNU GPL\nNo Warranty\n");
    return 0;
  }
  if (strcmp(argv[1], "HAS") != 0) {
    printf("Invalid arguments\n");
    return 0;
  }
  if (argc > 2) {
    if (strcmp(argv[2], "FRAMEWORK") == 0) {
      return generateFramework();
    }
    if (strcmp(argv[2], "CONTROLLR") == 0) {
      return generateController();
    }
  }
  printf("Invalid arguments\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1259 <main+0x119>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ae <main+0x6e>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1259 <main+0x119>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11e4 <main+0xa4>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1259 <main+0x119>
cmpl   $0x2,-0x8(%rbp)
jle    124d <main+0x10d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    121b <main+0xdb>
mov    $0x0,%al
call   1060 <generateFramework@plt>
mov    %eax,-0x4(%rbp)
jmp    1259 <main+0x119>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe36(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1248 <main+0x108>
mov    $0x0,%al
call   1050 <generateController@plt>
mov    %eax,-0x4(%rbp)
jmp    1259 <main+0x119>
jmp    124d <main+0x10d>
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1151 <main+0x11>
lea    0xf05(%rip),%rdi
jmp    11bf <main+0x7f>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b8 <main+0x78>
mov    0x8(%rbx),%rdi
lea    0xe94(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11af <main+0x6f>
cmp    $0x3,%ebp
jl     11af <main+0x6f>
mov    0x10(%rbx),%rdi
lea    0xe7e(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11cd <main+0x8d>
mov    0x10(%rbx),%rdi
lea    0xe73(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11da <main+0x9a>
lea    0xe6c(%rip),%rdi
jmp    11bf <main+0x7f>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <generateFramework@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <generateController@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"No arguments given\0A\00"
@.str.1 = [10 x i8] c"--version\00"
@.str.2 = [33 x i8] c"Version 0.1\0AGNU GPL\0ANo Warranty\0A\00"
@.str.3 = [4 x i8] c"HAS\00"
@.str.4 = [19 x i8] c"Invalid arguments\0A\00"
@.str.5 = [10 x i8] c"FRAMEWORK\00"
@.str.6 = [10 x i8] c"CONTROLLR\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 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %48
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %48
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %48
26: ; preds = %18
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 2
br i1 %28, label %29, label %46
29: ; preds = %26
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = call i32 (...) @generateFramework()
store i32 %36, i32* %3
br label %48
37: ; preds = %29
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %37
%44 = call i32 (...) @generateController()
store i32 %44, i32* %3
br label %48
45: ; preds = %37
br label %46
46: ; preds = %45, %26
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %46, %43, %35, %24, %16, %8
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"--version\00"
@.str.3 = [4 x i8] c"HAS\00"
@.str.5 = [10 x i8] c"FRAMEWORK\00"
@.str.6 = [10 x i8] c"CONTROLLR\00"
@str.7 = [18 x i8] c"Invalid arguments\00"
@str.8 = [32 x i8] c"Version 0.1\0AGNU GPL\0ANo Warranty\00"
@str.9 = [19 x i8] c"No arguments given\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
br label %36
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
br label %36
13: ; preds = %6
%14 = load i8*, i8** %7
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0))
br label %36
19: ; preds = %13
%20 = icmp sgt i32 %0, 2
br i1 %20, label %21, label %34
21: ; preds = %19
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = tail call i32 (...) @generateFramework()
br label %36
28: ; preds = %21
%29 = load i8*, i8** %22
%30 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = tail call i32 (...) @generateController()
br label %36
34: ; preds = %28, %19
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0))
br label %36
36: ; preds = %34, %32, %26, %17, %11, %4
%37 = phi i32 [ 0, %4 ], [ 0, %11 ], [ 0, %17 ], [ %27, %26 ], [ %33, %32 ], [ 0, %34 ]
ret i32 %37
}