#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 */
char strlen(char const *);
int neither(const char *d, const char e, const char f, char first) {
  char k;
  for (k = first; k < strlen(d); k++) {
    if ((d[k] != e) && (d[k] != f))
      return k;
  }
  return -1;
}


x86 assembly (clang, -O0):
<neither>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %rdi,-0x10(%rbp)
mov    %dl,-0x11(%rbp)
mov    %cl,-0x12(%rbp)
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
mov    %al,-0x14(%rbp)
movsbl -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %al,%cl
mov    -0x18(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
jge    11a2 <neither+0x92>
mov    -0x10(%rbp),%rax
movsbq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     1190 <neither+0x80>
mov    -0x10(%rbp),%rax
movsbq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
je     1190 <neither+0x80>
movsbl -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a9 <neither+0x99>
jmp    1195 <neither+0x85>
mov    -0x14(%rbp),%al
add    $0x1,%al
mov    %al,-0x14(%rbp)
jmp    1132 <neither+0x22>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neither>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r12d
mov    %edx,%r15d
mov    %esi,%r13d
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0xffffffff,%ebp
cmp    %r12b,%al
jle    1184 <neither+0x74>
movsbq %r12b,%r14
movzbl %r12b,%ebp
shl    $0x18,%ebp
jmp    116b <neither+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
movsbq %al,%rax
add    $0x1000000,%ebp
cmp    %rax,%r14
jge    117f <neither+0x6f>
movzbl (%rbx,%r14,1),%eax
cmp    %r13b,%al
je     1150 <neither+0x40>
cmp    %r15b,%al
je     1150 <neither+0x40>
sar    $0x18,%ebp
jmp    1184 <neither+0x74>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @neither(i8* %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = tail call signext i8 @strlen(i8* %0)
%6 = icmp sgt i8 %5, %3
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = sext i8 %3 to i64
br label %9
9: ; preds = %7, %16
%10 = phi i64 [ %8, %7 ], [ %17, %16 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, %1
%14 = icmp eq i8 %12, %2
%15 = or i1 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %9
%17 = add nsw i64 %10, 1
%18 = tail call signext i8 @strlen(i8* %0)
%19 = sext i8 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %9, label %25
21: ; preds = %9
%22 = trunc i64 %10 to i32
%23 = shl i32 %22, 24
%24 = ashr exact i32 %23, 24
br label %25
25: ; preds = %16, %4, %21
%26 = phi i32 [ %24, %21 ], [ -1, %4 ], [ -1, %16 ]
ret i32 %26
}