#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*/ printf(char *, ...);
char *tokquote(char *, char *);
void test(char *s) {
  char *cp = tokquote(s, " ");
  while (cp) {
    printf("%s...", cp);
    cp = tokquote(NULL, " ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <tokquote@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1176 <test+0x56>
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe98(%rip),%rsi
call   1040 <tokquote@plt>
mov    %rax,-0x10(%rbp)
jmp    1140 <test+0x20>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rsi
call   1050 <tokquote@plt>
test   %rax,%rax
je     117c <test+0x4c>
lea    0xeb6(%rip),%r14
lea    0xead(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <tokquote@plt>
test   %rax,%rax
jne    1160 <test+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [6 x i8] c"%s...\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @test(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @tokquote(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
br label %6
6: ; preds = %9, %1
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i8* @tokquote(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %3
br label %6
13: ; preds = %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [6 x i8] c"%s...\00"
define void @test(i8* %0) {
%2 = tail call i8* @tokquote(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %2, %1 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = tail call i8* @tokquote(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %4
9: ; preds = %4, %1
%10 = tail call i32 @putchar(i32 10)
ret void
}