#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 */
scalar_t__ find_index_of_char_in_string(char *, char);
int find_index_in_string(char *s, char *stops) {
  int result = -1;
  int i;
  for (i = 0; result < 0 && s[i] != '\0'; i++) {
    if (0 <= find_index_of_char_in_string(stops, s[i]))
      result = i;
  }
  return result;
}


x86 assembly (clang, -O0):
<find_index_in_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jge    1152 <find_index_in_string+0x42>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1162 <find_index_in_string+0x52>
jmp    119e <find_index_in_string+0x8e>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <find_index_of_char_in_string@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jg     118b <find_index_in_string+0x7b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <find_index_in_string+0x80>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <find_index_in_string+0x1e>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_index_in_string>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0xffffffff,%ebx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
movzbl (%r15,%r12,1),%eax
test   %al,%al
je     1153 <find_index_in_string+0x43>
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <find_index_of_char_in_string@plt>
test   %rax,%rax
cmovns %r12d,%ebx
add    $0x1,%r12
test   %ebx,%ebx
js     1130 <find_index_in_string+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @find_index_in_string(i8* nocapture %0, i8* %1) {
br label %3
3: ; preds = %2, %9
%4 = phi i64 [ 0, %2 ], [ %12, %9 ]
%5 = phi i32 [ -1, %2 ], [ %14, %9 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %4
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %3
%10 = tail call i64 @find_index_of_char_in_string(i8* %1, i8 signext %7)
%11 = icmp sgt i64 %10, -1
%12 = add nuw i64 %4, 1
%13 = trunc i64 %4 to i32
%14 = select i1 %11, i32 %13, i32 %5
%15 = icmp slt i32 %14, 0
br i1 %15, label %3, label %16
16: ; preds = %9, %3
%17 = phi i32 [ %14, %9 ], [ %5, %3 ]
ret i32 %17
}