#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*/ cmd_del();
int /*<<< orphan*/ cmd_disp();
int /*<<< orphan*/ cmd_help();
int /*<<< orphan*/ cmd_new();
int /*<<< orphan*/ cmd_next();
int /*<<< orphan*/ cmd_top();
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ writestr(int, char *);
int handle_command(char *buf) {
  if (!strcmp(buf, "top")) {
    cmd_top();
  } else if (!strcpy(buf, "new")) {
    cmd_new();
  } else if (!strcpy(buf, "del")) {
    cmd_del();
  } else if (!strcpy(buf, "disp")) {
    cmd_disp();
  } else if (!strcpy(buf, "next")) {
    cmd_next();
  } else if (!strcpy(buf, "quit")) {
    return 1;
  } else if (!strcpy(buf, "help")) {
    cmd_help();
  } else {
    writestr(1, "That command is not yet implemented, mein "
                "F\xc3\xbchrer!\nPlease do not feed me to the dogs!\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<handle_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    11c1 <handle_command+0x31>
mov    $0x0,%al
call   10a0 <cmd_top@plt>
jmp    12da <handle_command+0x14a>
mov    -0x10(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1040 <strcpy@plt>
cmp    $0x0,%eax
jne    11e6 <handle_command+0x56>
mov    $0x0,%al
call   1050 <cmd_new@plt>
jmp    12d5 <handle_command+0x145>
mov    -0x10(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1040 <strcpy@plt>
cmp    $0x0,%eax
jne    120b <handle_command+0x7b>
mov    $0x0,%al
call   1080 <cmd_del@plt>
jmp    12d0 <handle_command+0x140>
mov    -0x10(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   1040 <strcpy@plt>
cmp    $0x0,%eax
jne    1230 <handle_command+0xa0>
mov    $0x0,%al
call   1060 <cmd_disp@plt>
jmp    12cb <handle_command+0x13b>
mov    -0x10(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   1040 <strcpy@plt>
cmp    $0x0,%eax
jne    1255 <handle_command+0xc5>
mov    $0x0,%al
call   1030 <cmd_next@plt>
jmp    12c6 <handle_command+0x136>
mov    -0x10(%rbp),%rdi
lea    0xdb6(%rip),%rsi
call   1040 <strcpy@plt>
cmp    $0x0,%eax
jne    127a <handle_command+0xea>
movl   $0x1,-0x4(%rbp)
jmp    12e1 <handle_command+0x151>
mov    -0x10(%rbp),%rdi
lea    0xd96(%rip),%rsi
call   1040 <strcpy@plt>
cmp    $0x0,%eax
jne    129f <handle_command+0x10f>
mov    $0x0,%al
call   10b0 <cmd_help@plt>
jmp    12bc <handle_command+0x12c>
mov    $0x1,%edi
lea    0xd75(%rip),%rsi
call   1090 <writestr@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12e1 <handle_command+0x151>
jmp    12c1 <handle_command+0x131>
jmp    12c6 <handle_command+0x136>
jmp    12cb <handle_command+0x13b>
jmp    12d0 <handle_command+0x140>
jmp    12d5 <handle_command+0x145>
jmp    12da <handle_command+0x14a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_command>:
push   %rbx
mov    %rdi,%rbx
lea    0xe65(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1236 <handle_command+0xa6>
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
test   %eax,%eax
je     1241 <handle_command+0xb1>
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
test   %eax,%eax
je     124c <handle_command+0xbc>
lea    0xe33(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
test   %eax,%eax
je     1257 <handle_command+0xc7>
lea    0xe25(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
test   %eax,%eax
je     1262 <handle_command+0xd2>
lea    0xe17(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
test   %eax,%eax
je     126d <handle_command+0xdd>
lea    0xe09(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
test   %eax,%eax
je     1274 <handle_command+0xe4>
lea    0xdfb(%rip),%rsi
mov    $0x1,%edi
call   1090 <writestr@plt>
mov    $0xffffffff,%ebx
jmp    127d <handle_command+0xed>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <cmd_top@plt>
jmp    127d <handle_command+0xed>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <cmd_new@plt>
jmp    127d <handle_command+0xed>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <cmd_del@plt>
jmp    127d <handle_command+0xed>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <cmd_disp@plt>
jmp    127d <handle_command+0xed>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <cmd_next@plt>
jmp    127d <handle_command+0xed>
mov    $0x1,%ebx
jmp    127d <handle_command+0xed>
xor    %ebx,%ebx
xor    %eax,%eax
call   10b0 <cmd_help@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"top\00"
@.str.1 = [4 x i8] c"new\00"
@.str.2 = [4 x i8] c"del\00"
@.str.3 = [5 x i8] c"disp\00"
@.str.4 = [5 x i8] c"next\00"
@.str.5 = [5 x i8] c"quit\00"
@.str.6 = [5 x i8] c"help\00"
@.str.7 = [87 x i8] c"That command is not yet implemented, mein F\C3\BChrer!\0APlease do not feed me to the dogs!\0A\00"
define i32 @handle_command(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 (...) @cmd_top()
br label %52
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = call i32 (...) @cmd_new()
br label %51
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = call i32 (...) @cmd_del()
br label %50
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = call i32 (...) @cmd_disp()
br label %49
27: ; preds = %21
%28 = load i8*, i8** %3
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = call i32 (...) @cmd_next()
br label %48
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %33
store i32 1, i32* %2
br label %53
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = call i32 @strcpy(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = call i32 (...) @cmd_help()
br label %46
44: ; preds = %38
%45 = call i32 @writestr(i32 1, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %2
br label %53
46: ; preds = %42
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47, %31
br label %49
49: ; preds = %48, %25
br label %50
50: ; preds = %49, %19
br label %51
51: ; preds = %50, %13
br label %52
52: ; preds = %51, %7
store i32 0, i32* %2
br label %53
53: ; preds = %52, %44, %37
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
@.str = [4 x i8] c"top\00"
@.str.1 = [4 x i8] c"new\00"
@.str.2 = [4 x i8] c"del\00"
@.str.3 = [5 x i8] c"disp\00"
@.str.4 = [5 x i8] c"next\00"
@.str.5 = [5 x i8] c"quit\00"
@.str.6 = [5 x i8] c"help\00"
@.str.7 = [87 x i8] c"That command is not yet implemented, mein F\C3\BChrer!\0APlease do not feed me to the dogs!\0A\00"
define i32 @handle_command(i8* %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @cmd_top()
br label %36
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (...) @cmd_new()
br label %36
11: ; preds = %6
%12 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 (...) @cmd_del()
br label %36
16: ; preds = %11
%17 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 (...) @cmd_disp()
br label %36
21: ; preds = %16
%22 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 (...) @cmd_next()
br label %36
26: ; preds = %21
%27 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
br i1 %28, label %36, label %29
29: ; preds = %26
%30 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 (...) @cmd_help()
br label %36
34: ; preds = %29
%35 = tail call i32 @writestr(i32 1, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.7, i64 0, i64 0))
br label %36
36: ; preds = %4, %14, %24, %32, %19, %9, %26, %34
%37 = phi i32 [ -1, %34 ], [ 1, %26 ], [ 0, %9 ], [ 0, %19 ], [ 0, %32 ], [ 0, %24 ], [ 0, %14 ], [ 0, %4 ]
ret i32 %37
}