#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__ PINT_dotconf_strcmp_from_back(char *, char *);
scalar_t__ strcmp(char *, char *);
int strcspn(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int PINT_dotconf_star_match(char *dir_name, char *pre, char *ext) {
  int retval = -1;
  int dir_name_len = strlen(dir_name);
  int pre_len = strlen(pre);
  int ext_len = strlen(ext);
  int w_card_check = strcspn(ext, "*?");
  if ((w_card_check < ext_len) && (strncmp(dir_name, pre, pre_len) == 0) &&
      (strcmp(dir_name, ".") != 0) && (strcmp(dir_name, "..") != 0)) {
    retval = 1;
  } else {
    if ((dir_name_len >= (ext_len + pre_len)) &&
        (PINT_dotconf_strcmp_from_back(dir_name, ext) == 0) &&
        (strncmp(dir_name, pre, pre_len) == 0) &&
        (strcmp(dir_name, ".") != 0) && (strcmp(dir_name, "..") != 0)) {
      retval = 0;
    }
  }
  return retval;
}


x86 assembly (clang, -O0):
<PINT_dotconf_star_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1050 <strcspn@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1208 <PINT_dotconf_star_match+0xb8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1208 <PINT_dotconf_star_match+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1208 <PINT_dotconf_star_match+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1208 <PINT_dotconf_star_match+0xb8>
movl   $0x1,-0x1c(%rbp)
jmp    128a <PINT_dotconf_star_match+0x13a>
mov    -0x20(%rbp),%eax
mov    -0x28(%rbp),%ecx
add    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jl     1285 <PINT_dotconf_star_match+0x135>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <PINT_dotconf_strcmp_from_back@plt>
cmp    $0x0,%rax
jne    1285 <PINT_dotconf_star_match+0x135>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1285 <PINT_dotconf_star_match+0x135>
mov    -0x8(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1285 <PINT_dotconf_star_match+0x135>
mov    -0x8(%rbp),%rdi
lea    0xd94(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1285 <PINT_dotconf_star_match+0x135>
movl   $0x0,-0x1c(%rbp)
jmp    128a <PINT_dotconf_star_match+0x13a>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PINT_dotconf_star_match>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %eax,0x4(%rsp)
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcspn@plt>
cmp    %r12d,%eax
jge    11aa <PINT_dotconf_star_match+0x5a>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1207 <PINT_dotconf_star_match+0xb7>
add    %r13d,%r12d
mov    $0xffffffff,%ebp
cmp    %r12d,0x4(%rsp)
jl     1238 <PINT_dotconf_star_match+0xe8>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <PINT_dotconf_strcmp_from_back@plt>
test   %rax,%rax
jne    1238 <PINT_dotconf_star_match+0xe8>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1238 <PINT_dotconf_star_match+0xe8>
lea    0xe21(%rip),%rsi
mov    %r15,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1238 <PINT_dotconf_star_match+0xe8>
lea    0xe0c(%rip),%rsi
mov    %r15,%rdi
call   1060 <strcmp@plt>
cmp    $0x1,%rax
sbb    %ebp,%ebp
jmp    1238 <PINT_dotconf_star_match+0xe8>
lea    0xdf6(%rip),%rsi
mov    %r15,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11aa <PINT_dotconf_star_match+0x5a>
lea    0xde1(%rip),%rsi
mov    %r15,%rdi
call   1060 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     11aa <PINT_dotconf_star_match+0x5a>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"*?\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"..\00"
define i32 @PINT_dotconf_star_match(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @strlen(i8* %2)
%7 = tail call i32 @strcspn(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp slt i32 %7, %6
br i1 %8, label %9, label %18
9: ; preds = %3
%10 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %5)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %34
18: ; preds = %15, %12, %9, %3
%19 = add nsw i32 %6, %5
%20 = icmp slt i32 %4, %19
br i1 %20, label %34, label %21
21: ; preds = %18
%22 = tail call i64 @PINT_dotconf_strcmp_from_back(i8* %0, i8* %2)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %5)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %24
%28 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
%33 = sext i1 %32 to i32
br label %34
34: ; preds = %30, %15, %18, %21, %24, %27
%35 = phi i32 [ -1, %27 ], [ -1, %24 ], [ -1, %21 ], [ -1, %18 ], [ 1, %15 ], [ %33, %30 ]
ret i32 %35
}