#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_nor_get(char *);
int /*<<< orphan*/ cfg_nor_set(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print_all_config();
int /*<<< orphan*/ reset_user_config();
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc < 2) {
    usage();
    exit(0);
  }
  if (!strcmp(argv[1], "get")) {
    cfg_nor_get(argv[2]);
  } else if (!strcmp(argv[1], "set")) {
    cfg_nor_set(argv[2]);
  } else if (!strcmp(argv[1], "reset")) {
    reset_user_config();
  } else if (!strcmp(argv[1], "show")) {
    print_all_config();
  } 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)
jge    119e <main+0x2e>
mov    $0x0,%al
call   1050 <usage@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11cd <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <cfg_nor_get@plt>
jmp    1264 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11fc <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <cfg_nor_set@plt>
jmp    125f <main+0xef>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1225 <main+0xb5>
mov    $0x0,%al
call   1040 <reset_user_config@plt>
jmp    125a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    124e <main+0xde>
mov    $0x0,%al
call   1070 <print_all_config@plt>
jmp    1255 <main+0xe5>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    125a <main+0xea>
jmp    125f <main+0xef>
jmp    1264 <main+0xf4>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    1209 <main+0x99>
mov    %rsi,%r14
mov    0x8(%rsi),%rbx
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11d9 <main+0x69>
lea    0xe68(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11e4 <main+0x74>
lea    0xe53(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ef <main+0x7f>
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11f8 <main+0x88>
xor    %eax,%eax
call   1050 <usage@plt>
jmp    11ff <main+0x8f>
mov    0x10(%r14),%rdi
call   1060 <cfg_nor_get@plt>
jmp    11ff <main+0x8f>
mov    0x10(%r14),%rdi
call   1090 <cfg_nor_set@plt>
jmp    11ff <main+0x8f>
xor    %eax,%eax
call   1040 <reset_user_config@plt>
jmp    11ff <main+0x8f>
xor    %eax,%eax
call   1070 <print_all_config@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1050 <usage@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"get\00"
@.str.1 = [4 x i8] c"set\00"
@.str.2 = [6 x i8] c"reset\00"
@.str.3 = [5 x i8] c"show\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 %8, label %11
8: ; preds = %2
%9 = call i32 (...) @usage()
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @cfg_nor_get(i8* %20)
br label %54
22: ; preds = %11
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @cfg_nor_set(i8* %31)
br label %53
33: ; preds = %22
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %33
%40 = call i32 (...) @reset_user_config()
br label %52
41: ; preds = %33
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %41
%48 = call i32 (...) @print_all_config()
br label %51
49: ; preds = %41
%50 = call i32 (...) @usage()
br label %51
51: ; preds = %49, %47
br label %52
52: ; preds = %51, %39
br label %53
53: ; preds = %52, %28
br label %54
54: ; preds = %53, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"get\00"
@.str.1 = [4 x i8] c"set\00"
@.str.2 = [6 x i8] c"reset\00"
@.str.3 = [5 x i8] c"show\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 (...) @usage()
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @cfg_nor_get(i8* %14)
br label %35
16: ; preds = %7
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @cfg_nor_set(i8* %21)
br label %35
23: ; preds = %16
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 (...) @reset_user_config()
br label %35
28: ; preds = %23
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = tail call i32 (...) @print_all_config()
br label %35
33: ; preds = %28
%34 = tail call i32 (...) @usage()
br label %35
35: ; preds = %19, %31, %33, %26, %12
ret i32 0
}