#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*/ cfg_get(char *);
int /*<<< orphan*/ cfg_list();
scalar_t__ cfg_set(char *);
int /*<<< orphan*/ check_cfg_flag();
int /*<<< orphan*/ clear_cfg_flag();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ set_cfg_flag();
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc < 2 || !strcmp(argv[1], "-h")) {
    usage();
    exit(0);
  }
  if (!strcmp(argv[1], "get")) {
    cfg_get(argv[2]);
  } else if (!strcmp(argv[1], "set")) {
    if (cfg_set(argv[2]))
      set_cfg_flag();
  } else if (!strcmp(argv[1], "checkflag")) {
    check_cfg_flag();
  } else if (!strcmp(argv[1], "setflag")) {
    set_cfg_flag();
  } else if (!strcmp(argv[1], "clearflag")) {
    clear_cfg_flag();
  } else if (!strcmp(argv[1], "list")) {
    cfg_list();
  } else {
    usage();
  }
  return 0;
}


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   $0x2,-0x8(%rbp)
jl     11cd <main+0x3d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe41(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11db <main+0x4b>
mov    $0x0,%al
call   1080 <usage@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe19(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    120a <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <cfg_get@plt>
jmp    130e <main+0x17e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdee(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    124a <main+0xba>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <cfg_set@plt>
cmp    $0x0,%rax
je     1245 <main+0xb5>
mov    $0x0,%al
call   10a0 <set_cfg_flag@plt>
jmp    1309 <main+0x179>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1273 <main+0xe3>
mov    $0x0,%al
call   1040 <check_cfg_flag@plt>
jmp    1304 <main+0x174>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd93(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    129c <main+0x10c>
mov    $0x0,%al
call   10a0 <set_cfg_flag@plt>
jmp    12ff <main+0x16f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd72(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12c5 <main+0x135>
mov    $0x0,%al
call   1090 <clear_cfg_flag@plt>
jmp    12fa <main+0x16a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd53(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12ee <main+0x15e>
mov    $0x0,%al
call   1030 <cfg_list@plt>
jmp    12f5 <main+0x165>
mov    $0x0,%al
call   1080 <usage@plt>
jmp    12fa <main+0x16a>
jmp    12ff <main+0x16f>
jmp    1304 <main+0x174>
jmp    1309 <main+0x179>
jmp    130e <main+0x17e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     127b <main+0xeb>
mov    %rsi,%r14
mov    0x8(%rsi),%rbx
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     127b <main+0xeb>
lea    0xe41(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1236 <main+0xa6>
lea    0xe32(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1241 <main+0xb1>
lea    0xe23(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1258 <main+0xc8>
lea    0xe1a(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     124f <main+0xbf>
lea    0xe0f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1261 <main+0xd1>
lea    0xe06(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     126a <main+0xda>
xor    %eax,%eax
call   1080 <usage@plt>
jmp    1271 <main+0xe1>
mov    0x10(%r14),%rdi
call   1060 <cfg_get@plt>
jmp    1271 <main+0xe1>
mov    0x10(%r14),%rdi
call   1070 <cfg_set@plt>
test   %rax,%rax
je     1271 <main+0xe1>
xor    %eax,%eax
call   10a0 <set_cfg_flag@plt>
jmp    1271 <main+0xe1>
xor    %eax,%eax
call   1040 <check_cfg_flag@plt>
jmp    1271 <main+0xe1>
xor    %eax,%eax
call   1090 <clear_cfg_flag@plt>
jmp    1271 <main+0xe1>
xor    %eax,%eax
call   1030 <cfg_list@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1080 <usage@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [4 x i8] c"get\00"
@.str.2 = [4 x i8] c"set\00"
@.str.3 = [10 x i8] c"checkflag\00"
@.str.4 = [8 x i8] c"setflag\00"
@.str.5 = [10 x i8] c"clearflag\00"
@.str.6 = [5 x i8] c"list\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 slt i32 %6, 2
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %8, %2
%15 = call i32 (...) @usage()
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %8
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %17
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @cfg_get(i8* %26)
br label %82
28: ; preds = %17
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %43, label %34
34: ; preds = %28
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i64 @cfg_set(i8* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = call i32 (...) @set_cfg_flag()
br label %42
42: ; preds = %40, %34
br label %81
43: ; preds = %28
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %43
%50 = call i32 (...) @check_cfg_flag()
br label %80
51: ; preds = %43
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 1
%54 = load i8*, i8** %53
%55 = call i32 @strcmp(i8* %54, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp ne i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %51
%58 = call i32 (...) @set_cfg_flag()
br label %79
59: ; preds = %51
%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 ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %67, label %65
65: ; preds = %59
%66 = call i32 (...) @clear_cfg_flag()
br label %78
67: ; preds = %59
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i32 @strcmp(i8* %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%72 = icmp ne i32 %71, 0
br i1 %72, label %75, label %73
73: ; preds = %67
%74 = call i32 (...) @cfg_list()
br label %77
75: ; preds = %67
%76 = call i32 (...) @usage()
br label %77
77: ; preds = %75, %73
br label %78
78: ; preds = %77, %65
br label %79
79: ; preds = %78, %57
br label %80
80: ; preds = %79, %49
br label %81
81: ; preds = %80, %42
br label %82
82: ; preds = %81, %23
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [4 x i8] c"get\00"
@.str.2 = [4 x i8] c"set\00"
@.str.3 = [10 x i8] c"checkflag\00"
@.str.4 = [8 x i8] c"setflag\00"
@.str.5 = [10 x i8] c"clearflag\00"
@.str.6 = [5 x i8] c"list\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4, %2
%10 = tail call i32 (...) @usage()
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %4
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @cfg_get(i8* %17)
br label %51
19: ; preds = %12
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = tail call i64 @cfg_set(i8* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %51, label %27
27: ; preds = %22
%28 = tail call i32 (...) @set_cfg_flag()
br label %51
29: ; preds = %19
%30 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 (...) @check_cfg_flag()
br label %51
34: ; preds = %29
%35 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 (...) @set_cfg_flag()
br label %51
39: ; preds = %34
%40 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = tail call i32 (...) @clear_cfg_flag()
br label %51
44: ; preds = %39
%45 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = tail call i32 (...) @cfg_list()
br label %51
49: ; preds = %44
%50 = tail call i32 (...) @usage()
br label %51
51: ; preds = %27, %22, %37, %47, %49, %42, %32, %15
ret i32 0
}