#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__ strcmp(char *, char *);
int strlen(char *);
int sources_filter(char *name) {
  int len = strlen(name);
  if (len > 2) {
    if ((strcmp(".h", name + len - 2) == 0) ||
        (strcmp(".d", name + len - 2) == 0)) {
      return 1;
    }
  }
  if (len > 4) {
    if ((strcmp(".asn", name + len - 4) == 0) ||
        (strcmp(".map", name + len - 4) == 0)) {
      return 1;
    }
  }
  if (len > 5) {
    if (strcmp(".list", name + len - 5) == 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sources_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jle    119d <sources_filter+0x7d>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0xfffffffffffffffe,%rsi
lea    0xea8(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     118c <sources_filter+0x6c>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0xfffffffffffffffe,%rsi
lea    0xe86(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <sources_filter+0x78>
movl   $0x1,-0x4(%rbp)
jmp    1249 <sources_filter+0x129>
jmp    119d <sources_filter+0x7d>
cmpl   $0x4,-0x14(%rbp)
jle    1202 <sources_filter+0xe2>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0xfffffffffffffffc,%rsi
lea    0xe49(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11f1 <sources_filter+0xd1>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0xfffffffffffffffc,%rsi
lea    0xe29(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11fd <sources_filter+0xdd>
movl   $0x1,-0x4(%rbp)
jmp    1249 <sources_filter+0x129>
jmp    1202 <sources_filter+0xe2>
cmpl   $0x5,-0x14(%rbp)
jle    1242 <sources_filter+0x122>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0xfffffffffffffffb,%rsi
lea    0xdee(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    123d <sources_filter+0x11d>
movl   $0x1,-0x4(%rbp)
jmp    1249 <sources_filter+0x129>
jmp    1242 <sources_filter+0x122>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sources_filter>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
cmp    $0x3,%eax
jl     11c5 <sources_filter+0xa5>
mov    %eax,%ebp
mov    %eax,%r12d
lea    (%r15,%r12,1),%rbx
add    $0xfffffffffffffffe,%rbx
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     11c8 <sources_filter+0xa8>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <sources_filter+0xa8>
cmp    $0x5,%ebp
jb     11c5 <sources_filter+0xa5>
add    %r12,%r15
lea    -0x4(%r15),%rbx
lea    0xe7f(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <sources_filter+0xa8>
lea    0xe70(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <sources_filter+0xa8>
cmp    $0x6,%ebp
jb     11c5 <sources_filter+0xa5>
add    $0xfffffffffffffffb,%r15
lea    0xe58(%rip),%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <sources_filter+0xa8>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c".h\00"
@.str.1 = [3 x i8] c".d\00"
@.str.2 = [5 x i8] c".asn\00"
@.str.3 = [5 x i8] c".map\00"
@.str.4 = [6 x i8] c".list\00"
define i32 @sources_filter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %27
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = getelementptr inbounds i8, i8* %13, i64 -2
%15 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 -2
%23 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %17, %9
store i32 1, i32* %2
br label %62
26: ; preds = %17
br label %27
27: ; preds = %26, %1
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 4
br i1 %29, label %30, label %48
30: ; preds = %27
%31 = load i8*, i8** %3
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = getelementptr inbounds i8, i8* %34, i64 -4
%36 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %46, label %38
38: ; preds = %30
%39 = load i8*, i8** %3
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = getelementptr inbounds i8, i8* %42, i64 -4
%44 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %38, %30
store i32 1, i32* %2
br label %62
47: ; preds = %38
br label %48
48: ; preds = %47, %27
%49 = load i32, i32* %4
%50 = icmp sgt i32 %49, 5
br i1 %50, label %51, label %61
51: ; preds = %48
%52 = load i8*, i8** %3
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
%56 = getelementptr inbounds i8, i8* %55, i64 -5
%57 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %51
store i32 1, i32* %2
br label %62
60: ; preds = %51
br label %61
61: ; preds = %60, %48
store i32 0, i32* %2
br label %62
62: ; preds = %61, %59, %46, %25
%63 = load i32, i32* %2
ret i32 %63
}

LLVM IR (-O2):
@.str = [3 x i8] c".h\00"
@.str.1 = [3 x i8] c".d\00"
@.str.2 = [5 x i8] c".asn\00"
@.str.3 = [5 x i8] c".map\00"
@.str.4 = [6 x i8] c".list\00"
define i32 @sources_filter(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 2
br i1 %3, label %4, label %28
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = getelementptr inbounds i8, i8* %6, i64 -2
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %4
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %29, label %13
13: ; preds = %10
%14 = icmp ugt i32 %2, 4
br i1 %14, label %15, label %28
15: ; preds = %13
%16 = getelementptr inbounds i8, i8* %6, i64 -4
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %29, label %19
19: ; preds = %15
%20 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%21 = icmp eq i64 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %19
%23 = icmp ugt i32 %2, 5
br i1 %23, label %24, label %28
24: ; preds = %22
%25 = getelementptr inbounds i8, i8* %6, i64 -5
%26 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %1, %13, %24, %22
br label %29
29: ; preds = %24, %15, %19, %4, %10, %28
%30 = phi i32 [ 0, %28 ], [ 1, %10 ], [ 1, %4 ], [ 1, %19 ], [ 1, %15 ], [ 1, %24 ]
ret i32 %30
}