#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 *skip_space(char *);
char *next_token(char *p, char *buf) {
  *buf = 0;
  p = skip_space(p);
  if ((*p == '\r') || (*p == '\n'))
    return 0;
  while (*p && (*p != ' ') && (*p != '\t') && (*p != '\r') && (*p != '\n'))
    *buf++ = *p++;
  *buf = 0;
  return p;
}


x86 assembly (clang, -O0):
<next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <skip_space@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     1154 <next_token+0x44>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1161 <next_token+0x51>
movq   $0x0,-0x8(%rbp)
jmp    1210 <next_token+0x100>
jmp    1166 <next_token+0x56>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     11ca <next_token+0xba>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x19(%rbp)
je     11ca <next_token+0xba>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x19(%rbp)
je     11ca <next_token+0xba>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x19(%rbp)
je     11ca <next_token+0xba>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11da <next_token+0xca>
jmp    1201 <next_token+0xf1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1166 <next_token+0x56>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_token>:
push   %rbx
mov    %rsi,%rbx
movb   $0x0,(%rsi)
call   1030 <skip_space@plt>
mov    %rax,%rcx
mov    (%rax),%dl
xor    %eax,%eax
cmp    $0xa,%dl
je     112d <next_token+0x1d>
cmp    $0xd,%dl
jne    112f <next_token+0x1f>
pop    %rbx
ret
movabs $0x100002601,%rsi
mov    %rcx,%rax
jmp    114e <next_token+0x3e>
xchg   %ax,%ax
mov    %dl,(%rbx)
add    $0x1,%rbx
movzbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    $0x20,%dl
ja     1140 <next_token+0x30>
movzbl %dl,%ecx
bt     %rcx,%rsi
jae    1140 <next_token+0x30>
movb   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @next_token(i8* %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
%3 = tail call i8* @skip_space(i8* %0)
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 13, label %14
i8 10, label %14
]
5: ; preds = %2, %9
%6 = phi i8 [ %12, %9 ], [ %4, %2 ]
%7 = phi i8* [ %10, %9 ], [ %3, %2 ]
%8 = phi i8* [ %11, %9 ], [ %1, %2 ]
switch i8 %6, label %9 [
i8 0, label %13
i8 32, label %13
i8 9, label %13
i8 13, label %13
i8 10, label %13
]
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%12 = load i8, i8* %10
br label %5
13: ; preds = %5, %5, %5, %5, %5
store i8 0, i8* %8
br label %14
14: ; preds = %2, %2, %13
%15 = phi i8* [ %7, %13 ], [ null, %2 ], [ null, %2 ]
ret i8* %15
}