#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 */
char *block();
scalar_t__ check_if_block(char *);
scalar_t__ check_if_list(char *);
scalar_t__ check_if_ping(char *);
scalar_t__ check_if_stop(char *);
scalar_t__ check_if_trace(char *);
int /*<<< orphan*/ kill_daemon();
char *list();
char *pong();
char *trace();
char *run_command(char *cmd) {
  char *r = NULL;
  if (cmd) {
    if (check_if_stop(cmd))
      kill_daemon();
    if (check_if_ping(cmd))
      r = pong();
    if (check_if_list(cmd))
      r = list();
    if (check_if_block(cmd))
      r = block();
    if (check_if_trace(cmd))
      r = trace();
  }
  return r;
}


x86 assembly (clang, -O0):
<run_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1256 <run_command+0xb6>
mov    -0x8(%rbp),%rdi
call   1080 <check_if_stop@plt>
cmp    $0x0,%rax
je     11d9 <run_command+0x39>
mov    $0x0,%al
call   1050 <kill_daemon@plt>
mov    -0x8(%rbp),%rdi
call   10c0 <check_if_ping@plt>
cmp    $0x0,%rax
je     11f7 <run_command+0x57>
mov    $0x0,%al
call   1040 <pong@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <check_if_list@plt>
cmp    $0x0,%rax
je     1215 <run_command+0x75>
mov    $0x0,%al
call   1070 <list@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <check_if_block@plt>
cmp    $0x0,%rax
je     1233 <run_command+0x93>
mov    $0x0,%al
call   1090 <block@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <check_if_trace@plt>
cmp    $0x0,%rax
je     1251 <run_command+0xb1>
mov    $0x0,%al
call   10a0 <trace@plt>
mov    %rax,-0x10(%rbp)
jmp    1256 <run_command+0xb6>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_command>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11d6 <run_command+0x36>
mov    %rdi,%rbx
call   1080 <check_if_stop@plt>
test   %rax,%rax
je     11bd <run_command+0x1d>
xor    %eax,%eax
call   1050 <kill_daemon@plt>
mov    %rbx,%rdi
call   10c0 <check_if_ping@plt>
test   %rax,%rax
je     11db <run_command+0x3b>
xor    %eax,%eax
call   1040 <pong@plt>
mov    %rax,%r14
jmp    11de <run_command+0x3e>
xor    %r14d,%r14d
jmp    1227 <run_command+0x87>
xor    %r14d,%r14d
mov    %rbx,%rdi
call   1030 <check_if_list@plt>
test   %rax,%rax
je     11f5 <run_command+0x55>
xor    %eax,%eax
call   1070 <list@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   10b0 <check_if_block@plt>
test   %rax,%rax
je     120c <run_command+0x6c>
xor    %eax,%eax
call   1090 <block@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1060 <check_if_trace@plt>
test   %rax,%rax
je     1227 <run_command+0x87>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    10a0 <trace@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @run_command(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %37
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i64 @check_if_stop(i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 (...) @kill_daemon()
br label %12
12: ; preds = %10, %6
%13 = load i8*, i8** %2
%14 = call i64 @check_if_ping(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i8* (...) @pong()
store i8* %17, i8** %3
br label %18
18: ; preds = %16, %12
%19 = load i8*, i8** %2
%20 = call i64 @check_if_list(i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i8* (...) @list()
store i8* %23, i8** %3
br label %24
24: ; preds = %22, %18
%25 = load i8*, i8** %2
%26 = call i64 @check_if_block(i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i8* (...) @block()
store i8* %29, i8** %3
br label %30
30: ; preds = %28, %24
%31 = load i8*, i8** %2
%32 = call i64 @check_if_trace(i8* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i8* (...) @trace()
store i8* %35, i8** %3
br label %36
36: ; preds = %34, %30
br label %37
37: ; preds = %36, %1
%38 = load i8*, i8** %3
ret i8* %38
}

LLVM IR (-O2):
define i8* @run_command(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %31, label %3
3: ; preds = %1
%4 = tail call i64 @check_if_stop(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (...) @kill_daemon()
br label %8
8: ; preds = %6, %3
%9 = tail call i64 @check_if_ping(i8* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i8* (...) @pong()
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %12, %11 ], [ null, %8 ]
%15 = tail call i64 @check_if_list(i8* %0)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i8* (...) @list()
br label %19
19: ; preds = %17, %13
%20 = phi i8* [ %18, %17 ], [ %14, %13 ]
%21 = tail call i64 @check_if_block(i8* %0)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = tail call i8* (...) @block()
br label %25
25: ; preds = %23, %19
%26 = phi i8* [ %24, %23 ], [ %20, %19 ]
%27 = tail call i64 @check_if_trace(i8* %0)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = tail call i8* (...) @trace()
br label %31
31: ; preds = %25, %29, %1
%32 = phi i8* [ %30, %29 ], [ %26, %25 ], [ null, %1 ]
ret i8* %32
}