#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(int /*<<< orphan*/);
int /*<<< orphan*/ nvram_get(char *);
int /*<<< orphan*/ nvram_reset();
int /*<<< orphan*/ nvram_set(char *);
int /*<<< orphan*/ nvram_show();
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int ret = 0;
  if (argc < 2 || !strcmp(argv[1], "-h")) {
    usage();
    exit(0);
  }
  if (!strcmp(argv[1], "get")) {
    nvram_get(argv[2]);
  } else if (!strcmp(argv[1], "set")) {
    nvram_set(argv[2]);
  } else if (!strcmp(argv[1], "show")) {
    nvram_show();
  } else if (!strcmp(argv[1], "reset")) {
    nvram_reset();
  } else
    usage();
  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)
jl     11b4 <main+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11c2 <main+0x52>
mov    $0x0,%al
call   1070 <usage@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11f1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <nvram_get@plt>
jmp    1288 <main+0x118>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1220 <main+0xb0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <nvram_set@plt>
jmp    1283 <main+0x113>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd8(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1249 <main+0xd9>
mov    $0x0,%al
call   1060 <nvram_show@plt>
jmp    127e <main+0x10e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1272 <main+0x102>
mov    $0x0,%al
call   1040 <nvram_reset@plt>
jmp    1279 <main+0x109>
mov    $0x0,%al
call   1070 <usage@plt>
jmp    127e <main+0x10e>
jmp    1283 <main+0x113>
jmp    1288 <main+0x118>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1220 <main+0xb0>
mov    %rsi,%r14
mov    0x8(%rsi),%rbx
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1220 <main+0xb0>
lea    0xe61(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11f0 <main+0x80>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11fb <main+0x8b>
lea    0xe3f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1206 <main+0x96>
lea    0xe31(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     120f <main+0x9f>
xor    %eax,%eax
call   1070 <usage@plt>
jmp    1216 <main+0xa6>
mov    0x10(%r14),%rdi
call   1090 <nvram_get@plt>
jmp    1216 <main+0xa6>
mov    0x10(%r14),%rdi
call   1030 <nvram_set@plt>
jmp    1216 <main+0xa6>
xor    %eax,%eax
call   1060 <nvram_show@plt>
jmp    1216 <main+0xa6>
xor    %eax,%eax
call   1040 <nvram_reset@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1070 <usage@plt>
xor    %edi,%edi
call   1080 <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 = [5 x i8] c"show\00"
@.str.4 = [6 x i8] c"reset\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 %15, label %9
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %9, %2
%16 = call i32 (...) @usage()
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %9
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %18
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @nvram_get(i8* %27)
br label %61
29: ; preds = %18
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %29
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @nvram_set(i8* %38)
br label %60
40: ; preds = %29
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @strcmp(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp ne i32 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %40
%47 = call i32 (...) @nvram_show()
br label %59
48: ; preds = %40
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %48
%55 = call i32 (...) @nvram_reset()
br label %58
56: ; preds = %48
%57 = call i32 (...) @usage()
br label %58
58: ; preds = %56, %54
br label %59
59: ; preds = %58, %46
br label %60
60: ; preds = %59, %35
br label %61
61: ; preds = %60, %24
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 = [5 x i8] c"show\00"
@.str.4 = [6 x i8] c"reset\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 @nvram_get(i8* %17)
br label %38
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 %26
22: ; preds = %19
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = tail call i32 @nvram_set(i8* %24)
br label %38
26: ; preds = %19
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 (...) @nvram_show()
br label %38
31: ; preds = %26
%32 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = tail call i32 (...) @nvram_reset()
br label %38
36: ; preds = %31
%37 = tail call i32 (...) @usage()
br label %38
38: ; preds = %22, %34, %36, %29, %15
ret i32 0
}