#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 *strpbrk(char *, char *);
char *get_token(char **cstring, char *delims) {
  char *cptr;
  char *token = *cstring;
  if (!*token)
    return (NULL);
  while ((cptr = strpbrk(token, delims)) == token)
    (token)++;
  if (cptr)
    *cptr++ = 0;
  *cstring = cptr;
  return (token);
}


x86 assembly (clang, -O0):
<get_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1145 <get_token+0x35>
movq   $0x0,-0x8(%rbp)
jmp    11a6 <get_token+0x96>
jmp    114a <get_token+0x3a>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strpbrk@plt>
mov    %rax,-0x20(%rbp)
cmp    -0x28(%rbp),%rax
jne    1176 <get_token+0x66>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    114a <get_token+0x3a>
cmpq   $0x0,-0x20(%rbp)
je     1193 <get_token+0x83>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_token>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%rax
cmpb   $0x0,(%rax)
je     115b <get_token+0x4b>
mov    %rsi,%r15
mov    %rdi,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strpbrk@plt>
mov    %rax,%rcx
lea    0x1(%rbx),%rax
cmp    %rcx,%rbx
je     1130 <get_token+0x20>
test   %rcx,%rcx
je     115f <get_token+0x4f>
mov    %rcx,%rdx
add    $0x1,%rdx
movb   $0x0,(%rcx)
jmp    1161 <get_token+0x51>
xor    %eax,%eax
jmp    1168 <get_token+0x58>
xor    %edx,%edx
add    $0xffffffffffffffff,%rax
mov    %rdx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @get_token(i8** %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8** %0, i8*** %4
store i8* %1, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %2
store i8* null, i8** %3
br label %34
14: ; preds = %2
br label %15
15: ; preds = %21, %14
%16 = load i8*, i8** %7
%17 = load i8*, i8** %5
%18 = call i8* @strpbrk(i8* %16, i8* %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %7
%20 = icmp eq i8* %18, %19
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %7
br label %15
24: ; preds = %15
%25 = load i8*, i8** %6
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i8*, i8** %6
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %6
store i8 0, i8* %28
br label %30
30: ; preds = %27, %24
%31 = load i8*, i8** %6
%32 = load i8**, i8*** %4
store i8* %31, i8** %32
%33 = load i8*, i8** %7
store i8* %33, i8** %3
br label %34
34: ; preds = %30, %13
%35 = load i8*, i8** %3
ret i8* %35
}

LLVM IR (-O2):
define i8* @get_token(i8** nocapture %0, i8* nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %10, %6 ], [ %3, %2 ]
%8 = tail call i8* @strpbrk(i8* %7, i8* %1)
%9 = icmp eq i8* %8, %7
%10 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %9, label %6, label %11
11: ; preds = %6
%12 = icmp eq i8* %8, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %8
br label %15
15: ; preds = %13, %11
%16 = phi i8* [ %14, %13 ], [ null, %11 ]
store i8* %16, i8** %0
br label %17
17: ; preds = %2, %15
%18 = phi i8* [ %7, %15 ], [ null, %2 ]
ret i8* %18
}