#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 b64main(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int hexdump(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void command_process(int argc, char **argv) {
  if (argc < 2 || argc > 3) {
    fprintf(stderr, "ERR: Invalid arguments\nUsage: hexdump [file], enc-base64 "
                    "[file], dec-base64 [file]\n");
    exit(-1);
  } else {
    if (strcmp(argv[1], "hexdump") == 0) {
      if (hexdump(argv[2]) == 1)
        return;
    } else if (strcmp(argv[1], "enc-base64") == 0) {
      if (b64main(argv[2], "enc") == 1)
        return;
    } else if (strcmp(argv[1], "dec-base64") == 0) {
      if (b64main(argv[2], "dec") == 1)
        return;
    } else {
      fprintf(stderr, "ERR: Invalid arguments\nUsage: hexdump [file], "
                      "enc-base64 [file], dec-base64 [file]\n");
      exit(-1);
    }
    fprintf(stderr, "ERR: Unknown Error\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<command_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     1173 <command_process+0x23>
cmpl   $0x3,-0x4(%rbp)
jle    1192 <command_process+0x42>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11d0 <command_process+0x80>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <hexdump@plt>
cmp    $0x1,%eax
jne    11cb <command_process+0x7b>
jmp    12a2 <command_process+0x152>
jmp    1283 <command_process+0x133>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1215 <command_process+0xc5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe6a(%rip),%rsi
call   1070 <b64main@plt>
cmp    $0x1,%eax
jne    1210 <command_process+0xc0>
jmp    12a2 <command_process+0x152>
jmp    127e <command_process+0x12e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe47(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    125a <command_process+0x10a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe34(%rip),%rsi
call   1070 <b64main@plt>
cmp    $0x1,%eax
jne    1255 <command_process+0x105>
jmp    12a2 <command_process+0x152>
jmp    1279 <command_process+0x129>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
jmp    127e <command_process+0x12e>
jmp    1283 <command_process+0x133>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xde7(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_process>:
push   %rbx
add    $0xfffffffc,%edi
cmp    $0xfffffffd,%edi
jbe    11ca <command_process+0x7a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeed(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a8 <command_process+0x58>
mov    0x8(%rbx),%rdi
lea    0xee0(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b3 <command_process+0x63>
mov    0x8(%rbx),%rdi
lea    0xeda(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11ca <command_process+0x7a>
mov    0x10(%rbx),%rdi
lea    0xed0(%rip),%rsi
jmp    11be <command_process+0x6e>
mov    0x10(%rbx),%rdi
call   1050 <hexdump@plt>
jmp    11c3 <command_process+0x73>
mov    0x10(%rbx),%rdi
lea    0xea9(%rip),%rsi
call   1070 <b64main@plt>
cmp    $0x1,%eax
jne    11dc <command_process+0x8c>
pop    %rbx
ret
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe26(%rip),%rsi
jmp    11ec <command_process+0x9c>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [84 x i8] c"ERR: Invalid arguments\0AUsage: hexdump [file], enc-base64 [file], dec-base64 [file]\0A\00"
@.str.1 = [8 x i8] c"hexdump\00"
@.str.2 = [11 x i8] c"enc-base64\00"
@.str.3 = [4 x i8] c"enc\00"
@.str.4 = [11 x i8] c"dec-base64\00"
@.str.5 = [4 x i8] c"dec\00"
@.str.6 = [20 x i8] c"ERR: Unknown Error\0A\00"
define void @command_process(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 2
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 3
br i1 %9, label %10, label %14
10: ; preds = %7, %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %7
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %14
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @hexdump(i8* %23)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %20
br label %66
27: ; preds = %20
br label %62
28: ; preds = %14
%29 = load i8**, i8*** %4
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %28
%35 = load i8**, i8*** %4
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @b64main(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %41
40: ; preds = %34
br label %66
41: ; preds = %34
br label %61
42: ; preds = %28
%43 = load i8**, i8*** %4
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %56
48: ; preds = %42
%49 = load i8**, i8*** %4
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = call i32 @b64main(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %55
54: ; preds = %48
br label %66
55: ; preds = %48
br label %60
56: ; preds = %42
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%59 = call i32 @exit(i32 -1)
unreachable
60: ; preds = %55
br label %61
61: ; preds = %60, %41
br label %62
62: ; preds = %61, %27
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%65 = call i32 @exit(i32 -1)
unreachable
66: ; preds = %54, %40, %26
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [84 x i8] c"ERR: Invalid arguments\0AUsage: hexdump [file], enc-base64 [file], dec-base64 [file]\0A\00"
@.str.1 = [8 x i8] c"hexdump\00"
@.str.2 = [11 x i8] c"enc-base64\00"
@.str.3 = [4 x i8] c"enc\00"
@.str.4 = [11 x i8] c"dec-base64\00"
@.str.5 = [4 x i8] c"dec\00"
@.str.6 = [20 x i8] c"ERR: Unknown Error\0A\00"
define void @command_process(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -4
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @hexdump(i8* %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %45, label %41
19: ; preds = %9
%20 = load i8*, i8** %10
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = tail call i32 @b64main(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 1
br i1 %27, label %45, label %41
28: ; preds = %19
%29 = load i8*, i8** %10
%30 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = tail call i32 @b64main(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp eq i32 %35, 1
br i1 %36, label %45, label %41
37: ; preds = %28
%38 = load i32, i32* @stderr
%39 = tail call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%40 = tail call i32 @exit(i32 -1)
unreachable
41: ; preds = %23, %32, %14
%42 = load i32, i32* @stderr
%43 = tail call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%44 = tail call i32 @exit(i32 -1)
unreachable
45: ; preds = %32, %23, %14
ret void
}