#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 */
int /*<<< orphan*/ strchr(char *, char);
char *reg_tokens_advance(char *ptr, char *colname, char *seps) {
  char *optr = colname;
  while (!strchr(seps, *ptr)) {
    *optr++ = *ptr++;
  }
  *optr = '\0';
  return ptr;
}


x86 assembly (clang, -O0):
<reg_tokens_advance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1151 <reg_tokens_advance+0x41>
jmp    1178 <reg_tokens_advance+0x68>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    112c <reg_tokens_advance+0x1c>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_tokens_advance>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsbl (%rdi),%esi
mov    %rdx,%rdi
call   1030 <strchr@plt>
test   %eax,%eax
je     1140 <reg_tokens_advance+0x30>
mov    %rbx,%r12
jmp    1161 <reg_tokens_advance+0x51>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rbx),%r12
movzbl (%rbx),%eax
mov    %al,(%r15)
add    $0x1,%r15
movsbl 0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
mov    %r12,%rbx
test   %eax,%eax
je     1140 <reg_tokens_advance+0x30>
movb   $0x0,(%r15)
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @reg_tokens_advance(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
store i8* %8, i8** %7
br label %9
9: ; preds = %16, %3
%10 = load i8*, i8** %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = call i32 @strchr(i8* %10, i8 signext %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %22
16: ; preds = %9
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
%19 = load i8, i8* %17
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %7
store i8 %19, i8* %20
br label %9
22: ; preds = %9
%23 = load i8*, i8** %7
store i8 0, i8* %23
%24 = load i8*, i8** %4
ret i8* %24
}

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