#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 *s) {
  char *p;
  while (*s && !isspace(*s))
    s++;
  p = s;
  while (*s && isspace(*s))
    s++;
  *p = 0;
  return s;
}


x86 assembly (clang, -O0):
<next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%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,-0x11(%rbp)
mov    -0x11(%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>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
je     119d <next_token+0x8d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11ad <next_token+0x9d>
jmp    11be <next_token+0xae>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1172 <next_token+0x62>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_token>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     113f <next_token+0x2f>
nopl   (%rax)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1151 <next_token+0x41>
movzbl 0x1(%r14),%eax
add    $0x1,%r14
mov    %r14,%rbx
test   %al,%al
jne    1120 <next_token+0x10>
jmp    1142 <next_token+0x32>
mov    %r14,%rbx
movb   $0x0,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    (%r14),%al
mov    %r14,%rbx
test   %al,%al
je     1142 <next_token+0x32>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1142 <next_token+0x32>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <next_token+0x50>
jmp    1142 <next_token+0x32>

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

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 ], [ %6, %21 ], [ %6, %16 ], [ %10, %9 ]
%27 = phi i8* [ %6, %13 ], [ %0, %1 ], [ %18, %16 ], [ %22, %21 ], [ %10, %9 ]
store i8 0, i8* %26
ret i8* %27
}