#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*/ assert(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *const);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ tmfprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ tmfputs(char *, int /*<<< orphan*/ *);
void printcmdln(FILE *stream, const char *msg, int argc, char *const argv[]) {
  int i = 0;
  assert(stream);
  if (msg)
    (void)tmfprintf(stream, "%s: ", msg);
  else
    (void)tmfputs("", stream);
  for (i = 0; i < argc; ++i)
    (void)fprintf(stream, "%s ", argv[i]);
  (void)fputc('\n', stream);
}


x86 assembly (clang, -O0):
<printcmdln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
je     119b <printcmdln+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe6f(%rip),%rsi
call   1070 <tmfprintf@plt>
jmp    11ab <printcmdln+0x5b>
mov    -0x8(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1030 <tmfputs@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e8 <printcmdln+0x98>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe30(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b2 <printcmdln+0x62>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1040 <fputc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printcmdln>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %rdi,%r12
call   1050 <assert@plt>
test   %rbp,%rbp
je     1187 <printcmdln+0x37>
lea    0xe8b(%rip),%rsi
mov    %r12,%rdi
mov    %rbp,%rdx
call   1070 <tmfprintf@plt>
test   %r15d,%r15d
jg     119b <printcmdln+0x4b>
jmp    11c8 <printcmdln+0x78>
lea    0xe76(%rip),%rdi
mov    %r12,%rsi
call   1030 <tmfputs@plt>
test   %r15d,%r15d
jle    11c8 <printcmdln+0x78>
mov    %r15d,%ebp
xor    %ebx,%ebx
lea    0xe5e(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <printcmdln+0x60>
mov    $0xa,%edi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"%s \00"
define void @printcmdln(i32* %0, i8* %1, i32 %2, i8** %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
store i32 0, i32* %9
%10 = load i32*, i32** %5
%11 = call i32 @assert(i32* %10)
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load i32*, i32** %5
%16 = load i8*, i8** %6
%17 = call i32 @tmfprintf(i32* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %21
18: ; preds = %4
%19 = load i32*, i32** %5
%20 = call i32 @tmfputs(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %18, %14
store i32 0, i32* %9
br label %22
22: ; preds = %34, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %7
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = load i32*, i32** %5
%28 = load i8**, i8*** %8
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %26
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %22
37: ; preds = %22
%38 = load i32*, i32** %5
%39 = call i32 @fputc(i8 signext 10, i32* %38)
ret void
}

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