#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 */
typedef size_t ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ strchr(char *, char);
ssize_t strFindFirstOf(char *string, char *search) {
  char *pos;
  assert(string != NULL);
  assert(search != NULL);
  pos = string;
  while (*pos) {
    if (strchr(search, *pos))
      break;
    pos++;
  }
  return *pos ? (size_t)(pos - string) : -1;
}


x86 assembly (clang, -O0):
<strFindFirstOf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1199 <strFindFirstOf+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1188 <strFindFirstOf+0x68>
jmp    1199 <strFindFirstOf+0x79>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115c <strFindFirstOf+0x3c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11bd <strFindFirstOf+0x9d>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    11cd <strFindFirstOf+0xad>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    11cd <strFindFirstOf+0xad>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strFindFirstOf>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
mov    (%r15),%al
test   %al,%al
je     1177 <strFindFirstOf+0x57>
xor    %ebx,%ebx
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1170 <strFindFirstOf+0x50>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <strFindFirstOf+0x30>
jmp    1177 <strFindFirstOf+0x57>
cmpb   $0x0,(%r15,%rbx,1)
jne    117e <strFindFirstOf+0x5e>
mov    $0xffffffffffffffff,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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