#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 */
scalar_t__ cmd_dump(char const *, char const *);
scalar_t__ cmd_ext4(char const *);
int /*<<< orphan*/ printf(char *, char const *);
scalar_t__ strcmp(char const *, char *);
int execute_command(const char *cmd, const char *file, const char *offset) {
  if ((cmd == NULL) || (file == NULL)) {
    printf(" Check your input for command \'%s\'\n", cmd);
    return -1;
  }
  if (0 == strcmp(cmd, "dump")) {
    if (cmd_dump(file, offset))
      return -1;
  } else if (0 == strcmp(cmd, "ext4")) {
    if (cmd_ext4(file))
      return -1;
  } else {
    printf(" Command \"%s\" is not supported\n", cmd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<execute_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116a <execute_command+0x2a>
cmpq   $0x0,-0x18(%rbp)
jne    1186 <execute_command+0x46>
mov    -0x10(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    122a <execute_command+0xea>
mov    -0x10(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11cc <execute_command+0x8c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <cmd_dump@plt>
cmp    $0x0,%rax
je     11c7 <execute_command+0x87>
movl   $0xffffffff,-0x4(%rbp)
jmp    122a <execute_command+0xea>
jmp    1223 <execute_command+0xe3>
mov    -0x10(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    120e <execute_command+0xce>
mov    -0x18(%rbp),%rdi
call   1040 <cmd_ext4@plt>
cmp    $0x0,%rax
je     1209 <execute_command+0xc9>
movl   $0xffffffff,-0x4(%rbp)
jmp    122a <execute_command+0xea>
jmp    121e <execute_command+0xde>
mov    -0x10(%rbp),%rsi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    1223 <execute_command+0xe3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_command>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1191 <execute_command+0x51>
mov    %rsi,%r14
test   %rsi,%rsi
je     1191 <execute_command+0x51>
mov    %rdx,%r15
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11a7 <execute_command+0x67>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b4 <execute_command+0x74>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    11c9 <execute_command+0x89>
lea    0xe68(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
jmp    11cb <execute_command+0x8b>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <cmd_dump@plt>
jmp    11bc <execute_command+0x7c>
mov    %r14,%rdi
call   1040 <cmd_ext4@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    11cb <execute_command+0x8b>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c" Check your input for command '%s'\0A\00"
@.str.1 = [5 x i8] c"dump\00"
@.str.2 = [5 x i8] c"ext4\00"
@.str.3 = [32 x i8] c" Command \22%s\22 is not supported\0A\00"
define i32 @execute_command(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10, %3
%14 = load i8*, i8** %5
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 -1, i32* %4
br label %42
16: ; preds = %10
%17 = load i8*, i8** %5
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 0, %18
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i64 @cmd_dump(i8* %21, i8* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 -1, i32* %4
br label %42
26: ; preds = %20
br label %41
27: ; preds = %16
%28 = load i8*, i8** %5
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 0, %29
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load i8*, i8** %6
%33 = call i64 @cmd_ext4(i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 -1, i32* %4
br label %42
36: ; preds = %31
br label %40
37: ; preds = %27
%38 = load i8*, i8** %5
%39 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %37, %36
br label %41
41: ; preds = %40, %26
store i32 0, i32* %4
br label %42
42: ; preds = %41, %35, %25, %13
%43 = load i32, i32* %4
ret i32 %43
}

LLVM IR (-O2):
@.str = [36 x i8] c" Check your input for command '%s'\0A\00"
@.str.1 = [5 x i8] c"dump\00"
@.str.2 = [5 x i8] c"ext4\00"
@.str.3 = [32 x i8] c" Command \22%s\22 is not supported\0A\00"
define i32 @execute_command(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i8* %1, null
%6 = or i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %24
9: ; preds = %3
%10 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = tail call i64 @cmd_dump(i8* %1, i8* %2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %23, label %24
15: ; preds = %9
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = tail call i64 @cmd_ext4(i8* %1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %24
21: ; preds = %15
%22 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %23
23: ; preds = %21, %18, %12
br label %24
24: ; preds = %18, %12, %23, %7
%25 = phi i32 [ -1, %7 ], [ 0, %23 ], [ -1, %12 ], [ -1, %18 ]
ret i32 %25
}