#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 strcspn(const char *string, const char *strCharSet) {
  const char *temp;
  int i;
  i = 0;
  while (1) {
    temp = strCharSet;
    while (*temp != '\0') {
      if (*string == *temp)
        return i;
      temp++;
    }
    i++;
    string++;
  }
}


x86 assembly (clang, -O0):
<strcspn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1157 <strcspn+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1146 <strcspn+0x46>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111b <strcspn+0x1b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <strcspn+0x13>

x86 assembly (clang, -O2):
<strcspn>:
mov    (%rsi),%r8b
add    $0x1,%rsi
xor    %eax,%eax
jmp    1117 <strcspn+0x17>
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
add    $0x1,%rdi
test   %r8b,%r8b
je     1110 <strcspn+0x10>
mov    (%rdi),%r9b
mov    %rsi,%rcx
mov    %r8d,%edx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %dl,%r9b
je     1142 <strcspn+0x42>
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1130 <strcspn+0x30>
jmp    1110 <strcspn+0x10>
ret

LLVM IR (-O0):
define i32 @strcspn(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %6
br label %7
7: ; preds = %2, %27
%8 = load i8*, i8** %4
store i8* %8, i8** %5
br label %9
9: ; preds = %24, %7
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %17, %20
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = load i32, i32* %6
ret i32 %23
24: ; preds = %14
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
br label %9
27: ; preds = %9
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
br label %7
}

LLVM IR (-O2):
define i32 @strcspn(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br label %5
5: ; preds = %19, %2
%6 = phi i8* [ %0, %2 ], [ %21, %19 ]
%7 = phi i32 [ 0, %2 ], [ %20, %19 ]
br i1 %4, label %19, label %8
8: ; preds = %5
%9 = load i8, i8* %6
br label %13
10: ; preds = %13
%11 = load i8, i8* %17
%12 = icmp eq i8 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %8, %10
%14 = phi i8 [ %3, %8 ], [ %11, %10 ]
%15 = phi i8* [ %1, %8 ], [ %17, %10 ]
%16 = icmp eq i8 %9, %14
%17 = getelementptr inbounds i8, i8* %15, i64 1
br i1 %16, label %18, label %10
18: ; preds = %13
ret i32 %7
19: ; preds = %10, %5
%20 = add nuw nsw i32 %7, 1
%21 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
}