#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__ fnmatch(char const *const, char const *, int /*<<< orphan*/);
scalar_t__ has_wildcards_p(char const *const);
scalar_t__ match_backwards(char const *, char const *const);
int /*<<< orphan*/ strcmp(char const *, char const *const);
int in_acclist(const char *const *accepts, const char *s, int backward) {
  for (; *accepts; accepts++) {
    if (has_wildcards_p(*accepts)) {
      if (fnmatch(*accepts, s, 0) == 0)
        return 1;
    } else {
      if (backward) {
        if (match_backwards(s, *accepts))
          return 1;
      } else {
        if (!strcmp(s, *accepts))
          return 1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<in_acclist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     121e <in_acclist+0xde>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <has_wildcards_p@plt>
cmp    $0x0,%rax
je     11a4 <in_acclist+0x64>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1050 <fnmatch@plt>
cmp    $0x0,%rax
jne    119f <in_acclist+0x5f>
movl   $0x1,-0x4(%rbp)
jmp    1225 <in_acclist+0xe5>
jmp    1208 <in_acclist+0xc8>
cmpl   $0x0,-0x1c(%rbp)
je     11d9 <in_acclist+0x99>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <match_backwards@plt>
cmp    $0x0,%rax
je     11d4 <in_acclist+0x94>
movl   $0x1,-0x4(%rbp)
jmp    1225 <in_acclist+0xe5>
jmp    1203 <in_acclist+0xc3>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11fe <in_acclist+0xbe>
movl   $0x1,-0x4(%rbp)
jmp    1225 <in_acclist+0xe5>
jmp    1203 <in_acclist+0xc3>
jmp    1208 <in_acclist+0xc8>
jmp    120d <in_acclist+0xcd>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1153 <in_acclist+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_acclist>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
mov    (%rdi),%rdi
test   %rdi,%rdi
je     11b1 <in_acclist+0x71>
mov    %edx,%r14d
mov    %rsi,%rbx
add    $0x8,%rbp
jmp    117f <in_acclist+0x3f>
nopl   0x0(%rax,%rax,1)
mov    %rsi,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <fnmatch@plt>
test   %rax,%rax
je     11aa <in_acclist+0x6a>
mov    0x0(%rbp),%rdi
add    $0x8,%rbp
test   %rdi,%rdi
je     11b1 <in_acclist+0x71>
call   1030 <has_wildcards_p@plt>
mov    -0x8(%rbp),%rsi
test   %rax,%rax
jne    1160 <in_acclist+0x20>
mov    %rbx,%rdi
test   %r14d,%r14d
je     11a1 <in_acclist+0x61>
call   1040 <match_backwards@plt>
test   %rax,%rax
je     1172 <in_acclist+0x32>
jmp    11aa <in_acclist+0x6a>
call   1060 <strcmp@plt>
test   %eax,%eax
jne    1172 <in_acclist+0x32>
mov    $0x1,%eax
jmp    11b3 <in_acclist+0x73>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @in_acclist(i8** nocapture %0, i8* %1, i32 %2) {
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %28, label %6
6: ; preds = %3
%7 = icmp eq i32 %2, 0
br label %8
8: ; preds = %6, %24
%9 = phi i8* [ %4, %6 ], [ %26, %24 ]
%10 = phi i8** [ %0, %6 ], [ %25, %24 ]
%11 = tail call i64 @has_wildcards_p(i8* %9)
%12 = icmp eq i64 %11, 0
%13 = load i8*, i8** %10
br i1 %12, label %17, label %14
14: ; preds = %8
%15 = tail call i64 @fnmatch(i8* %13, i8* %1, i32 0)
%16 = icmp eq i64 %15, 0
br i1 %16, label %28, label %24
17: ; preds = %8
br i1 %7, label %21, label %18
18: ; preds = %17
%19 = tail call i64 @match_backwards(i8* %1, i8* %13)
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %28
21: ; preds = %17
%22 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(1) %13)
%23 = icmp eq i32 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %14, %21, %18
%25 = getelementptr inbounds i8*, i8** %10, i64 1
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %8
28: ; preds = %14, %18, %21, %24, %3
%29 = phi i32 [ 0, %3 ], [ 0, %24 ], [ 1, %21 ], [ 1, %18 ], [ 1, %14 ]
ret i32 %29
}