char *nextword(wp, wbuf)
char wp[], wbuf[];
{
  register char *cp, *cp2;
  if ((cp = wp) == ((char *)0)) {
    copy("", wbuf);
    return (((char *)0));
  }
  cp2 = wbuf;
  while (!any(*cp, " \t") && *cp != '\0')
    *cp2++ = *cp++;
  *cp2 = '\0';
  while (any(*cp, " \t"))
    cp++;
  if (*cp == '\0')
    return (((char *)0));
  return (cp);
}


x86 assembly (clang, -O0):
<nextword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1161 <nextword+0x41>
mov    -0x18(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <copy@plt>
movq   $0x0,-0x8(%rbp)
jmp    1230 <nextword+0x110>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <any@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x29(%rbp)
jne    119e <nextword+0x7e>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11ae <nextword+0x8e>
jmp    11d5 <nextword+0xb5>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1169 <nextword+0x49>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1040 <any@plt>
cmp    $0x0,%eax
je     120b <nextword+0xeb>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11dc <nextword+0xbc>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1228 <nextword+0x108>
movq   $0x0,-0x8(%rbp)
jmp    1230 <nextword+0x110>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextword>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %rdi,%rdi
je     11b2 <nextword+0x92>
mov    %rdi,%rbx
movsbl (%rdi),%edi
lea    0xec2(%rip),%rsi
xor    %eax,%eax
call   1040 <any@plt>
test   %eax,%eax
jne    1174 <nextword+0x54>
lea    0xeb0(%rip),%r15
movzbl (%rbx),%eax
test   %al,%al
je     1174 <nextword+0x54>
mov    %al,(%r14)
add    $0x1,%r14
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <any@plt>
test   %eax,%eax
je     1150 <nextword+0x30>
movb   $0x0,(%r14)
add    $0xffffffffffffffff,%rbx
lea    0xe7d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <any@plt>
test   %eax,%eax
jne    1190 <nextword+0x70>
xor    %r15d,%r15d
cmpb   $0x0,(%rbx)
cmovne %rbx,%r15
jmp    11c6 <nextword+0xa6>
lea    0xe49(%rip),%rdi
xor    %r15d,%r15d
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <copy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c" \09\00"
define i8* @nextword(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @copy to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %11)
store i8* null, i8** %3
br label %53
13: ; preds = %2
%14 = load i8*, i8** %5
store i8* %14, i8** %7
br label %15
15: ; preds = %28, %13
%16 = load i8*, i8** %6
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @any to i32 (i32, i8*, ...)*)(i32 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %15
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br label %26
26: ; preds = %21, %15
%27 = phi i1 [ false, %15 ], [ %25, %21 ]
br i1 %27, label %28, label %34
28: ; preds = %26
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %6
%31 = load i8, i8* %29
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %7
store i8 %31, i8* %32
br label %15
34: ; preds = %26
%35 = load i8*, i8** %7
store i8 0, i8* %35
br label %36
36: ; preds = %42, %34
%37 = load i8*, i8** %6
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @any to i32 (i32, i8*, ...)*)(i32 %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %36
%43 = load i8*, i8** %6
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %6
br label %36
45: ; preds = %36
%46 = load i8*, i8** %6
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %45
store i8* null, i8** %3
br label %53
51: ; preds = %45
%52 = load i8*, i8** %6
store i8* %52, i8** %3
br label %53
53: ; preds = %51, %50, %10
%54 = load i8*, i8** %3
ret i8* %54
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c" \09\00"
define i8* @nextword(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @any to i32 (i32, i8*, ...)*)(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %23
9: ; preds = %2
%10 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @copy to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %37
11: ; preds = %4, %16
%12 = phi i8* [ %18, %16 ], [ %1, %4 ]
%13 = phi i8* [ %17, %16 ], [ %0, %4 ]
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %11
%17 = getelementptr inbounds i8, i8* %13, i64 1
%18 = getelementptr inbounds i8, i8* %12, i64 1
store i8 %14, i8* %12
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @any to i32 (i32, i8*, ...)*)(i32 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %11, label %23
23: ; preds = %11, %16, %4
%24 = phi i8* [ %0, %4 ], [ %17, %16 ], [ %13, %11 ]
%25 = phi i8* [ %1, %4 ], [ %18, %16 ], [ %12, %11 ]
store i8 0, i8* %25
br label %26
26: ; preds = %26, %23
%27 = phi i8* [ %24, %23 ], [ %32, %26 ]
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @any to i32 (i32, i8*, ...)*)(i32 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
%32 = getelementptr inbounds i8, i8* %27, i64 1
br i1 %31, label %33, label %26
33: ; preds = %26
%34 = load i8, i8* %27
%35 = icmp eq i8 %34, 0
%36 = select i1 %35, i8* null, i8* %27
br label %37
37: ; preds = %33, %9
%38 = phi i8* [ null, %9 ], [ %36, %33 ]
ret i8* %38
}