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


x86 assembly (clang, -O0):
<strspn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1162 <strspn+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
movb   $0x1,-0x110(%rbp,%rax,1)
01
jmp    1136 <strspn+0x26>
mov    -0x8(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
cmpb   $0x0,-0x110(%rbp,%rax,1)
je     1192 <strspn+0x82>
jmp    116d <strspn+0x5d>
mov    -0x8(%rbp),%rax
mov    -0x118(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strspn>:
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     1152 <strspn+0x42>
add    $0x1,%rbx
nopl   0x0(%rax)
movzbl %al,%eax
movb   $0x1,(%rsp,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <strspn+0x30>
mov    $0xffffffffffffffff,%rax
nopl   0x0(%rax)
movzbl 0x1(%r14,%rax,1),%ecx
add    $0x1,%rax
cmpb   $0x0,(%rsp,%rcx,1)
jne    1160 <strspn+0x50>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @strspn(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 = zext 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, %17
%18 = phi i8* [ %19, %17 ], [ %0, %16 ]
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %18
%21 = zext i8 %20 to i64
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %17
25: ; preds = %17
%26 = ptrtoint i8* %19 to i64
%27 = ptrtoint i8* %0 to i64
%28 = xor i64 %27, -1
%29 = add i64 %26, %28
ret i64 %29
}