#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__ strchr(char const *, char const);
char *start_of_next_field(const char *s, const char *delimiters) {
  const char *pc;
  if (!s || !delimiters)
    return NULL;
  for (pc = s; *pc != '\0' && !strchr(delimiters, *pc); ++pc)
    ;
  for (; *pc != '\0' && strchr(delimiters, *pc); ++pc)
    ;
  if (*pc == '\0')
    return NULL;
  return (char *)pc;
}


x86 assembly (clang, -O0):
<start_of_next_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <start_of_next_field+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1143 <start_of_next_field+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1221 <start_of_next_field+0x111>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     117c <start_of_next_field+0x6c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    118c <start_of_next_field+0x7c>
jmp    11a2 <start_of_next_field+0x92>
jmp    1191 <start_of_next_field+0x81>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114b <start_of_next_field+0x3b>
jmp    11a7 <start_of_next_field+0x97>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x22(%rbp)
je     11d6 <start_of_next_field+0xc6>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    11e6 <start_of_next_field+0xd6>
jmp    11fc <start_of_next_field+0xec>
jmp    11eb <start_of_next_field+0xdb>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11a7 <start_of_next_field+0x97>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1219 <start_of_next_field+0x109>
movq   $0x0,-0x8(%rbp)
jmp    1221 <start_of_next_field+0x111>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_of_next_field>:
push   %r15
push   %r14
push   %rbx
xor    %r15d,%r15d
test   %rdi,%rdi
je     114f <start_of_next_field+0x3f>
mov    %rsi,%r14
test   %rsi,%rsi
je     114f <start_of_next_field+0x3f>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     114c <start_of_next_field+0x3c>
xchg   %ax,%ax
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1158 <start_of_next_field+0x48>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <start_of_next_field+0x20>
xor    %r15d,%r15d
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rbx),%al
test   %al,%al
je     114c <start_of_next_field+0x3c>
mov    %rbx,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     118f <start_of_next_field+0x7f>
movzbl 0x1(%r15),%eax
add    $0x1,%r15
test   %al,%al
jne    1170 <start_of_next_field+0x60>
jmp    114c <start_of_next_field+0x3c>
cmpb   $0x0,(%r15)
jne    114f <start_of_next_field+0x3f>
jmp    114c <start_of_next_field+0x3c>

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

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