#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*/ STDOUT_FILENO;
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int strlen(char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void display_command(char **command) {
  char *token = NULL;
  int i = 0;
  char *cmdLine = malloc(514 * sizeof(char));
  cmdLine[0] = '\0';
  do {
    token = command[i++];
    if (token) {
      sprintf(cmdLine + strlen(cmdLine), "%s", token);
      if (command[i])
        sprintf(cmdLine + strlen(cmdLine), " ");
    }
  } while (token != NULL);
  if (strlen(cmdLine) > 0) {
    sprintf(cmdLine + strlen(cmdLine), "\n");
    write(STDOUT_FILENO, cmdLine, strlen(cmdLine));
  }
  free(cmdLine);
}


x86 assembly (clang, -O0):
<display_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x202,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1211 <display_command+0xc1>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     120c <display_command+0xbc>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x30(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
jmp    1211 <display_command+0xc1>
jmp    1216 <display_command+0xc6>
cmpq   $0x0,-0x10(%rbp)
jne    1180 <display_command+0x30>
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jle    1286 <display_command+0x136>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x48(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xdb1(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_command>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0x202,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
movb   $0x0,(%rax)
mov    (%rbx),%r15
test   %r15,%r15
je     11b9 <display_command+0x69>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdi
add    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
cmpq   $0x0,(%rbx)
je     11b9 <display_command+0x69>
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
movw   $0x20,(%r14,%rax,1)
mov    (%rbx),%r15
add    $0x8,%rbx
test   %r15,%r15
jne    1180 <display_command+0x30>
mov    %r14,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    11f3 <display_command+0xa3>
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
movw   $0xa,(%r14,%rax,1)
mov    0x2e13(%rip),%rax
mov    (%rax),%ebx
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1050 <write@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
@STDOUT_FILENO = global i32 0
define void @display_command(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8** %0, i8*** %2
store i8* null, i8** %3
store i32 0, i32* %4
%6 = call i8* @malloc(i32 514)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 0, i8* %8
br label %9
9: ; preds = %41, %1
%10 = load i8**, i8*** %2
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds i8*, i8** %10, i64 %13
%15 = load i8*, i8** %14
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %40
18: ; preds = %9
%19 = load i8*, i8** %5
%20 = load i8*, i8** %5
%21 = call i32 @strlen(i8* %20)
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8*, i8** %3
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = load i8**, i8*** %2
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %39
32: ; preds = %18
%33 = load i8*, i8** %5
%34 = load i8*, i8** %5
%35 = call i32 @strlen(i8* %34)
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = call i32 (i8*, i8*, ...) @sprintf(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %39
39: ; preds = %32, %18
br label %40
40: ; preds = %39, %9
br label %41
41: ; preds = %40
%42 = load i8*, i8** %3
%43 = icmp ne i8* %42, null
br i1 %43, label %9, label %44
44: ; preds = %41
%45 = load i8*, i8** %5
%46 = call i32 @strlen(i8* %45)
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %60
48: ; preds = %44
%49 = load i8*, i8** %5
%50 = load i8*, i8** %5
%51 = call i32 @strlen(i8* %50)
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %49, i64 %52
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%55 = load i32, i32* @STDOUT_FILENO
%56 = load i8*, i8** %5
%57 = load i8*, i8** %5
%58 = call i32 @strlen(i8* %57)
%59 = call i32 @write(i32 %55, i8* %56, i32 %58)
br label %60
60: ; preds = %48, %44
%61 = load i8*, i8** %5
%62 = call i32 @free(i8* %61)
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
define void @display_command(i8** nocapture %0) {
%2 = tail call dereferenceable_or_null(514) i8* @malloc(i32 514)
store i8 0, i8* %2
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %23, label %5
5: ; preds = %1, %15
%6 = phi i64 [ %21, %15 ], [ 1, %1 ]
%7 = phi i8* [ %20, %15 ], [ %3, %1 ]
%8 = tail call i32 @strlen(i8* %2)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %2, i64 %9
%11 = tail call i8* @strcpy(i8* %10, i8* %7)
%12 = getelementptr inbounds i8*, i8** %0, i64 %6
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %23, label %15
15: ; preds = %5
%16 = tail call i32 @strlen(i8* %2)
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %2, i64 %17
%19 = bitcast i8* %18 to i16*
store i16 32, i16* %19
%20 = load i8*, i8** %12
%21 = add nuw i64 %6, 1
%22 = icmp eq i8* %20, null
br i1 %22, label %23, label %5
23: ; preds = %5, %15, %1
%24 = tail call i32 @strlen(i8* %2)
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = tail call i32 @strlen(i8* %2)
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %2, i64 %28
%30 = bitcast i8* %29 to i16*
store i16 10, i16* %30
%31 = load i32, i32* @STDOUT_FILENO
%32 = tail call i32 @strlen(i8* %2)
%33 = tail call i32 @write(i32 %31, i8* %2, i32 %32)
br label %34
34: ; preds = %26, %23
%35 = tail call i32 @free(i8* %2)
ret void
}