#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 do_control_command(char **);
int execute(char **);
scalar_t__ is_control_command(char *);
scalar_t__ ok_to_execute();
int process(char **args) {
  int rv = 0;
  if (args[0] == NULL) {
    rv = 0;
  } else if (is_control_command(args[0])) {
    rv = do_control_command(args);
  } else if (ok_to_execute()) {
    rv = execute(args);
  }
  return rv;
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    116d <process+0x2d>
movl   $0x0,-0xc(%rbp)
jmp    11bb <process+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <is_control_command@plt>
cmp    $0x0,%rax
je     1194 <process+0x54>
mov    -0x8(%rbp),%rdi
call   1060 <do_control_command@plt>
mov    %eax,-0xc(%rbp)
jmp    11b6 <process+0x76>
mov    $0x0,%al
call   1040 <ok_to_execute@plt>
cmp    $0x0,%rax
je     11b1 <process+0x71>
mov    -0x8(%rbp),%rdi
call   1050 <execute@plt>
mov    %eax,-0xc(%rbp)
jmp    11b6 <process+0x76>
jmp    11bb <process+0x7b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1174 <process+0x34>
call   1030 <is_control_command@plt>
test   %rax,%rax
je     115f <process+0x1f>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <do_control_command@plt>
xor    %eax,%eax
call   1040 <ok_to_execute@plt>
test   %rax,%rax
je     1174 <process+0x34>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <execute@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @process(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %3
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 = call i64 @is_control_command(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i8**, i8*** %2
%17 = call i32 @do_control_command(i8** %16)
store i32 %17, i32* %3
br label %25
18: ; preds = %9
%19 = call i64 (...) @ok_to_execute()
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i8**, i8*** %2
%23 = call i32 @execute(i8** %22)
store i32 %23, i32* %3
br label %24
24: ; preds = %21, %18
br label %25
25: ; preds = %24, %15
br label %26
26: ; preds = %25, %8
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @process(i8** %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i64 @is_control_command(i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @do_control_command(i8** %0)
br label %14
9: ; preds = %4
%10 = tail call i64 (...) @ok_to_execute()
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @execute(i8** %0)
br label %14
14: ; preds = %1, %7, %12, %9
%15 = phi i32 [ %8, %7 ], [ %13, %12 ], [ 0, %9 ], [ 0, %1 ]
ret i32 %15
}