#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 *(strpcbrknul)(const char *string, const char *skipset) {
  char set[256];
  char c;
  const char *s = string;
  memset(set, 0, 256 * sizeof(char));
  while ((c = *skipset++))
    set[(size_t)c] = 1;
  while ((c = *s++))
    if (set[(size_t)c])
      break;
  return s - 1;
}


x86 assembly (clang, -O0):
<strpcbrknul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%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 <strpcbrknul+0x65>
movsbq -0x111(%rbp),%rax
ff
movb   $0x1,-0x110(%rbp,%rax,1)
01
jmp    1141 <strpcbrknul+0x31>
jmp    117a <strpcbrknul+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 <strpcbrknul+0xaf>
movsbq -0x111(%rbp),%rax
ff
cmpb   $0x0,-0x110(%rbp,%rax,1)
je     11ba <strpcbrknul+0xaa>
jmp    11bf <strpcbrknul+0xaf>
jmp    117a <strpcbrknul+0x6a>
mov    -0x120(%rbp),%rax
add    $0xffffffffffffffff,%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpcbrknul>:
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     1160 <strpcbrknul+0x50>
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 <strpcbrknul+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rax
movsbq (%r14),%rcx
test   %rcx,%rcx
je     1176 <strpcbrknul+0x66>
lea    0x1(%rax),%r14
cmpb   $0x0,(%rsp,%rcx,1)
je     1160 <strpcbrknul+0x50>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strpcbrknul(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 %32, label %33
32: ; preds = %26
br label %34
33: ; preds = %26
br label %21
34: ; preds = %32, %21
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i64 -1
ret i8* %36
}

LLVM IR (-O2):
define i8* @strpcbrknul(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 %17, label %27
27: ; preds = %21, %17
ret i8* %18
}