#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*/ execvp(char *, char **);
int /*<<< orphan*/ strdup(char const *);
char *strtok(int /*<<< orphan*/, char *);
void exec_simple_command(const char *command) {
  char *av[1024];
  int ac = 0;
  char *token = strtok(strdup(command), " \t");
  while (token) {
    av[ac++] = token;
    token = strtok(0, " \t");
  }
  av[ac] = 0;
  execvp(av[0], av);
}


x86 assembly (clang, -O0):
<exec_simple_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x2014(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %eax,%edi
lea    0xea5(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x2020(%rbp)
cmpq   $0x0,-0x2020(%rbp)
je     11b1 <exec_simple_command+0x81>
mov    -0x2020(%rbp),%rcx
mov    -0x2014(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x2014(%rbp)
cltq
mov    %rcx,-0x2010(%rbp,%rax,8)
ff
xor    %edi,%edi
lea    0xe60(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x2020(%rbp)
jmp    1167 <exec_simple_command+0x37>
movslq -0x2014(%rbp),%rax
movq   $0x0,-0x2010(%rbp,%rax,8)
mov    -0x2010(%rbp),%rdi
lea    -0x2010(%rbp),%rsi
call   1040 <execvp@plt>
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec_simple_command>:
push   %r14
push   %rbx
sub    $0x2008,%rsp
call   1050 <strdup@plt>
lea    0xeba(%rip),%rsi
mov    %eax,%edi
call   1030 <strtok@plt>
test   %rax,%rax
je     117b <exec_simple_command+0x4b>
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %rax,(%rsp,%rbx,8)
add    $0x1,%rbx
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
test   %rax,%rax
jne    1160 <exec_simple_command+0x30>
mov    %ebx,%eax
jmp    117d <exec_simple_command+0x4d>
xor    %eax,%eax
movq   $0x0,(%rsp,%rax,8)
mov    (%rsp),%rdi
mov    %rsp,%rsi
call   1040 <execvp@plt>
add    $0x2008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
define void @exec_simple_command(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8*]
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @strdup(i8* %6)
%8 = call i8* @strtok(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %5
br label %9
9: ; preds = %12, %1
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i8*, i8** %5
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 %16
store i8* %13, i8** %17
%18 = call i8* @strtok(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %18, i8** %5
br label %9
19: ; preds = %9
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 %21
store i8* null, i8** %22
%23 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%24 = load i8*, i8** %23
%25 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%26 = call i32 @execvp(i8* %24, i8** %25)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
define void @exec_simple_command(i8* %0) {
%2 = alloca [1024 x i8*]
%3 = bitcast [1024 x i8*]* %2 to i8*
%4 = tail call i32 @strdup(i8* %0)
%5 = tail call i8* @strtok(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %16, label %7
7: ; preds = %1, %7
%8 = phi i64 [ %10, %7 ], [ 0, %1 ]
%9 = phi i8* [ %12, %7 ], [ %5, %1 ]
%10 = add nuw i64 %8, 1
%11 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %2, i64 0, i64 %8
store i8* %9, i8** %11
%12 = tail call i8* @strtok(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %7
14: ; preds = %7
%15 = and i64 %10, 4294967295
br label %16
16: ; preds = %14, %1
%17 = phi i64 [ 0, %1 ], [ %15, %14 ]
%18 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %2, i64 0, i64 %17
store i8* null, i8** %18
%19 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %2, i64 0, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @execvp(i8* %20, i8** %19)
ret void
}