#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ parse_cli_extract(char **);
int /*<<< orphan*/ parse_cli_info(char **);
int /*<<< orphan*/ parse_cli_inject(char **);
int /*<<< orphan*/ parse_cli_patch(char **);
int /*<<< orphan*/ parse_cli_title(char **);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
void parse_line(int argc, char **argv) {
  char *command = *(argv++);
  if (command == NULL) {
    printf("no command!\n");
    exit(EXIT_FAILURE);
  }
  if (strcmp(command, "info") == 0) {
    parse_cli_info(argv);
  } else if (strcmp(command, "title") == 0) {
    parse_cli_title(argv);
  } else if (strcmp(command, "extract") == 0) {
    parse_cli_extract(argv);
  } else if (strcmp(command, "inject") == 0) {
    parse_cli_inject(argv);
  } else if (strcmp(command, "patch") == 0) {
    parse_cli_patch(argv);
  } else {
    printf("Unknown command: %s\n\n", command);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11cc <parse_line+0x4c>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11f4 <parse_line+0x74>
mov    -0x10(%rbp),%rdi
call   1030 <parse_cli_info@plt>
jmp    12c8 <parse_line+0x148>
mov    -0x18(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    121c <parse_line+0x9c>
mov    -0x10(%rbp),%rdi
call   1060 <parse_cli_title@plt>
jmp    12c3 <parse_line+0x143>
mov    -0x18(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1244 <parse_line+0xc4>
mov    -0x10(%rbp),%rdi
call   1070 <parse_cli_extract@plt>
jmp    12be <parse_line+0x13e>
mov    -0x18(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    126c <parse_line+0xec>
mov    -0x10(%rbp),%rdi
call   10a0 <parse_cli_inject@plt>
jmp    12b9 <parse_line+0x139>
mov    -0x18(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1294 <parse_line+0x114>
mov    -0x10(%rbp),%rdi
call   1090 <parse_cli_patch@plt>
jmp    12b4 <parse_line+0x134>
mov    -0x18(%rbp),%rsi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
jmp    12b9 <parse_line+0x139>
jmp    12be <parse_line+0x13e>
jmp    12c3 <parse_line+0x143>
jmp    12c8 <parse_line+0x148>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%r14
test   %r14,%r14
je     1256 <parse_line+0xc6>
mov    %rsi,%rbx
add    $0x8,%rbx
lea    0xe52(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     121a <parse_line+0x8a>
lea    0xe43(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1229 <parse_line+0x99>
lea    0xe35(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1238 <parse_line+0xa8>
lea    0xe29(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1247 <parse_line+0xb7>
lea    0xe1c(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1270 <parse_line+0xe0>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    10a0 <parse_cli_patch@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <parse_cli_info@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <parse_cli_title@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <parse_cli_extract@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    10b0 <parse_cli_inject@plt>
lea    0xdd9(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
lea    0xda9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1262 <parse_line+0xd2>

LLVM IR (-O0):
@.str = [13 x i8] c"no command!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [5 x i8] c"info\00"
@.str.2 = [6 x i8] c"title\00"
@.str.3 = [8 x i8] c"extract\00"
@.str.4 = [7 x i8] c"inject\00"
@.str.5 = [6 x i8] c"patch\00"
@.str.6 = [22 x i8] c"Unknown command: %s\0A\0A\00"
define void @parse_line(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i32 1
store i8** %7, i8*** %4
%8 = load i8*, i8** %6
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8**, i8*** %4
%21 = call i32 @parse_cli_info(i8** %20)
br label %59
22: ; preds = %15
%23 = load i8*, i8** %5
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i8**, i8*** %4
%28 = call i32 @parse_cli_title(i8** %27)
br label %58
29: ; preds = %22
%30 = load i8*, i8** %5
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i8**, i8*** %4
%35 = call i32 @parse_cli_extract(i8** %34)
br label %57
36: ; preds = %29
%37 = load i8*, i8** %5
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i8**, i8*** %4
%42 = call i32 @parse_cli_inject(i8** %41)
br label %56
43: ; preds = %36
%44 = load i8*, i8** %5
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i8**, i8*** %4
%49 = call i32 @parse_cli_patch(i8** %48)
br label %55
50: ; preds = %43
%51 = load i8*, i8** %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %51)
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %47
br label %56
56: ; preds = %55, %40
br label %57
57: ; preds = %56, %33
br label %58
58: ; preds = %57, %26
br label %59
59: ; preds = %58, %19
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [5 x i8] c"info\00"
@.str.2 = [6 x i8] c"title\00"
@.str.3 = [8 x i8] c"extract\00"
@.str.4 = [7 x i8] c"inject\00"
@.str.5 = [6 x i8] c"patch\00"
@.str.6 = [22 x i8] c"Unknown command: %s\0A\0A\00"
@str = [12 x i8] c"no command!\00"
define void @parse_line(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @parse_cli_info(i8** %3)
br label %39
15: ; preds = %10
%16 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @parse_cli_title(i8** %3)
br label %39
20: ; preds = %15
%21 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @parse_cli_extract(i8** %3)
br label %39
25: ; preds = %20
%26 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @parse_cli_inject(i8** %3)
br label %39
30: ; preds = %25
%31 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 @parse_cli_patch(i8** %3)
br label %39
35: ; preds = %30
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%37 = load i32, i32* @EXIT_FAILURE
%38 = tail call i32 @exit(i32 %37)
unreachable
39: ; preds = %18, %28, %33, %23, %13
ret void
}