#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
char *strpbrk(char *, char *);
void print_cmdline(int argc, char **argv) {
  FILE *fp = stderr;
  int i;
  fputs("command: ", fp);
  for (i = 0; i < argc; i++) {
    char *spc = strpbrk(argv[i], " \t\r\n");
    if (spc) {
      fputc('\'', fp);
    }
    fputs(argv[i], fp);
    if (spc) {
      fputc('\'', fp);
    }
    if (i < argc - 1) {
      fputc(' ', fp);
    }
  }
  fputc('\n', fp);
  fflush(fp);
}


x86 assembly (clang, -O0):
<print_cmdline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1215 <print_cmdline+0xd5>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe77(%rip),%rsi
call   1060 <strpbrk@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11b5 <print_cmdline+0x75>
mov    -0x18(%rbp),%rsi
mov    $0x27,%edi
call   1040 <fputc@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fputs@plt>
cmpq   $0x0,-0x28(%rbp)
je     11e3 <print_cmdline+0xa3>
mov    -0x18(%rbp),%rsi
mov    $0x27,%edi
call   1040 <fputc@plt>
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1202 <print_cmdline+0xc2>
mov    -0x18(%rbp),%rsi
mov    $0x20,%edi
call   1040 <fputc@plt>
jmp    1207 <print_cmdline+0xc7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <print_cmdline+0x34>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fflush@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cmdline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
mov    0x2e78(%rip),%rax
mov    (%rax),%r12
lea    0xe8e(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1070 <fwrite@plt>
test   %r15d,%r15d
jle    120f <print_cmdline+0xbf>
lea    -0x1(%r15),%r13d
mov    %r15d,%ebp
xor    %r15d,%r15d
jmp    11a9 <print_cmdline+0x59>
nopl   0x0(%rax)
add    $0x1,%r15
cmp    %r15,%rbp
je     120f <print_cmdline+0xbf>
mov    (%r14,%r15,8),%rbx
mov    %rbx,%rdi
lea    0xe53(%rip),%rsi
call   1060 <strpbrk@plt>
test   %rax,%rax
je     11f0 <print_cmdline+0xa0>
mov    $0x27,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
mov    (%r14,%r15,8),%rdi
mov    %r12,%rsi
call   1030 <fputs@plt>
mov    $0x27,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    %r13,%r15
jae    11a0 <print_cmdline+0x50>
jmp    1200 <print_cmdline+0xb0>
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <fputs@plt>
cmp    %r13,%r15
jae    11a0 <print_cmdline+0x50>
mov    $0x20,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
jmp    11a0 <print_cmdline+0x50>
mov    $0xa,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32* null
@.str = [10 x i8] c"command: \00"
@.str.1 = [5 x i8] c" \09\0D\0A\00"
define void @print_cmdline(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = load i32*, i32** @stderr
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %9)
store i32 0, i32* %6
br label %11
11: ; preds = %49, %2
%12 = load i32, i32* %6
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %52
15: ; preds = %11
%16 = load i8**, i8*** %4
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i8* @strpbrk(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %15
%25 = load i32*, i32** %5
%26 = call i32 @fputc(i8 signext 39, i32* %25)
br label %27
27: ; preds = %24, %15
%28 = load i8**, i8*** %4
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = load i32*, i32** %5
%34 = call i32 @fputs(i8* %32, i32* %33)
%35 = load i8*, i8** %7
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %40
37: ; preds = %27
%38 = load i32*, i32** %5
%39 = call i32 @fputc(i8 signext 39, i32* %38)
br label %40
40: ; preds = %37, %27
%41 = load i32, i32* %6
%42 = load i32, i32* %3
%43 = sub nsw i32 %42, 1
%44 = icmp slt i32 %41, %43
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = load i32*, i32** %5
%47 = call i32 @fputc(i8 signext 32, i32* %46)
br label %48
48: ; preds = %45, %40
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %11
52: ; preds = %11
%53 = load i32*, i32** %5
%54 = call i32 @fputc(i8 signext 10, i32* %53)
%55 = load i32*, i32** %5
%56 = call i32 @fflush(i32* %55)
ret void
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [10 x i8] c"command: \00"
@.str.1 = [5 x i8] c" \09\0D\0A\00"
define void @print_cmdline(i32 %0, i8** nocapture %1) {
%3 = load i32*, i32** @stderr
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 9, i64 1, i32* %3)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %30
6: ; preds = %2
%7 = add nsw i32 %0, -1
%8 = zext i32 %7 to i64
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %6, %27
%11 = phi i64 [ 0, %6 ], [ %28, %27 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i8* @strpbrk(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %21, label %16
16: ; preds = %10
%17 = tail call i32 @fputc(i8 signext 39, i32* %3)
%18 = load i8*, i8** %12
%19 = tail call i32 @fputs(i8* %18, i32* %3)
%20 = tail call i32 @fputc(i8 signext 39, i32* %3)
br label %23
21: ; preds = %10
%22 = tail call i32 @fputs(i8* %13, i32* %3)
br label %23
23: ; preds = %21, %16
%24 = icmp ult i64 %11, %8
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = tail call i32 @fputc(i8 signext 32, i32* %3)
br label %27
27: ; preds = %25, %23
%28 = add nuw nsw i64 %11, 1
%29 = icmp eq i64 %28, %9
br i1 %29, label %30, label %10
30: ; preds = %27, %2
%31 = tail call i32 @fputc(i8 signext 10, i32* %3)
%32 = tail call i32 @fflush(i32* %3)
ret void
}