#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 */
scalar_t__ isspace(char);
char *next_token(char *str) {
  while (*str != '\0' && !isspace(*str)) {
    str++;
  }
  while (*str != '\0' && isspace(*str)) {
    str++;
  }
  return str;
}


x86 assembly (clang, -O0):
<next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1149 <next_token+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1159 <next_token+0x49>
jmp    116a <next_token+0x5a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <next_token+0xc>
jmp    116f <next_token+0x5f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     119a <next_token+0x8a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11aa <next_token+0x9a>
jmp    11bb <next_token+0xab>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    116f <next_token+0x5f>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_token>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1139 <next_token+0x29>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    113e <next_token+0x2e>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <next_token+0x10>
mov    %rbx,%rax
pop    %rbx
ret
mov    (%rbx),%al
test   %al,%al
je     1139 <next_token+0x29>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1139 <next_token+0x29>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <next_token+0x40>
jmp    1139 <next_token+0x29>

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

LLVM IR (-O2):
define i8* @next_token(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %25, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i64 @isspace(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %25, label %4
13: ; preds = %4
%14 = load i8, i8* %6
%15 = icmp eq i8 %14, 0
br i1 %15, label %25, label %16
16: ; preds = %13, %21
%17 = phi i8 [ %23, %21 ], [ %14, %13 ]
%18 = phi i8* [ %22, %21 ], [ %6, %13 ]
%19 = tail call i64 @isspace(i8 signext %17)
%20 = icmp eq i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %16
%22 = getelementptr inbounds i8, i8* %18, i64 1
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %16
25: ; preds = %9, %16, %21, %1, %13
%26 = phi i8* [ %6, %13 ], [ %0, %1 ], [ %22, %21 ], [ %18, %16 ], [ %10, %9 ]
ret i8* %26
}