#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 strcspn(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int PINT_dotconf_question_mark_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 >= pre_len) && (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_question_mark_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    0xe76(%rip),%rsi
call   1050 <strcspn@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11f8 <PINT_dotconf_question_mark_match+0xb8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f8 <PINT_dotconf_question_mark_match+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11f8 <PINT_dotconf_question_mark_match+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11f8 <PINT_dotconf_question_mark_match+0xb8>
movl   $0x1,-0x1c(%rbp)
jmp    125e <PINT_dotconf_question_mark_match+0x11e>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jl     1259 <PINT_dotconf_question_mark_match+0x119>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1259 <PINT_dotconf_question_mark_match+0x119>
mov    -0x8(%rbp),%rdi
lea    0xddb(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1259 <PINT_dotconf_question_mark_match+0x119>
mov    -0x8(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1259 <PINT_dotconf_question_mark_match+0x119>
movl   $0x0,-0x1c(%rbp)
jmp    125e <PINT_dotconf_question_mark_match+0x11e>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PINT_dotconf_question_mark_match>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcspn@plt>
cmp    %ebp,%eax
jge    1197 <PINT_dotconf_question_mark_match+0x57>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11df <PINT_dotconf_question_mark_match+0x9f>
mov    $0xffffffff,%ebx
cmp    %r13d,%r15d
jl     120c <PINT_dotconf_question_mark_match+0xcc>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    120c <PINT_dotconf_question_mark_match+0xcc>
lea    0xe49(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     120c <PINT_dotconf_question_mark_match+0xcc>
lea    0xe34(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
cmp    $0x1,%rax
sbb    %ebx,%ebx
jmp    120c <PINT_dotconf_question_mark_match+0xcc>
lea    0xe1e(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1197 <PINT_dotconf_question_mark_match+0x57>
lea    0xe09(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     1197 <PINT_dotconf_question_mark_match+0x57>
mov    %ebx,%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_question_mark_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 %58
38: ; preds = %33, %29, %23, %3
%39 = load i32, i32* %8
%40 = load i32, i32* %9
%41 = icmp sge i32 %39, %40
br i1 %41, label %42, label %57
42: ; preds = %38
%43 = load i8*, i8** %4
%44 = load i8*, i8** %5
%45 = load i32, i32* %9
%46 = call i64 @strncmp(i8* %43, i8* %44, i32 %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %57
48: ; preds = %42
%49 = load i8*, i8** %4
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = load i8*, i8** %4
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %52
store i32 0, i32* %7
br label %57
57: ; preds = %56, %52, %48, %42, %38
br label %58
58: ; preds = %57, %37
%59 = load i32, i32* %7
ret i32 %59
}

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_question_mark_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 %30
18: ; preds = %15, %12, %9, %3
%19 = icmp slt i32 %4, %5
br i1 %19, label %30, label %20
20: ; preds = %18
%21 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
%29 = sext i1 %28 to i32
br label %30
30: ; preds = %26, %15, %18, %20, %23
%31 = phi i32 [ -1, %23 ], [ -1, %20 ], [ -1, %18 ], [ 1, %15 ], [ %29, %26 ]
ret i32 %31
}