#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*/ cmd_build(int, char **);
int /*<<< orphan*/ cmd_init(int, char **);
int /*<<< orphan*/ cmd_new(int, char **);
int /*<<< orphan*/ cmd_serve(int, char **);
char *getenv(char *);
int getopt(int, char **, char *);
size_t optind;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ runscript(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  if (argc == 1) {
    usage();
    return 1;
  }
  int c = getopt(argc, argv, "asdf");
  while (1) {
    if (c == -1)
      break;
    switch (c) {
    case 'h':
      printf("halp\n");
      break;
    case '?':
      printf("dafuq?\n");
      break;
    }
  }
  if (!strcmp(argv[optind], "serve")) {
    cmd_serve(argc, argv);
  } else if (!strcmp(argv[optind], "test")) {
    runscript(argv[optind + 1]);
  } else if (!strcmp(argv[optind], "build")) {
    cmd_build(argc, argv);
  } else if (!strcmp(argv[optind], "new")) {
    cmd_new(argc, argv);
  } else if (!strcmp(argv[optind], "init")) {
    cmd_init(argc, argv);
  } else if (!strcmp(argv[optind], "editor")) {
    char *editor;
    editor = getenv("EDITOR");
    printf("Your default editor is: '%s'\n", editor);
  } else {
    printf("Invalid operand\n");
    usage();
  }
}


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)
jne    11d3 <main+0x33>
mov    $0x0,%al
call   10a0 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    13e3 <main+0x243>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe1f(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11f8 <main+0x58>
jmp    1243 <main+0xa3>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3f,%eax
je     1230 <main+0x90>
jmp    120c <main+0x6c>
mov    -0x24(%rbp),%eax
sub    $0x68,%eax
jne    123e <main+0x9e>
jmp    121d <main+0x7d>
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    123e <main+0x9e>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    11e9 <main+0x49>
mov    -0x10(%rbp),%rax
mov    0x2d9a(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdb7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    127b <main+0xdb>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <cmd_serve@plt>
jmp    13e3 <main+0x243>
mov    -0x10(%rbp),%rax
mov    0x2d62(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd85(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12bf <main+0x11f>
mov    -0x10(%rbp),%rax
mov    0x2d3b(%rip),%rcx
mov    (%rcx),%rcx
mov    0x8(%rax,%rcx,8),%rdi
call   10b0 <runscript@plt>
jmp    13de <main+0x23e>
mov    -0x10(%rbp),%rax
mov    0x2d1e(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd46(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12f7 <main+0x157>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <cmd_build@plt>
jmp    13d9 <main+0x239>
mov    -0x10(%rbp),%rax
mov    0x2ce6(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd14(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    132f <main+0x18f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <cmd_new@plt>
jmp    13d4 <main+0x234>
mov    -0x10(%rbp),%rax
mov    0x2cae(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xce0(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1367 <main+0x1c7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <cmd_init@plt>
jmp    13cf <main+0x22f>
mov    -0x10(%rbp),%rax
mov    0x2c76(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcad(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13b5 <main+0x215>
lea    0xc9f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xc92(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13ca <main+0x22a>
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    13cf <main+0x22f>
jmp    13d4 <main+0x234>
jmp    13d9 <main+0x239>
jmp    13de <main+0x23e>
jmp    13e3 <main+0x243>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x1,%edi
jne    11d4 <main+0x24>
xor    %eax,%eax
call   10b0 <usage@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xe1f(%rip),%rdx
call   10d0 <getopt@plt>
lea    0xe65(%rip),%rbp
cmp    $0xffffffff,%eax
je     1212 <main+0x62>
mov    %eax,%ebx
cmp    $0x3f,%eax
je     1329 <main+0x179>
mov    %rbp,%rdi
cmp    $0x68,%ebx
je     1330 <main+0x180>
nopl   0x0(%rax)
jmp    1210 <main+0x60>
mov    0x2dcf(%rip),%rax
mov    (%rax),%rbx
mov    (%r15,%rbx,8),%r14
lea    0xdde(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12ac <main+0xfc>
lea    0xdd1(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12be <main+0x10e>
lea    0xdc3(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12cf <main+0x11f>
lea    0xdb6(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12e1 <main+0x131>
lea    0xda7(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12f3 <main+0x143>
lea    0xd99(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1305 <main+0x155>
lea    0xdbe(%rip),%rdi
call   1050 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   10b0 <usage@plt>
jmp    11c9 <main+0x19>
mov    %r12d,%edi
mov    %r15,%rsi
call   1040 <cmd_serve@plt>
xor    %ebx,%ebx
jmp    11c9 <main+0x19>
mov    0x8(%r15,%rbx,8),%rdi
call   10c0 <runscript@plt>
xor    %ebx,%ebx
jmp    11c9 <main+0x19>
mov    %r12d,%edi
mov    %r15,%rsi
call   1090 <cmd_build@plt>
xor    %ebx,%ebx
jmp    11c9 <main+0x19>
mov    %r12d,%edi
mov    %r15,%rsi
call   1060 <cmd_new@plt>
xor    %ebx,%ebx
jmp    11c9 <main+0x19>
mov    %r12d,%edi
mov    %r15,%rsi
call   10a0 <cmd_init@plt>
xor    %ebx,%ebx
jmp    11c9 <main+0x19>
lea    0xd1a(%rip),%rdi
call   1030 <getenv@plt>
lea    0xd15(%rip),%rdi
xor    %ebx,%ebx
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    11c9 <main+0x19>
lea    0xd1b(%rip),%rdi
call   1050 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x3f,%ebx
je     1329 <main+0x179>
cmp    $0x68,%ebx
jne    1340 <main+0x190>
mov    %rbp,%rdi
jmp    1330 <main+0x180>

LLVM IR (-O0):
@.str = [5 x i8] c"asdf\00"
@.str.1 = [6 x i8] c"halp\0A\00"
@.str.2 = [8 x i8] c"dafuq?\0A\00"
@optind = global i64 0
@.str.3 = [6 x i8] c"serve\00"
@.str.4 = [5 x i8] c"test\00"
@.str.5 = [6 x i8] c"build\00"
@.str.6 = [4 x i8] c"new\00"
@.str.7 = [5 x i8] c"init\00"
@.str.8 = [7 x i8] c"editor\00"
@.str.9 = [7 x i8] c"EDITOR\00"
@.str.10 = [30 x i8] c"Your default editor is: '%s'\0A\00"
@.str.11 = [17 x i8] c"Invalid operand\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @usage()
store i32 1, i32* %3
br label %104
12: ; preds = %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %6
br label %16
16: ; preds = %12, %26
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %16
br label %27
20: ; preds = %16
%21 = load i32, i32* %6
switch i32 %21, label %26 [
i32 104, label %22
i32 63, label %24
]
22: ; preds = %20
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %26
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %20, %24, %22
br label %16
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = load i64, i64* @optind
%30 = getelementptr inbounds i8*, i8** %28, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %27
%35 = load i32, i32* %4
%36 = load i8**, i8*** %5
%37 = call i32 @cmd_serve(i32 %35, i8** %36)
br label %104
38: ; preds = %27
%39 = load i8**, i8*** %5
%40 = load i64, i64* @optind
%41 = getelementptr inbounds i8*, i8** %39, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %52, label %45
45: ; preds = %38
%46 = load i8**, i8*** %5
%47 = load i64, i64* @optind
%48 = add i64 %47, 1
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = call i32 @runscript(i8* %50)
br label %103
52: ; preds = %38
%53 = load i8**, i8*** %5
%54 = load i64, i64* @optind
%55 = getelementptr inbounds i8*, i8** %53, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @strcmp(i8* %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%58 = icmp ne i32 %57, 0
br i1 %58, label %63, label %59
59: ; preds = %52
%60 = load i32, i32* %4
%61 = load i8**, i8*** %5
%62 = call i32 @cmd_build(i32 %60, i8** %61)
br label %102
63: ; preds = %52
%64 = load i8**, i8*** %5
%65 = load i64, i64* @optind
%66 = getelementptr inbounds i8*, i8** %64, i64 %65
%67 = load i8*, i8** %66
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %74, label %70
70: ; preds = %63
%71 = load i32, i32* %4
%72 = load i8**, i8*** %5
%73 = call i32 @cmd_new(i32 %71, i8** %72)
br label %101
74: ; preds = %63
%75 = load i8**, i8*** %5
%76 = load i64, i64* @optind
%77 = getelementptr inbounds i8*, i8** %75, i64 %76
%78 = load i8*, i8** %77
%79 = call i32 @strcmp(i8* %78, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%80 = icmp ne i32 %79, 0
br i1 %80, label %85, label %81
81: ; preds = %74
%82 = load i32, i32* %4
%83 = load i8**, i8*** %5
%84 = call i32 @cmd_init(i32 %82, i8** %83)
br label %100
85: ; preds = %74
%86 = load i8**, i8*** %5
%87 = load i64, i64* @optind
%88 = getelementptr inbounds i8*, i8** %86, i64 %87
%89 = load i8*, i8** %88
%90 = call i32 @strcmp(i8* %89, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%91 = icmp ne i32 %90, 0
br i1 %91, label %96, label %92
92: ; preds = %85
%93 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
store i8* %93, i8** %7
%94 = load i8*, i8** %7
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %94)
br label %99
96: ; preds = %85
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%98 = call i32 (...) @usage()
br label %99
99: ; preds = %96, %92
br label %100
100: ; preds = %99, %81
br label %101
101: ; preds = %100, %70
br label %102
102: ; preds = %101, %59
br label %103
103: ; preds = %102, %45
br label %104
104: ; preds = %10, %103, %34
%105 = load i32, i32* %3
ret i32 %105
}

LLVM IR (-O2):
@.str = [5 x i8] c"asdf\00"
@optind = global i64 0
@.str.3 = [6 x i8] c"serve\00"
@.str.4 = [5 x i8] c"test\00"
@.str.5 = [6 x i8] c"build\00"
@.str.6 = [4 x i8] c"new\00"
@.str.7 = [5 x i8] c"init\00"
@.str.8 = [7 x i8] c"editor\00"
@.str.9 = [7 x i8] c"EDITOR\00"
@.str.10 = [30 x i8] c"Your default editor is: '%s'\0A\00"
@str = [7 x i8] c"dafuq?\00"
@str.12 = [5 x i8] c"halp\00"
@str.13 = [16 x i8] c"Invalid operand\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %55
6: ; preds = %2
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %57 [
i32 -1, label %15
i32 63, label %8
i32 104, label %9
]
8: ; preds = %14, %6
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.12, i64 0, i64 0), %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0), %8 ]
br label %11
11: ; preds = %14, %9
%12 = phi i8* [ %10, %9 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.12, i64 0, i64 0), %14 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
br label %14
14: ; preds = %11, %14
switch i32 %7, label %14 [
i32 63, label %8
i32 104, label %11
]
15: ; preds = %6
%16 = load i64, i64* @optind
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = tail call i32 @cmd_serve(i32 %0, i8** %1)
br label %55
23: ; preds = %15
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = add i64 %16, 1
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i32 @runscript(i8* %29)
br label %55
31: ; preds = %23
%32 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = tail call i32 @cmd_build(i32 %0, i8** %1)
br label %55
36: ; preds = %31
%37 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = tail call i32 @cmd_new(i32 %0, i8** %1)
br label %55
41: ; preds = %36
%42 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = tail call i32 @cmd_init(i32 %0, i8** %1)
br label %55
46: ; preds = %41
%47 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = tail call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %50)
br label %55
52: ; preds = %46
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0))
%54 = tail call i32 (...) @usage()
br label %55
55: ; preds = %21, %34, %44, %52, %49, %39, %26, %4
%56 = phi i32 [ 1, %4 ], [ 0, %26 ], [ 0, %39 ], [ 0, %49 ], [ 0, %52 ], [ 0, %44 ], [ 0, %34 ], [ 0, %21 ]
ret i32 %56
57: ; preds = %6, %57
br label %57
}