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


x86 assembly (clang, -O0):
<strprcbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x120(%rbp)
movq   $0x0,-0x128(%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     1180 <strprcbrk+0x70>
movsbq -0x111(%rbp),%rax
ff
movb   $0x1,-0x110(%rbp,%rax,1)
01
jmp    114c <strprcbrk+0x3c>
jmp    1185 <strprcbrk+0x75>
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     11d7 <strprcbrk+0xc7>
movsbq -0x111(%rbp),%rax
ff
cmpb   $0x0,-0x110(%rbp,%rax,1)
je     11d2 <strprcbrk+0xc2>
mov    -0x120(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x128(%rbp)
jmp    1185 <strprcbrk+0x75>
mov    -0x128(%rbp),%rax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strprcbrk>:
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 <strprcbrk+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 <strprcbrk+0x30>
mov    (%r14),%cl
xor    %eax,%eax
test   %cl,%cl
je     1179 <strprcbrk+0x69>
nopl   0x0(%rax)
movsbq %cl,%rcx
cmpb   $0x0,(%rsp,%rcx,1)
cmovne %r14,%rax
movzbl 0x1(%r14),%ecx
add    $0x1,%r14
test   %cl,%cl
jne    1160 <strprcbrk+0x50>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strprcbrk(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 %8, label %11
8: ; preds = %11, %2
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %31, label %19
11: ; preds = %2, %11
%12 = phi i8 [ %17, %11 ], [ %6, %2 ]
%13 = phi i8* [ %14, %11 ], [ %1, %2 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = sext i8 %12 to i64
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %15
store i8 1, i8* %16
%17 = load i8, i8* %14
%18 = icmp eq i8 %17, 0
br i1 %18, label %8, label %11
19: ; preds = %8, %19
%20 = phi i8 [ %29, %19 ], [ %9, %8 ]
%21 = phi i8* [ %28, %19 ], [ null, %8 ]
%22 = phi i8* [ %23, %19 ], [ %0, %8 ]
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = sext i8 %20 to i64
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
%28 = select i1 %27, i8* %21, i8* %22
%29 = load i8, i8* %23
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %19
31: ; preds = %19, %8
%32 = phi i8* [ null, %8 ], [ %28, %19 ]
ret i8* %32
}