#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__ strchr(char const *, int /*<<< orphan*/);
scalar_t__ strcmp(char const *const, scalar_t__);
scalar_t__ strlen(char const *const);
scalar_t__ strncmp(char const *, char const *const, scalar_t__);
int config_filter(const char *name) {
  const char *const *p;
  static const char *const skip_prefix[] = {".", "~", "CVS", NULL};
  static const char *const skip_suffix[] = {
      ".rpmsave",   ".rpmorig",  ".rpmnew", ".dpkg-old", ".dpkg-dist",
      ".dpkg-new",  ".dpkg-bak", ".bak",    ".orig",     ".rej",
      ".YaST2save", ".-",        "~",       ",v",        NULL};
  for (p = skip_prefix; *p; p++) {
    if ((strncmp((name), (*p), strlen(*p)) == 0))
      return 0;
  }
  for (p = skip_suffix; *p; p++) {
    if (strlen(name) >= strlen(*p) &&
        (strcmp((*p), (strchr(name, 0) - strlen(*p))) == 0))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<config_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
lea    0x2c2d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11c0 <config_filter+0x80>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11aa <config_filter+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    126b <config_filter+0x12b>
jmp    11af <config_filter+0x6f>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <config_filter+0x17>
lea    0x2bd9(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1264 <config_filter+0x124>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jl     124e <config_filter+0x10e>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <strchr@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdi
sub    %rax,%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    124e <config_filter+0x10e>
movl   $0x0,-0x4(%rbp)
jmp    126b <config_filter+0x12b>
jmp    1253 <config_filter+0x113>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    11cb <config_filter+0x8b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_filter>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
lea    0xeae(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
xor    %r15d,%r15d
test   %rax,%rax
je     1209 <config_filter+0xc9>
lea    0xe93(%rip),%rsi
mov    $0x1,%edx
mov    %r14,%rdi
call   1030 <strncmp@plt>
test   %rax,%rax
je     1209 <config_filter+0xc9>
lea    0xe78(%rip),%rsi
mov    $0x3,%edx
mov    %r14,%rdi
call   1030 <strncmp@plt>
test   %rax,%rax
je     1209 <config_filter+0xc9>
lea    0xe63(%rip),%rbx
lea    0x2bfc(%rip),%rbp
jmp    11bd <config_filter+0x7d>
xchg   %ax,%ax
mov    0x0(%rbp),%rbx
add    $0x8,%rbp
test   %rbx,%rbx
je     1203 <config_filter+0xc3>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%r15
jl     11b0 <config_filter+0x70>
xor    %r15d,%r15d
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <strchr@plt>
mov    %rax,%r12
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
sub    %rax,%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11b0 <config_filter+0x70>
jmp    1209 <config_filter+0xc9>
mov    $0x1,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@config_filter.skip_prefix = internal constant [4 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* null]
@.str = [2 x i8] c".\00"
@.str.1 = [2 x i8] c"~\00"
@.str.2 = [4 x i8] c"CVS\00"
@config_filter.skip_suffix = internal constant [15 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* null]
@.str.3 = [9 x i8] c".rpmsave\00"
@.str.4 = [9 x i8] c".rpmorig\00"
@.str.5 = [8 x i8] c".rpmnew\00"
@.str.6 = [10 x i8] c".dpkg-old\00"
@.str.7 = [11 x i8] c".dpkg-dist\00"
@.str.8 = [10 x i8] c".dpkg-new\00"
@.str.9 = [10 x i8] c".dpkg-bak\00"
@.str.10 = [5 x i8] c".bak\00"
@.str.11 = [6 x i8] c".orig\00"
@.str.12 = [5 x i8] c".rej\00"
@.str.13 = [11 x i8] c".YaST2save\00"
@.str.14 = [3 x i8] c".-\00"
@.str.15 = [3 x i8] c",v\00"
define i32 @config_filter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @config_filter.skip_prefix, i64 0, i64 0), i8*** %4
br label %5
5: ; preds = %20, %1
%6 = load i8**, i8*** %4
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = call i64 @strlen(i8* %14)
%16 = call i64 @strncmp(i8* %10, i8* %12, i64 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %9
store i32 0, i32* %2
br label %52
19: ; preds = %9
br label %20
20: ; preds = %19
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %4
br label %5
23: ; preds = %5
store i8** getelementptr inbounds ([15 x i8*], [15 x i8*]* @config_filter.skip_suffix, i64 0, i64 0), i8*** %4
br label %24
24: ; preds = %48, %23
%25 = load i8**, i8*** %4
%26 = load i8*, i8** %25
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %51
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = call i64 @strlen(i8* %29)
%31 = load i8**, i8*** %4
%32 = load i8*, i8** %31
%33 = call i64 @strlen(i8* %32)
%34 = icmp sge i64 %30, %33
br i1 %34, label %35, label %47
35: ; preds = %28
%36 = load i8**, i8*** %4
%37 = load i8*, i8** %36
%38 = load i8*, i8** %3
%39 = call i64 @strchr(i8* %38, i32 0)
%40 = load i8**, i8*** %4
%41 = load i8*, i8** %40
%42 = call i64 @strlen(i8* %41)
%43 = sub nsw i64 %39, %42
%44 = call i64 @strcmp(i8* %37, i64 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %35
store i32 0, i32* %2
br label %52
47: ; preds = %35, %28
br label %48
48: ; preds = %47
%49 = load i8**, i8*** %4
%50 = getelementptr inbounds i8*, i8** %49, i32 1
store i8** %50, i8*** %4
br label %24
51: ; preds = %24
store i32 1, i32* %2
br label %52
52: ; preds = %51, %46, %18
%53 = load i32, i32* %2
ret i32 %53
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [2 x i8] c"~\00"
@.str.2 = [4 x i8] c"CVS\00"
@config_filter.skip_suffix = internal unnamed_addr constant [15 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* null]
@.str.3 = [9 x i8] c".rpmsave\00"
@.str.4 = [9 x i8] c".rpmorig\00"
@.str.5 = [8 x i8] c".rpmnew\00"
@.str.6 = [10 x i8] c".dpkg-old\00"
@.str.7 = [11 x i8] c".dpkg-dist\00"
@.str.8 = [10 x i8] c".dpkg-new\00"
@.str.9 = [10 x i8] c".dpkg-bak\00"
@.str.10 = [5 x i8] c".bak\00"
@.str.11 = [6 x i8] c".orig\00"
@.str.12 = [5 x i8] c".rej\00"
@.str.13 = [11 x i8] c".YaST2save\00"
@.str.14 = [3 x i8] c".-\00"
@.str.15 = [3 x i8] c",v\00"
define i32 @config_filter(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %27, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %27, label %7
7: ; preds = %4
%8 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %27, label %10
10: ; preds = %7, %23
%11 = phi i8* [ %25, %23 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %7 ]
%12 = phi i8** [ %24, %23 ], [ getelementptr inbounds ([15 x i8*], [15 x i8*]* @config_filter.skip_suffix, i64 0, i64 0), %7 ]
%13 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%14 = tail call i64 @strlen(i8* %11)
%15 = icmp slt i64 %13, %14
br i1 %15, label %23, label %16
16: ; preds = %10
%17 = tail call i64 @strchr(i8* %0, i32 0)
%18 = load i8*, i8** %12
%19 = tail call i64 @strlen(i8* dereferenceable(1) %18)
%20 = sub nsw i64 %17, %19
%21 = tail call i64 @strcmp(i8* %11, i64 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %10, %16
%24 = getelementptr inbounds i8*, i8** %12, i64 1
%25 = load i8*, i8** %24
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %10
27: ; preds = %23, %16, %1, %4, %7
%28 = phi i32 [ 0, %7 ], [ 0, %4 ], [ 0, %1 ], [ 1, %23 ], [ 0, %16 ]
ret i32 %28
}