#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 */
size_t str_len(char *);
int /*<<< orphan*/ *strchr(char *, char);
char *str_find_not_char(char *haystack, char *needles) {
  char *str = NULL;
  size_t len_haystack;
  if (haystack == NULL)
    return (NULL);
  if (needles == NULL)
    return (NULL);
  len_haystack = str_len(haystack);
  for (str = haystack; str < haystack + len_haystack; str++) {
    if (strchr(needles, *str) == NULL)
      return (str);
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<str_find_not_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <str_find_not_char+0x30>
movq   $0x0,-0x8(%rbp)
jmp    11d7 <str_find_not_char+0xb7>
cmpq   $0x0,-0x18(%rbp)
jne    1168 <str_find_not_char+0x48>
movq   $0x0,-0x8(%rbp)
jmp    11d7 <str_find_not_char+0xb7>
mov    -0x10(%rbp),%rdi
call   1040 <str_len@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    -0x28(%rbp),%rcx
cmp    %rcx,%rax
jae    11cf <str_find_not_char+0xaf>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    11b9 <str_find_not_char+0x99>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <str_find_not_char+0xb7>
jmp    11be <str_find_not_char+0x9e>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    117d <str_find_not_char+0x5d>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_find_not_char>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
test   %rdi,%rdi
je     1173 <str_find_not_char+0x53>
mov    %rsi,%r15
test   %rsi,%rsi
je     1173 <str_find_not_char+0x53>
mov    %rdi,%rbx
call   1040 <str_len@plt>
test   %rax,%rax
jle    116b <str_find_not_char+0x4b>
mov    %rax,%r12
add    %rbx,%r12
xor    %r14d,%r14d
xchg   %ax,%ax
movsbl (%rbx),%esi
mov    %r15,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1170 <str_find_not_char+0x50>
add    $0x1,%rbx
cmp    %r12,%rbx
jb     1150 <str_find_not_char+0x30>
jmp    1173 <str_find_not_char+0x53>
xor    %r14d,%r14d
jmp    1173 <str_find_not_char+0x53>
mov    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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