#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*/ change_mem(char *);
int /*<<< orphan*/ display_help();
int /*<<< orphan*/ display_mem(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void process_command(char *cmd) {
  if (cmd[0] == '\0') {
    return;
  }
  switch (cmd[0]) {
  case '?':
    display_help();
    break;
  case 'd':
  case 'D':
    display_mem(cmd);
    break;
  case 'c':
  case 'C':
    change_mem(cmd);
    break;
  case 'q':
  case 'Q':
    exit(0);
  default:
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<process_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1161 <process_command+0x21>
jmp    11c7 <process_command+0x87>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x32,%eax
ja     11bd <process_command+0x7d>
mov    -0x10(%rbp),%rax
lea    0xe7b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <display_help@plt>
jmp    11c2 <process_command+0x82>
mov    -0x8(%rbp),%rdi
call   1050 <display_mem@plt>
jmp    11c2 <process_command+0x82>
mov    -0x8(%rbp),%rdi
call   1030 <change_mem@plt>
jmp    11c2 <process_command+0x82>
xor    %edi,%edi
call   1060 <exit@plt>
jmp    11c2 <process_command+0x82>
jmp    11c7 <process_command+0x87>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_command>:
push   %rax
movsbl (%rdi),%eax
test   %eax,%eax
je     1166 <process_command+0x26>
add    $0xffffffc1,%eax
cmp    $0x32,%eax
ja     1166 <process_command+0x26>
lea    0xea9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
pop    %rax
jmp    1030 <change_mem@plt>
pop    %rax
ret
pop    %rax
jmp    1050 <display_mem@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <display_help@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @process_command(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
br label %26
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
switch i32 %13, label %24 [
i32 63, label %14
i32 100, label %16
i32 68, label %16
i32 99, label %19
i32 67, label %19
i32 113, label %22
i32 81, label %22
]
14: ; preds = %9
%15 = call i32 (...) @display_help()
br label %25
16: ; preds = %9, %9
%17 = load i8*, i8** %2
%18 = call i32 @display_mem(i8* %17)
br label %25
19: ; preds = %9, %9
%20 = load i8*, i8** %2
%21 = call i32 @change_mem(i8* %20)
br label %25
22: ; preds = %9, %9
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %9
br label %25
25: ; preds = %24, %19, %16, %14
br label %26
26: ; preds = %25, %8
ret void
}

LLVM IR (-O2):
define void @process_command(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = sext i8 %2 to i32
switch i32 %5, label %14 [
i32 63, label %6
i32 100, label %8
i32 68, label %8
i32 99, label %10
i32 67, label %10
i32 113, label %12
i32 81, label %12
]
6: ; preds = %4
%7 = tail call i32 (...) @display_help()
br label %14
8: ; preds = %4, %4
%9 = tail call i32 @display_mem(i8* %0)
br label %14
10: ; preds = %4, %4
%11 = tail call i32 @change_mem(i8* %0)
br label %14
12: ; preds = %4, %4
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %6, %8, %10, %4, %1
ret void
}