#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 *s, const char *b) {
  char map[256];
  memset(map, 0, 256);
  for (;;) {
    map[*b] = 1;
    if (*b++ == 0)
      break;
  }
  while (map[*s++] == 0)
    ;
  if (*--s)
    return (char *)s;
  return 0;
}


x86 assembly (clang, -O0):
<strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
movsbq (%rax),%rax
movb   $0x1,-0x120(%rbp,%rax,1)
01
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1166 <strpbrk+0x56>
jmp    116b <strpbrk+0x5b>
jmp    1136 <strpbrk+0x26>
jmp    1170 <strpbrk+0x60>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbq (%rax),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1199 <strpbrk+0x89>
jmp    1170 <strpbrk+0x60>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,-0x1(%rax)
je     11bf <strpbrk+0xaf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11c7 <strpbrk+0xb7>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x120,%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>
nop
movsbq (%rbx),%rax
add    $0x1,%rbx
movb   $0x1,(%rsp,%rax,1)
test   %rax,%rax
jne    1130 <strpbrk+0x20>
add    $0xffffffffffffffff,%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsbq 0x1(%r14),%rax
add    $0x1,%r14
cmpb   $0x0,(%rsp,%rax,1)
je     1150 <strpbrk+0x40>
xor    %ecx,%ecx
test   %al,%al
cmove  %rcx,%r14
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 i8*
%6 = alloca [256 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 256)
br label %9
9: ; preds = %20, %2
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = sext i8 %11 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %12
store i8 1, i8* %13
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %5
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %9
br label %21
20: ; preds = %9
br label %9
21: ; preds = %19
br label %22
22: ; preds = %31, %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
%25 = load i8, i8* %23
%26 = sext i8 %25 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %22
br label %22
32: ; preds = %22
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i32 -1
store i8* %34, i8** %4
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = load i8*, i8** %4
store i8* %38, i8** %3
br label %40
39: ; preds = %32
store i8* null, i8** %3
br label %40
40: ; preds = %39, %37
%41 = load i8*, i8** %3
ret i8* %41
}

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)
br label %6
6: ; preds = %6, %2
%7 = phi i8* [ %1, %2 ], [ %11, %6 ]
%8 = load i8, i8* %7
%9 = sext i8 %8 to i64
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %9
store i8 1, i8* %10
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = icmp eq i8 %8, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %13
%14 = phi i8* [ %15, %13 ], [ %0, %6 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %14
%17 = sext i8 %16 to i64
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %13, label %21
21: ; preds = %13
%22 = icmp eq i8 %16, 0
%23 = select i1 %22, i8* null, i8* %14
ret i8* %23
}