#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 handle_destroy(int, char **);
int handle_reconfigure(int, char **);
int handle_reload_inc(int, char **);
int handle_reload_snap(int, char **);
int handle_setup_snap(int, char **);
int handle_transition_inc(int, char **);
int handle_transition_snap(int, char **);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_help(int);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int ret = 0;
  if (argc < 2)
    print_help(-1);
  if (!strcmp(argv[1], "setup-snapshot"))
    ret = handle_setup_snap(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "reload-snapshot"))
    ret = handle_reload_snap(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "reload-incremental"))
    ret = handle_reload_inc(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "destroy"))
    ret = handle_destroy(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "transition-to-incremental"))
    ret = handle_transition_inc(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "transition-to-snapshot"))
    ret = handle_transition_snap(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "reconfigure"))
    ret = handle_reconfigure(argc - 1, argv + 1);
  else if (!strcmp(argv[1], "help"))
    print_help(0);
  else
    print_help(-1);
  if (ret)
    perror("driver returned an error performing specified action. check dmesg "
           "for more info");
  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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11d1 <main+0x31>
mov    $0xffffffff,%edi
call   10b0 <print_help@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe20(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1209 <main+0x69>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <handle_setup_snap@plt>
mov    %eax,-0x14(%rbp)
jmp    13af <main+0x20f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1241 <main+0xa1>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10c0 <handle_reload_snap@plt>
mov    %eax,-0x14(%rbp)
jmp    13aa <main+0x20a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdcf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1279 <main+0xd9>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1060 <handle_reload_inc@plt>
mov    %eax,-0x14(%rbp)
jmp    13a5 <main+0x205>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdaa(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12b1 <main+0x111>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10a0 <handle_destroy@plt>
mov    %eax,-0x14(%rbp)
jmp    13a0 <main+0x200>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd7a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12e9 <main+0x149>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1080 <handle_transition_inc@plt>
mov    %eax,-0x14(%rbp)
jmp    139b <main+0x1fb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd5c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1321 <main+0x181>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <handle_transition_snap@plt>
mov    %eax,-0x14(%rbp)
jmp    1396 <main+0x1f6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd3b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1359 <main+0x1b9>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <handle_reconfigure@plt>
mov    %eax,-0x14(%rbp)
jmp    1391 <main+0x1f1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd0f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1382 <main+0x1e2>
xor    %edi,%edi
call   10b0 <print_help@plt>
jmp    138c <main+0x1ec>
mov    $0xffffffff,%edi
call   10b0 <print_help@plt>
jmp    1391 <main+0x1f1>
jmp    1396 <main+0x1f6>
jmp    139b <main+0x1fb>
jmp    13a0 <main+0x200>
jmp    13a5 <main+0x205>
jmp    13aa <main+0x20a>
jmp    13af <main+0x20f>
cmpl   $0x0,-0x14(%rbp)
je     13c5 <main+0x225>
lea    0xcbc(%rip),%rdi
call   1090 <perror@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0x1,%edi
jg     11b8 <main+0x18>
mov    $0xffffffff,%edi
call   10b0 <print_help@plt>
mov    0x8(%r14),%rbx
add    $0x8,%r14
lea    0xe39(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     127a <main+0xda>
lea    0xe31(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1289 <main+0xe9>
lea    0xe2a(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1298 <main+0xf8>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12a7 <main+0x107>
lea    0xe17(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12b6 <main+0x116>
lea    0xe1a(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12c5 <main+0x125>
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12d4 <main+0x134>
lea    0xe17(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12fa <main+0x15a>
mov    $0xffffffff,%edi
jmp    12fc <main+0x15c>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <handle_setup_snap@plt>
jmp    12e1 <main+0x141>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   10c0 <handle_reload_snap@plt>
jmp    12e1 <main+0x141>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <handle_reload_inc@plt>
jmp    12e1 <main+0x141>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   10a0 <handle_destroy@plt>
jmp    12e1 <main+0x141>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1080 <handle_transition_inc@plt>
jmp    12e1 <main+0x141>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <handle_transition_snap@plt>
jmp    12e1 <main+0x141>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <handle_reconfigure@plt>
test   %eax,%eax
jne    12ec <main+0x14c>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xd89(%rip),%rdi
call   1090 <perror@plt>
jmp    12e5 <main+0x145>
xor    %edi,%edi
call   10b0 <print_help@plt>
jmp    12e5 <main+0x145>

LLVM IR (-O0):
@.str = [15 x i8] c"setup-snapshot\00"
@.str.1 = [16 x i8] c"reload-snapshot\00"
@.str.2 = [19 x i8] c"reload-incremental\00"
@.str.3 = [8 x i8] c"destroy\00"
@.str.4 = [26 x i8] c"transition-to-incremental\00"
@.str.5 = [23 x i8] c"transition-to-snapshot\00"
@.str.6 = [12 x i8] c"reconfigure\00"
@.str.7 = [5 x i8] c"help\00"
@.str.8 = [80 x i8] c"driver returned an error performing specified action. check dmesg for more info\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @print_help(i32 -1)
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %11
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = call i32 @handle_setup_snap(i32 %19, i8** %21)
store i32 %22, i32* %6
br label %112
23: ; preds = %11
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %35, label %29
29: ; preds = %23
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = call i32 @handle_reload_snap(i32 %31, i8** %33)
store i32 %34, i32* %6
br label %111
35: ; preds = %23
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %47, label %41
41: ; preds = %35
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 1
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = call i32 @handle_reload_inc(i32 %43, i8** %45)
store i32 %46, i32* %6
br label %110
47: ; preds = %35
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 @strcmp(i8* %50, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%52 = icmp ne i32 %51, 0
br i1 %52, label %59, label %53
53: ; preds = %47
%54 = load i32, i32* %4
%55 = sub nsw i32 %54, 1
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = call i32 @handle_destroy(i32 %55, i8** %57)
store i32 %58, i32* %6
br label %109
59: ; preds = %47
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %71, label %65
65: ; preds = %59
%66 = load i32, i32* %4
%67 = sub nsw i32 %66, 1
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = call i32 @handle_transition_inc(i32 %67, i8** %69)
store i32 %70, i32* %6
br label %108
71: ; preds = %59
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %83, label %77
77: ; preds = %71
%78 = load i32, i32* %4
%79 = sub nsw i32 %78, 1
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 1
%82 = call i32 @handle_transition_snap(i32 %79, i8** %81)
store i32 %82, i32* %6
br label %107
83: ; preds = %71
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 1
%86 = load i8*, i8** %85
%87 = call i32 @strcmp(i8* %86, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%88 = icmp ne i32 %87, 0
br i1 %88, label %95, label %89
89: ; preds = %83
%90 = load i32, i32* %4
%91 = sub nsw i32 %90, 1
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 1
%94 = call i32 @handle_reconfigure(i32 %91, i8** %93)
store i32 %94, i32* %6
br label %106
95: ; preds = %83
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 1
%98 = load i8*, i8** %97
%99 = call i32 @strcmp(i8* %98, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%100 = icmp ne i32 %99, 0
br i1 %100, label %103, label %101
101: ; preds = %95
%102 = call i32 @print_help(i32 0)
br label %105
103: ; preds = %95
%104 = call i32 @print_help(i32 -1)
br label %105
105: ; preds = %103, %101
br label %106
106: ; preds = %105, %89
br label %107
107: ; preds = %106, %77
br label %108
108: ; preds = %107, %65
br label %109
109: ; preds = %108, %53
br label %110
110: ; preds = %109, %41
br label %111
111: ; preds = %110, %29
br label %112
112: ; preds = %111, %17
%113 = load i32, i32* %6
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %112
%116 = call i32 @perror(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0))
br label %117
117: ; preds = %115, %112
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"setup-snapshot\00"
@.str.1 = [16 x i8] c"reload-snapshot\00"
@.str.2 = [19 x i8] c"reload-incremental\00"
@.str.3 = [8 x i8] c"destroy\00"
@.str.4 = [26 x i8] c"transition-to-incremental\00"
@.str.5 = [23 x i8] c"transition-to-snapshot\00"
@.str.6 = [12 x i8] c"reconfigure\00"
@.str.7 = [5 x i8] c"help\00"
@.str.8 = [80 x i8] c"driver returned an error performing specified action. check dmesg for more info\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @print_help(i32 -1)
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = add nsw i32 %0, -1
%13 = tail call i32 @handle_setup_snap(i32 %12, i8** %7)
br label %57
14: ; preds = %6
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = add nsw i32 %0, -1
%19 = tail call i32 @handle_reload_snap(i32 %18, i8** %7)
br label %57
20: ; preds = %14
%21 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(19) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = add nsw i32 %0, -1
%25 = tail call i32 @handle_reload_inc(i32 %24, i8** %7)
br label %57
26: ; preds = %20
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = add nsw i32 %0, -1
%31 = tail call i32 @handle_destroy(i32 %30, i8** %7)
br label %57
32: ; preds = %26
%33 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = add nsw i32 %0, -1
%37 = tail call i32 @handle_transition_inc(i32 %36, i8** %7)
br label %57
38: ; preds = %32
%39 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(23) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = add nsw i32 %0, -1
%43 = tail call i32 @handle_transition_snap(i32 %42, i8** %7)
br label %57
44: ; preds = %38
%45 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = add nsw i32 %0, -1
%49 = tail call i32 @handle_reconfigure(i32 %48, i8** %7)
br label %57
50: ; preds = %44
%51 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = tail call i32 @print_help(i32 0)
br label %62
55: ; preds = %50
%56 = tail call i32 @print_help(i32 -1)
br label %62
57: ; preds = %17, %29, %41, %47, %35, %23, %11
%58 = phi i32 [ %49, %47 ], [ %43, %41 ], [ %37, %35 ], [ %31, %29 ], [ %25, %23 ], [ %19, %17 ], [ %13, %11 ]
%59 = icmp eq i32 %58, 0
br i1 %59, label %62, label %60
60: ; preds = %57
%61 = tail call i32 @perror(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0))
br label %62
62: ; preds = %53, %55, %60, %57
ret i32 0
}