#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*/ Cbuf_AddText(char *);
int Cmd_Argc();
int /*<<< orphan*/ Cmd_Argv(int);
char *va(char *, int /*<<< orphan*/);
void Cmd_Echo_f(void) {
  int i;
  Cbuf_AddText("cpm \"");
  for (i = 1; i < Cmd_Argc(); i++) {
    Cbuf_AddText(va("%s ", Cmd_Argv(i)));
  }
  Cbuf_AddText("\"\n");
}


x86 assembly (clang, -O0):
<Cmd_Echo_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <Cbuf_AddText@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <Cmd_Argc@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
jge    11a1 <Cmd_Echo_f+0x61>
mov    -0x4(%rbp),%edi
call   1050 <Cmd_Argv@plt>
mov    %eax,%esi
lea    0xe80(%rip),%rdi
call   1060 <va@plt>
mov    %rax,%rdi
call   1030 <Cbuf_AddText@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <Cmd_Echo_f+0x1b>
lea    0xe62(%rip),%rdi
call   1030 <Cbuf_AddText@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cmd_Echo_f>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
call   1030 <Cbuf_AddText@plt>
xor    %eax,%eax
call   1040 <Cmd_Argc@plt>
cmp    $0x2,%eax
jl     1197 <Cmd_Echo_f+0x57>
mov    $0x1,%ebx
lea    0xe9e(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1050 <Cmd_Argv@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <va@plt>
mov    %rax,%rdi
call   1030 <Cbuf_AddText@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <Cmd_Argc@plt>
cmp    %eax,%ebx
jl     1170 <Cmd_Echo_f+0x30>
lea    0xe6c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <Cbuf_AddText@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"cpm \22\00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [3 x i8] c"\22\0A\00"
define void @Cmd_Echo_f() {
%1 = alloca i32
%2 = call i32 @Cbuf_AddText(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %1
%5 = call i32 (...) @Cmd_Argc()
%6 = icmp slt i32 %4, %5
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = load i32, i32* %1
%9 = call i32 @Cmd_Argv(i32 %8)
%10 = call i8* @va(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @Cbuf_AddText(i8* %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %3
15: ; preds = %3
%16 = call i32 @Cbuf_AddText(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cpm \22\00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [3 x i8] c"\22\0A\00"
define void @Cmd_Echo_f() {
%1 = tail call i32 @Cbuf_AddText(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @Cmd_Argc()
%3 = icmp sgt i32 %2, 1
br i1 %3, label %4, label %12
4: ; preds = %0, %4
%5 = phi i32 [ %9, %4 ], [ 1, %0 ]
%6 = tail call i32 @Cmd_Argv(i32 %5)
%7 = tail call i8* @va(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @Cbuf_AddText(i8* %7)
%9 = add nuw nsw i32 %5, 1
%10 = tail call i32 (...) @Cmd_Argc()
%11 = icmp slt i32 %9, %10
br i1 %11, label %4, label %12
12: ; preds = %4, %0
%13 = tail call i32 @Cbuf_AddText(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}