#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__ meaningful_char(char const);
bool get_next_token(const char **string, const char *string_end,
                    const char **token_start, size_t *token_length) {
  const char *start = *string;
  while (start != string_end && !meaningful_char(*start))
    start++;
  if (start == string_end) {
    *string = start;
    ;
    return false;
  }
  const char *s = start + 1;
  while (s != string_end && meaningful_char(*s)) {
    s++;
  }
  *string = s;
  *token_start = start;
  *token_length = s - start;
  return true;
}


x86 assembly (clang, -O0):
<get_next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x39(%rbp)
je     115e <get_next_token+0x4e>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1030 <meaningful_char@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    116e <get_next_token+0x5e>
jmp    117f <get_next_token+0x6f>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1133 <get_next_token+0x23>
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    11a4 <get_next_token+0x94>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1229 <get_next_token+0x119>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x3a(%rbp)
je     11d9 <get_next_token+0xc9>
mov    -0x38(%rbp),%rax
movsbl (%rax),%edi
call   1030 <meaningful_char@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x3a(%rbp)
mov    -0x3a(%rbp),%al
test   $0x1,%al
jne    11e9 <get_next_token+0xd9>
jmp    11fa <get_next_token+0xea>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11b0 <get_next_token+0xa0>
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rax
sub    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_token>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    (%rdi),%rbx
cmp    %rsi,%rbx
je     115a <get_next_token+0x4a>
mov    %rcx,%r13
mov    %rdx,%r15
mov    %rbx,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <meaningful_char@plt>
test   %rax,%rax
jne    1162 <get_next_token+0x52>
add    $0x1,%rbx
add    $0x1,%rbp
cmp    %r14,%rbx
jne    1140 <get_next_token+0x30>
mov    %r14,(%r12)
xor    %eax,%eax
jmp    11a5 <get_next_token+0x95>
mov    %r13,(%rsp)
lea    0x1(%rbx),%r13
nopw   0x0(%rax,%rax,1)
cmp    %r14,%r13
je     118f <get_next_token+0x7f>
movsbl 0x0(%r13),%edi
call   1030 <meaningful_char@plt>
add    $0x1,%r13
test   %rax,%rax
jne    1170 <get_next_token+0x60>
add    $0xffffffffffffffff,%r13
mov    %r13,%r14
mov    %r14,(%r12)
mov    %rbx,(%r15)
sub    %rbp,%r14
mov    (%rsp),%rax
mov    %r14,(%rax)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @get_next_token(i8** nocapture %0, i8* readnone %1, i8** nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = load i8*, i8** %0
%6 = icmp eq i8* %5, %1
br i1 %6, label %15, label %7
7: ; preds = %4, %12
%8 = phi i8* [ %13, %12 ], [ %5, %4 ]
%9 = load i8, i8* %8
%10 = tail call i64 @meaningful_char(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = icmp eq i8* %13, %1
br i1 %14, label %15, label %7
15: ; preds = %12, %4
store i8* %1, i8** %0
br label %29
16: ; preds = %7, %20
%17 = phi i8* [ %18, %20 ], [ %8, %7 ]
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = icmp eq i8* %18, %1
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8, i8* %18
%22 = tail call i64 @meaningful_char(i8 signext %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %16
24: ; preds = %16, %20
%25 = phi i8* [ %1, %16 ], [ %18, %20 ]
store i8* %25, i8** %0
store i8* %8, i8** %2
%26 = ptrtoint i8* %25 to i64
%27 = ptrtoint i8* %8 to i64
%28 = sub i64 %26, %27
store i64 %28, i64* %3
br label %29
29: ; preds = %24, %15
%30 = phi i32 [ 0, %15 ], [ 1, %24 ]
ret i32 %30
}