#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__ InSet(char const *, int, char const *);
int ModelicaStrings_skipWhiteSpace(char const *, int);
int SkipNonWhiteSpaceSeparator(char const *, int, char const *);
int get_token(const char *string, int startIndex, const char *separators,
              int *output_index, int *token_start, int *token_length) {
  int past_token;
  int sep_pos;
  *token_start = ModelicaStrings_skipWhiteSpace(string, startIndex);
  past_token = SkipNonWhiteSpaceSeparator(string, *token_start, separators);
  sep_pos = ModelicaStrings_skipWhiteSpace(string, past_token);
  *output_index = InSet(string, sep_pos, separators) ? sep_pos + 1 : sep_pos;
  *token_length = past_token - *token_start;
  if (*token_length == 0 || *token_length > 100) {
    *output_index = startIndex;
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<get_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <ModelicaStrings_skipWhiteSpace@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
call   1050 <SkipNonWhiteSpaceSeparator@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1040 <ModelicaStrings_skipWhiteSpace@plt>
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <InSet@plt>
cmp    $0x0,%rax
je     11b0 <get_token+0x80>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11b6 <get_token+0x86>
mov    -0x40(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%ecx
mov    -0x30(%rbp),%rax
sub    (%rax),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
cmpl   $0x0,(%rax)
je     11e8 <get_token+0xb8>
mov    -0x38(%rbp),%rax
cmpl   $0x64,(%rax)
jle    11fd <get_token+0xcd>
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1204 <get_token+0xd4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_token>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r13
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %esi,0xc(%rsp)
call   1040 <ModelicaStrings_skipWhiteSpace@plt>
mov    %eax,0x0(%r13)
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1050 <SkipNonWhiteSpaceSeparator@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <ModelicaStrings_skipWhiteSpace@plt>
mov    %eax,%r15d
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <InSet@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
mov    %r15d,(%r12)
sub    0x0(%r13),%ebp
mov    0x10(%rsp),%rax
mov    %ebp,(%rax)
je     11a8 <get_token+0x78>
mov    $0x1,%eax
cmp    $0x65,%ebp
jl     11b2 <get_token+0x82>
mov    0xc(%rsp),%eax
mov    %eax,(%r12)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @get_token(i8* %0, i32 %1, i8* %2, i32* nocapture writeonly %3, i32* nocapture %4, i32* nocapture writeonly %5) {
%7 = tail call i32 @ModelicaStrings_skipWhiteSpace(i8* %0, i32 %1)
store i32 %7, i32* %4
%8 = tail call i32 @SkipNonWhiteSpaceSeparator(i8* %0, i32 %7, i8* %2)
%9 = tail call i32 @ModelicaStrings_skipWhiteSpace(i8* %0, i32 %8)
%10 = tail call i64 @InSet(i8* %0, i32 %9, i8* %2)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
%13 = add nsw i32 %9, %12
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = sub nsw i32 %8, %14
store i32 %15, i32* %5
%16 = icmp eq i32 %15, 0
%17 = icmp sgt i32 %15, 100
%18 = or i1 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 %1, i32* %3
br label %20
20: ; preds = %6, %19
%21 = phi i32 [ 0, %19 ], [ 1, %6 ]
ret i32 %21
}