#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 */
typedef int /*<<< orphan*/ ptrdiff_t;

/* Variables and functions */
int /*<<< orphan*/ iswordbreak(char const);
const char *goto_nextstop(const char *p, ptrdiff_t rem) {
  const char *q = p;
  while (q < p + rem && !iswordbreak(*q)) {
    q++;
  }
  return q;
}


x86 assembly (clang, -O0):
<goto_nextstop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rdx
movslq -0xc(%rbp),%rax
add    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x19(%rbp)
jae    115b <goto_nextstop+0x4b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <iswordbreak@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    116b <goto_nextstop+0x5b>
jmp    117c <goto_nextstop+0x6c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1127 <goto_nextstop+0x17>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<goto_nextstop>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
jle    1145 <goto_nextstop+0x35>
movslq %esi,%r14
add    %rbx,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <iswordbreak@plt>
test   %eax,%eax
jne    1145 <goto_nextstop+0x35>
add    $0x1,%rbx
cmp    %r14,%rbx
jb     1130 <goto_nextstop+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @goto_nextstop(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %22, %2
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = icmp ult i8* %8, %12
br i1 %13, label %14, label %20
14: ; preds = %7
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = call i32 @iswordbreak(i8 signext %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br label %20
20: ; preds = %14, %7
%21 = phi i1 [ false, %7 ], [ %19, %14 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
br label %7
25: ; preds = %20
%26 = load i8*, i8** %5
ret i8* %26
}

LLVM IR (-O2):
define i8* @goto_nextstop(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %14
6: ; preds = %2, %11
%7 = phi i8* [ %12, %11 ], [ %0, %2 ]
%8 = load i8, i8* %7
%9 = tail call i32 @iswordbreak(i8 signext %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = icmp ult i8* %12, %4
br i1 %13, label %6, label %14
14: ; preds = %6, %11, %2
%15 = phi i8* [ %0, %2 ], [ %12, %11 ], [ %7, %6 ]
ret i8* %15
}