#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*/ memset(char *, int /*<<< orphan*/, int);
char *(strpbrk)(const char *string, const char *stopset) {
  char set[256];
  char c;
  const char *s = string;
  memset(set, 0, 256 * sizeof(char));
  while ((c = *stopset++))
    set[(size_t)c] = 1;
  while ((c = *s++))
    if (!set[(size_t)c])
      break;
  return c ? (s - 1) : NULL;
}


x86 assembly (clang, -O0):
<strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x111(%rbp)
cmp    $0x0,%al
je     1175 <strpbrk+0x65>
movsbq -0x111(%rbp),%rax
ff
movb   $0x1,-0x110(%rbp,%rax,1)
01
jmp    1141 <strpbrk+0x31>
jmp    117a <strpbrk+0x6a>
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
mov    (%rax),%al
mov    %al,-0x111(%rbp)
cmp    $0x0,%al
je     11bf <strpbrk+0xaf>
movsbq -0x111(%rbp),%rax
ff
cmpb   $0x0,-0x110(%rbp,%rax,1)
jne    11ba <strpbrk+0xaa>
jmp    11bf <strpbrk+0xaf>
jmp    117a <strpbrk+0x6a>
movsbl -0x111(%rbp),%eax
cmp    $0x0,%eax
je     11e6 <strpbrk+0xd6>
mov    -0x120(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x128(%rbp)
jmp    11f4 <strpbrk+0xe4>
xor    %eax,%eax
mov    %rax,-0x128(%rbp)
jmp    11f4 <strpbrk+0xe4>
mov    -0x128(%rbp),%rax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpbrk>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
mov    (%rbx),%al
test   %al,%al
je     1153 <strpbrk+0x43>
add    $0x1,%rbx
nopl   0x0(%rax)
movsbq %al,%rax
movb   $0x1,(%rsp,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <strpbrk+0x30>
add    $0xffffffffffffffff,%r14
nopw   0x0(%rax,%rax,1)
movsbq 0x1(%r14),%rax
test   %rax,%rax
je     1176 <strpbrk+0x66>
add    $0x1,%r14
cmpb   $0x0,(%rsp,%rax,1)
jne    1160 <strpbrk+0x50>
jmp    1179 <strpbrk+0x69>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strpbrk(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i8
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
store i8* %8, i8** %7
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i32 0, i32 256)
br label %11
11: ; preds = %16, %2
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %4
%14 = load i8, i8* %12
store i8 %14, i8* %6
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i8, i8* %6
%18 = sext i8 %17 to i64
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %18
store i8 1, i8* %19
br label %11
20: ; preds = %11
br label %21
21: ; preds = %33, %20
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %7
%24 = load i8, i8* %22
store i8 %24, i8* %6
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %21
%27 = load i8, i8* %6
%28 = sext i8 %27 to i64
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = icmp ne i8 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %26
br label %34
33: ; preds = %26
br label %21
34: ; preds = %32, %21
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i8*, i8** %7
%40 = getelementptr inbounds i8, i8* %39, i64 -1
br label %42
41: ; preds = %34
br label %42
42: ; preds = %41, %38
%43 = phi i8* [ %40, %38 ], [ null, %41 ]
ret i8* %43
}

LLVM IR (-O2):
define i8* @strpbrk(i8* %0, i8* nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 256)
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %2, %8
%9 = phi i8 [ %14, %8 ], [ %6, %2 ]
%10 = phi i8* [ %11, %8 ], [ %1, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = sext i8 %9 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %12
store i8 1, i8* %13
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %8, %2
br label %17
17: ; preds = %16, %21
%18 = phi i8* [ %22, %21 ], [ %0, %16 ]
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %17
%22 = getelementptr inbounds i8, i8* %18, i64 1
%23 = sext i8 %19 to i64
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %17
27: ; preds = %21, %17
%28 = phi i8* [ %18, %21 ], [ null, %17 ]
ret i8* %28
}