#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void print_command_line(FILE *file, int argc, char *argv[]) {
  fprintf(file, "// command line: ");
  for (int i = 0; i < argc; i++)
    fprintf(file, "%s ", argv[i]);
  fprintf(file, "\n");
}


x86 assembly (clang, -O0):
<print_command_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1174 <print_command_line+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <print_command_line+0x2c>
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_command_line>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r12
lea    0xeb9(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
test   %ebp,%ebp
jle    118a <print_command_line+0x5a>
mov    %ebp,%ebp
lea    0xeac(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <print_command_line+0x40>
mov    $0xa,%edi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"// command line: \00"
@.str.1 = [4 x i8] c"%s \00"
define void @print_command_line(i32* nocapture %0, i32 %1, i8** nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 17, i64 1, i32* %0)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %10
8: ; preds = %10, %3
%9 = tail call i32 @fputc(i32 10, i32* %0)
ret void
10: ; preds = %6, %10
%11 = phi i64 [ 0, %6 ], [ %15, %10 ]
%12 = getelementptr inbounds i8*, i8** %2, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %7
br i1 %16, label %8, label %10
}