#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*/ execute_command(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int debug = 0;
  int exit_usage = 0;
  if (argc < 2) {
    exit_usage = 1;
  }
  if (argc == 3) {
    if (strcmp(argv[2], "debug") != 0)
      exit_usage = 1;
    else
      debug = 1;
  } else
    debug = 0;
  if (exit_usage) {
    fprintf(stderr, "Usage: exec_cmd.e 'command_and_arguments' [debug]\n");
    exit(1);
  }
  execute_command(argv[1], debug);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1175 <main+0x35>
movl   $0x1,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11b5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11a9 <main+0x69>
movl   $0x1,-0x18(%rbp)
jmp    11b0 <main+0x70>
movl   $0x1,-0x14(%rbp)
jmp    11bc <main+0x7c>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11e5 <main+0xa5>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe30(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1050 <execute_command@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x3,%edi
jne    1174 <main+0x34>
mov    0x10(%rbx),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %esi,%esi
test   %rax,%rax
sete   %cl
cmp    $0x2,%ebp
jl     118d <main+0x4d>
test   %rax,%rax
jne    118d <main+0x4d>
mov    %cl,%sil
jmp    117b <main+0x3b>
xor    %esi,%esi
cmp    $0x1,%ebp
jle    118d <main+0x4d>
mov    0x8(%rbx),%rdi
call   1050 <execute_command@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"debug\00"
@stderr = global i32 0
@.str.1 = [51 x i8] c"Usage: exec_cmd.e 'command_and_arguments' [debug]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %7
br label %11
11: ; preds = %10, %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 1, i32* %7
br label %22
21: ; preds = %14
store i32 1, i32* %6
br label %22
22: ; preds = %21, %20
br label %24
23: ; preds = %11
store i32 0, i32* %6
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %24
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = load i32, i32* %6
%36 = call i32 @execute_command(i8* %34, i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"debug\00"
@stderr = global i32 0
@.str.1 = [51 x i8] c"Usage: exec_cmd.e 'command_and_arguments' [debug]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
%4 = icmp eq i32 %0, 3
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = xor i1 %9, true
%12 = or i1 %3, %11
br i1 %12, label %14, label %18
13: ; preds = %2
br i1 %3, label %14, label %18
14: ; preds = %5, %13
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %5, %13
%19 = phi i32 [ %10, %5 ], [ 0, %13 ]
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32 @execute_command(i8* %21, i32 %19)
ret i32 0
}