#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*/ putchar(char);
int /*<<< orphan*/ puts(char const *);
char *skipstring(char const *);
void command_echo(char *params) {
  bool sp = false;
  for (const char *p = params; *p; p = skipstring(p)) {
    if (sp)
      putchar(' ');
    sp = true;
    puts(p);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<command_echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     118e <command_echo+0x5e>
cmpl   $0x0,-0xc(%rbp)
je     116c <command_echo+0x3c>
mov    $0x20,%edi
call   1030 <putchar@plt>
movl   $0x1,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1050 <skipstring@plt>
mov    %rax,-0x18(%rbp)
jmp    114b <command_echo+0x1b>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_echo>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1172 <command_echo+0x42>
mov    %rdi,%rbx
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <skipstring@plt>
cmpb   $0x0,(%rax)
je     1172 <command_echo+0x42>
mov    %rax,%rbx
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <skipstring@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
jne    1150 <command_echo+0x20>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @command_echo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @putchar(i8 signext 32)
br label %15
15: ; preds = %13, %10
store i32 1, i32* %3
%16 = load i8*, i8** %4
%17 = call i32 @puts(i8* %16)
br label %18
18: ; preds = %15
%19 = load i8*, i8** %4
%20 = call i8* @skipstring(i8* %19)
store i8* %20, i8** %4
br label %6
21: ; preds = %6
%22 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @command_echo(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* %0)
%6 = tail call i8* @skipstring(i8* %0)
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %11, %4, %1
%10 = tail call i32 @putchar(i8 signext 10)
ret void
11: ; preds = %4, %11
%12 = phi i8* [ %15, %11 ], [ %6, %4 ]
%13 = tail call i32 @putchar(i8 signext 32)
%14 = tail call i32 @puts(i8* %12)
%15 = tail call i8* @skipstring(i8* %12)
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %9, label %11
}