#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*/ btp_location_eat_char_ext(int *, int *, char const);
int /*<<< orphan*/ *strchr(char const *, char const);
size_t btp_strspn_location(const char *s, const char *accept, int *line,
                           int *column) {
  *line = 1;
  *column = 0;
  const char *sc;
  for (sc = s; *sc != '\0'; ++sc) {
    if (strchr(accept, *sc) == NULL)
      return (sc - s);
    btp_location_eat_char_ext(line, column, *sc);
  }
  return sc - s;
}


x86 assembly (clang, -O0):
<btp_strspn_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b7 <btp_strspn_location+0x97>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    1192 <btp_strspn_location+0x72>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    11c6 <btp_strspn_location+0xa6>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rax
movsbl (%rax),%edx
call   1040 <btp_location_eat_char_ext@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1154 <btp_strspn_location+0x34>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btp_strspn_location>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
movl   $0x1,(%rdx)
movl   $0x0,(%rcx)
mov    (%rdi),%al
mov    %rdi,%rbx
test   %al,%al
je     117a <btp_strspn_location+0x5a>
mov    %rcx,%r15
mov    %rdx,%r13
mov    %rsi,%r12
mov    %r14,%rbx
nopl   (%rax)
movsbl %al,%esi
mov    %r12,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     117a <btp_strspn_location+0x5a>
movsbl (%rbx),%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <btp_location_eat_char_ext@plt>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <btp_strspn_location+0x30>
sub    %r14,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @btp_strspn_location(i8* %0, i8* %1, i32* %2, i32* %3) {
store i32 1, i32* %2
store i32 0, i32* %3
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %4, %12
%8 = phi i8 [ %16, %12 ], [ %5, %4 ]
%9 = phi i8* [ %15, %12 ], [ %0, %4 ]
%10 = tail call i32* @strchr(i8* %1, i8 signext %8)
%11 = icmp eq i32* %10, null
br i1 %11, label %18, label %12
12: ; preds = %7
%13 = load i8, i8* %9
%14 = tail call i32 @btp_location_eat_char_ext(i32* %2, i32* %3, i8 signext %13)
%15 = getelementptr inbounds i8, i8* %9, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %12, %7, %4
%19 = phi i8* [ %0, %4 ], [ %9, %7 ], [ %15, %12 ]
%20 = ptrtoint i8* %19 to i64
%21 = ptrtoint i8* %0 to i64
%22 = sub i64 %20, %21
ret i64 %22
}