#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 */
char *find_next(char *, char *, int);
void do_words(char *str, char *seps, void *data, void (*f)()) {
  char *next;
  while (*str != '\0') {
    str = find_next(str, seps, 1);
    if (*str != '\0') {
      next = find_next(str, seps, 0);
      f(data, str, next);
      str = next;
    }
  }
}


x86 assembly (clang, -O0):
<do_words>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1192 <do_words+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <find_next@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118d <do_words+0x7d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <find_next@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x0,%al
call   *%rcx
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1128 <do_words+0x18>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_words>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmpb   $0x0,(%rdi)
je     116d <do_words+0x5d>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r12,%rsi
mov    $0x1,%edx
call   1030 <find_next@plt>
cmpb   $0x0,(%rax)
je     116d <do_words+0x5d>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <find_next@plt>
mov    %rax,%r13
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   *%r14
cmpb   $0x0,0x0(%r13)
jne    1130 <do_words+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @do_words(i8* %0, i8* %1, i8* %2, void (...)* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca void (...)*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store void (...)* %3, void (...)** %8
br label %10
10: ; preds = %33, %4
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %34
15: ; preds = %10
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i8* @find_next(i8* %16, i8* %17, i32 1)
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %33
23: ; preds = %15
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = call i8* @find_next(i8* %24, i8* %25, i32 0)
store i8* %26, i8** %9
%27 = load void (...)*, void (...)** %8
%28 = load i8*, i8** %7
%29 = load i8*, i8** %5
%30 = load i8*, i8** %9
%31 = bitcast void (...)* %27 to void (i8*, i8*, i8*, ...)*
%32 = load i8*, i8** %9
store i8* %32, i8** %5
br label %33
33: ; preds = %23, %15
br label %10
34: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @do_words(i8* %0, i8* %1, i8* %2, void (...)* nocapture %3) {
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %4
%8 = bitcast void (...)* %3 to void (i8*, i8*, i8*, ...)*
br label %9
9: ; preds = %7, %14
%10 = phi i8* [ %0, %7 ], [ %15, %14 ]
%11 = tail call i8* @find_next(i8* %10, i8* %1, i32 1)
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = tail call i8* @find_next(i8* %11, i8* %1, i32 0)
tail call void (i8*, i8*, i8*, ...) %8(i8* %2, i8* %11, i8* %15)
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %14, %4
ret void
}