#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*/ ata_identify_devices();
int /*<<< orphan*/ ata_report_devices();
int /*<<< orphan*/ io_printf(char *);
int /*<<< orphan*/ program_load_test();
int /*<<< orphan*/ shell_shutdown();
scalar_t__ strcmp(char *, char *);
void shell_process_command(char *command) {
  if (strcmp(command, "shutdown") == 0) {
    shell_shutdown();
  } else if (strcmp(command, "test") == 0) {
    program_load_test();
  } else if (strcmp(command, "drive info") == 0) {
    ata_report_devices();
  } else if (strcmp(command, "drive identify") == 0) {
    ata_identify_devices();
  } else {
    io_printf("Unable to execute command ");
    io_printf(command);
    io_printf("\n");
  }
}


x86 assembly (clang, -O0):
<shell_process_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1192 <shell_process_command+0x32>
mov    $0x0,%al
call   1030 <shell_shutdown@plt>
jmp    1234 <shell_process_command+0xd4>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11b8 <shell_process_command+0x58>
mov    $0x0,%al
call   1060 <program_load_test@plt>
jmp    122f <shell_process_command+0xcf>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11de <shell_process_command+0x7e>
mov    $0x0,%al
call   1080 <ata_report_devices@plt>
jmp    122a <shell_process_command+0xca>
mov    -0x8(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1204 <shell_process_command+0xa4>
mov    $0x0,%al
call   1040 <ata_identify_devices@plt>
jmp    1225 <shell_process_command+0xc5>
lea    0xe1d(%rip),%rdi
call   1050 <io_printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <io_printf@plt>
lea    0xe23(%rip),%rdi
call   1050 <io_printf@plt>
jmp    122a <shell_process_command+0xca>
jmp    122f <shell_process_command+0xcf>
jmp    1234 <shell_process_command+0xd4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shell_process_command>:
push   %rbx
mov    %rdi,%rbx
lea    0xe95(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11d2 <shell_process_command+0x72>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11da <shell_process_command+0x7a>
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11e2 <shell_process_command+0x82>
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11ea <shell_process_command+0x8a>
lea    0xe70(%rip),%rdi
call   1050 <io_printf@plt>
mov    %rbx,%rdi
call   1050 <io_printf@plt>
lea    0xe77(%rip),%rdi
pop    %rbx
jmp    1050 <io_printf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <shell_shutdown@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <program_load_test@plt>
xor    %eax,%eax
pop    %rbx
jmp    1080 <ata_report_devices@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <ata_identify_devices@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"shutdown\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [11 x i8] c"drive info\00"
@.str.3 = [15 x i8] c"drive identify\00"
@.str.4 = [27 x i8] c"Unable to execute command \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @shell_process_command(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @shell_shutdown()
br label %34
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strcmp(i8* %9, 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 %14
12: ; preds = %8
%13 = call i32 (...) @program_load_test()
br label %33
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (...) @ata_report_devices()
br label %32
20: ; preds = %14
%21 = load i8*, i8** %2
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @ata_identify_devices()
br label %31
26: ; preds = %20
%27 = call i32 @io_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%28 = load i8*, i8** %2
%29 = call i32 @io_printf(i8* %28)
%30 = call i32 @io_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %26, %24
br label %32
32: ; preds = %31, %18
br label %33
33: ; preds = %32, %12
br label %34
34: ; preds = %33, %6
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"shutdown\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [11 x i8] c"drive info\00"
@.str.3 = [15 x i8] c"drive identify\00"
@.str.4 = [27 x i8] c"Unable to execute command \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @shell_process_command(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @shell_shutdown()
br label %25
6: ; preds = %1
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (...) @program_load_test()
br label %25
11: ; preds = %6
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 (...) @ata_report_devices()
br label %25
16: ; preds = %11
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 (...) @ata_identify_devices()
br label %25
21: ; preds = %16
%22 = tail call i32 @io_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 @io_printf(i8* %0)
%24 = tail call i32 @io_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %9, %19, %21, %14, %4
ret void
}