#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*/ printf(char *, ...);
void bfdutil_dumpcmd(char *pre, char *argv[]) {
  int i;
  if (pre)
    printf("%s> ", pre);
  printf("CMD: ", pre);
  for (i = 0; argv[i]; i++)
    printf("%s ", argv[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<bfdutil_dumpcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113d <bfdutil_dumpcmd+0x2d>
mov    -0x8(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1191 <bfdutil_dumpcmd+0x81>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <bfdutil_dumpcmd+0x46>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bfdutil_dumpcmd>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rdi,%rdi
je     1140 <bfdutil_dumpcmd+0x20>
lea    0xeca(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1186 <bfdutil_dumpcmd+0x66>
add    $0x8,%rbx
lea    0xea7(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1170 <bfdutil_dumpcmd+0x50>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s> \00"
@.str.1 = [6 x i8] c"CMD: \00"
@.str.2 = [4 x i8] c"%s \00"
define void @bfdutil_dumpcmd(i8* %0, i8** nocapture %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%8 = load i8*, i8** %1
%9 = icmp eq i8* %8, null
br i1 %9, label %18, label %10
10: ; preds = %6, %10
%11 = phi i64 [ %14, %10 ], [ 0, %6 ]
%12 = phi i8* [ %16, %10 ], [ %8, %6 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = add nuw i64 %11, 1
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %10
18: ; preds = %10, %6
%19 = tail call i32 @putchar(i32 10)
ret void
}