#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__ glob_match(char const *, char const *, int const);
scalar_t__ tolower(char const);
int glob_match_after_star(const char *pattern, const char *text,
                          const int casecmp) {
  register const char *p = pattern, *t = text;
  register char c, c1;
  while ((c = *p++) == '?' || c == '*')
    if (c == '?' && *t++ == '\0')
      return 0;
  if (c == '\0')
    return 1;
  if (c == '\\')
    c1 = *p;
  else
    c1 = c;
  while (1) {
    if ((c == '[' || (casecmp ? (*t == c1) : (tolower(*t) == tolower(c1)))) &&
        glob_match(p - 1, t, casecmp))
      return 1;
    if (*t++ == '\0')
      return 0;
  }
}


x86 assembly (clang, -O0):
<glob_match_after_star>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%al
mov    %al,-0x31(%rbp)
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0x3f,%ecx
mov    %al,-0x33(%rbp)
je     1175 <glob_match_after_star+0x55>
movsbl -0x31(%rbp),%eax
cmp    $0x2a,%eax
sete   %al
mov    %al,-0x33(%rbp)
mov    -0x33(%rbp),%al
test   $0x1,%al
jne    1185 <glob_match_after_star+0x65>
jmp    11be <glob_match_after_star+0x9e>
movsbl -0x31(%rbp),%eax
cmp    $0x3f,%eax
jne    11b9 <glob_match_after_star+0x99>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11b9 <glob_match_after_star+0x99>
movl   $0x0,-0x4(%rbp)
jmp    12ab <glob_match_after_star+0x18b>
jmp    1143 <glob_match_after_star+0x23>
movsbl -0x31(%rbp),%eax
cmp    $0x0,%eax
jne    11d7 <glob_match_after_star+0xb7>
movl   $0x1,-0x4(%rbp)
jmp    12ab <glob_match_after_star+0x18b>
movsbl -0x31(%rbp),%eax
cmp    $0x5c,%eax
jne    11f2 <glob_match_after_star+0xd2>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x32(%rbp)
jmp    11f8 <glob_match_after_star+0xd8>
mov    -0x31(%rbp),%al
mov    %al,-0x32(%rbp)
jmp    11fd <glob_match_after_star+0xdd>
movsbl -0x31(%rbp),%eax
cmp    $0x5b,%eax
je     1255 <glob_match_after_star+0x135>
cmpl   $0x0,-0x1c(%rbp)
je     122c <glob_match_after_star+0x10c>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x32(%rbp),%ecx
cmp    %ecx,%eax
je     1255 <glob_match_after_star+0x135>
jmp    127f <glob_match_after_star+0x15f>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,-0x40(%rbp)
movsbl -0x32(%rbp),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
jne    127f <glob_match_after_star+0x15f>
mov    -0x28(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
mov    -0x30(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <glob_match@plt>
cmp    $0x0,%rax
je     127f <glob_match_after_star+0x15f>
movl   $0x1,-0x4(%rbp)
jmp    12ab <glob_match_after_star+0x18b>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    12a6 <glob_match_after_star+0x186>
movl   $0x0,-0x4(%rbp)
jmp    12ab <glob_match_after_star+0x18b>
jmp    11fd <glob_match_after_star+0xdd>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glob_match_after_star>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%r13d
add    $0x1,%rbx
cmp    $0x2a,%r13b
je     1140 <glob_match_after_star+0x20>
test   %r13b,%r13b
je     11df <glob_match_after_star+0xbf>
cmp    $0x5c,%r13b
je     1171 <glob_match_after_star+0x51>
cmp    $0x3f,%r13b
jne    1179 <glob_match_after_star+0x59>
cmpb   $0x0,0x0(%rbp)
lea    0x1(%rbp),%rbp
jne    1140 <glob_match_after_star+0x20>
xor    %eax,%eax
jmp    11e4 <glob_match_after_star+0xc4>
mov    (%rbx),%r13b
xor    %r15d,%r15d
jmp    1181 <glob_match_after_star+0x61>
cmp    $0x5b,%r13b
sete   %r15b
add    $0xffffffffffffffff,%rbx
movsbl %r13b,%eax
mov    %eax,0x4(%rsp)
jmp    11af <glob_match_after_star+0x8f>
nop
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1040 <glob_match@plt>
test   %rax,%rax
jne    11df <glob_match_after_star+0xbf>
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
je     116d <glob_match_after_star+0x4d>
test   %r15b,%r15b
jne    1190 <glob_match_after_star+0x70>
movzbl 0x0(%rbp),%eax
test   %r14d,%r14d
je     11c4 <glob_match_after_star+0xa4>
cmp    %r13b,%al
je     1190 <glob_match_after_star+0x70>
jmp    11a7 <glob_match_after_star+0x87>
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %rax,%r12
mov    0x4(%rsp),%edi
call   1030 <tolower@plt>
cmp    %rax,%r12
jne    11a3 <glob_match_after_star+0x83>
jmp    1190 <glob_match_after_star+0x70>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @glob_match_after_star(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8
%11 = alloca i8
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%12 = load i8*, i8** %5
store i8* %12, i8** %8
%13 = load i8*, i8** %6
store i8* %13, i8** %9
br label %14
14: ; preds = %37, %3
%15 = load i8*, i8** %8
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %8
%17 = load i8, i8* %15
store i8 %17, i8* %10
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 63
br i1 %19, label %24, label %20
20: ; preds = %14
%21 = load i8, i8* %10
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 42
br label %24
24: ; preds = %20, %14
%25 = phi i1 [ true, %14 ], [ %23, %20 ]
br i1 %25, label %26, label %38
26: ; preds = %24
%27 = load i8, i8* %10
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 63
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i8*, i8** %9
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %9
%33 = load i8, i8* %31
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 0, i32* %4
br label %90
37: ; preds = %30, %26
br label %14
38: ; preds = %24
%39 = load i8, i8* %10
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 1, i32* %4
br label %90
43: ; preds = %38
%44 = load i8, i8* %10
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 92
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i8*, i8** %8
%49 = load i8, i8* %48
store i8 %49, i8* %11
br label %52
50: ; preds = %43
%51 = load i8, i8* %10
store i8 %51, i8* %11
br label %52
52: ; preds = %50, %47
br label %53
53: ; preds = %52, %89
%54 = load i8, i8* %10
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 91
br i1 %56, label %74, label %57
57: ; preds = %53
%58 = load i32, i32* %7
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %67
60: ; preds = %57
%61 = load i8*, i8** %9
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = load i8, i8* %11
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %63, %65
br i1 %66, label %74, label %82
67: ; preds = %57
%68 = load i8*, i8** %9
%69 = load i8, i8* %68
%70 = call i64 @tolower(i8 signext %69)
%71 = load i8, i8* %11
%72 = call i64 @tolower(i8 signext %71)
%73 = icmp eq i64 %70, %72
br i1 %73, label %74, label %82
74: ; preds = %67, %60, %53
%75 = load i8*, i8** %8
%76 = getelementptr inbounds i8, i8* %75, i64 -1
%77 = load i8*, i8** %9
%78 = load i32, i32* %7
%79 = call i64 @glob_match(i8* %76, i8* %77, i32 %78)
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %82
81: ; preds = %74
store i32 1, i32* %4
br label %90
82: ; preds = %74, %67, %60
%83 = load i8*, i8** %9
%84 = getelementptr inbounds i8, i8* %83, i32 1
store i8* %84, i8** %9
%85 = load i8, i8* %83
%86 = sext i8 %85 to i32
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %82
store i32 0, i32* %4
br label %90
89: ; preds = %82
br label %53
90: ; preds = %88, %81, %42, %36
%91 = load i32, i32* %4
ret i32 %91
}

LLVM IR (-O2):
define i32 @glob_match_after_star(i8* %0, i8* %1, i32 %2) {
br label %4
4: ; preds = %11, %3
%5 = phi i8* [ %9, %11 ], [ %0, %3 ]
%6 = phi i8* [ %12, %11 ], [ %1, %3 ]
br label %7
7: ; preds = %4, %7
%8 = phi i8* [ %9, %7 ], [ %5, %4 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %8
switch i8 %10, label %17 [
i8 63, label %11
i8 42, label %7
i8 0, label %42
i8 92, label %15
]
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %6
%14 = icmp eq i8 %13, 0
br i1 %14, label %42, label %4
15: ; preds = %7
%16 = load i8, i8* %9
br label %19
17: ; preds = %7
%18 = icmp eq i8 %10, 91
br label %19
19: ; preds = %17, %15
%20 = phi i1 [ false, %15 ], [ %18, %17 ]
%21 = phi i8 [ %16, %15 ], [ %10, %17 ]
%22 = icmp eq i32 %2, 0
br label %23
23: ; preds = %38, %19
%24 = phi i8* [ %6, %19 ], [ %40, %38 ]
br i1 %20, label %33, label %25
25: ; preds = %23
%26 = load i8, i8* %24
br i1 %22, label %29, label %27
27: ; preds = %25
%28 = icmp eq i8 %26, %21
br i1 %28, label %33, label %38
29: ; preds = %25
%30 = tail call i64 @tolower(i8 signext %26)
%31 = tail call i64 @tolower(i8 signext %21)
%32 = icmp eq i64 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %29, %27, %23
%34 = tail call i64 @glob_match(i8* %8, i8* %24, i32 %2)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %29, %33
%37 = load i8, i8* %24
br label %38
38: ; preds = %36, %27
%39 = phi i8 [ %37, %36 ], [ %26, %27 ]
%40 = getelementptr inbounds i8, i8* %24, i64 1
%41 = icmp eq i8 %39, 0
br i1 %41, label %42, label %23
42: ; preds = %7, %11, %38, %33
%43 = phi i32 [ 0, %38 ], [ 1, %33 ], [ 1, %7 ], [ 0, %11 ]
ret i32 %43
}