#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 *, char *);
int glob_match_after_star(char *pattern, char *text) {
  register 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 == '[' || *t == c1) && glob_match(p - 1, t))
      return 1;
    if (*t++ == '\0')
      return 0;
  }
}


x86 assembly (clang, -O0):
<glob_match_after_star>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    %al,-0x29(%rbp)
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0x3f,%ecx
mov    %al,-0x2b(%rbp)
je     1162 <glob_match_after_star+0x52>
movsbl -0x29(%rbp),%eax
cmp    $0x2a,%eax
sete   %al
mov    %al,-0x2b(%rbp)
mov    -0x2b(%rbp),%al
test   $0x1,%al
jne    1172 <glob_match_after_star+0x62>
jmp    11ab <glob_match_after_star+0x9b>
movsbl -0x29(%rbp),%eax
cmp    $0x3f,%eax
jne    11a6 <glob_match_after_star+0x96>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a6 <glob_match_after_star+0x96>
movl   $0x0,-0x4(%rbp)
jmp    125d <glob_match_after_star+0x14d>
jmp    1130 <glob_match_after_star+0x20>
movsbl -0x29(%rbp),%eax
cmp    $0x0,%eax
jne    11c4 <glob_match_after_star+0xb4>
movl   $0x1,-0x4(%rbp)
jmp    125d <glob_match_after_star+0x14d>
movsbl -0x29(%rbp),%eax
cmp    $0x5c,%eax
jne    11df <glob_match_after_star+0xcf>
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x2a(%rbp)
jmp    11e5 <glob_match_after_star+0xd5>
mov    -0x29(%rbp),%al
mov    %al,-0x2a(%rbp)
jmp    11ea <glob_match_after_star+0xda>
movsbl -0x29(%rbp),%eax
cmp    $0x5b,%eax
je     120a <glob_match_after_star+0xfa>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x2a(%rbp),%ecx
cmp    %ecx,%eax
jne    1231 <glob_match_after_star+0x121>
mov    -0x20(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
mov    -0x28(%rbp),%rsi
call   1030 <glob_match@plt>
cmp    $0x0,%rax
je     1231 <glob_match_after_star+0x121>
movl   $0x1,-0x4(%rbp)
jmp    125d <glob_match_after_star+0x14d>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1258 <glob_match_after_star+0x148>
movl   $0x0,-0x4(%rbp)
jmp    125d <glob_match_after_star+0x14d>
jmp    11ea <glob_match_after_star+0xda>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glob_match_after_star>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
nopl   (%rax)
movzbl (%r14),%ebp
add    $0x1,%r14
cmp    $0x2a,%bpl
je     1120 <glob_match_after_star+0x10>
test   %bpl,%bpl
je     119a <glob_match_after_star+0x8a>
cmp    $0x5c,%bpl
je     114c <glob_match_after_star+0x3c>
cmp    $0x3f,%bpl
jne    1154 <glob_match_after_star+0x44>
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <glob_match_after_star+0x10>
xor    %eax,%eax
jmp    119f <glob_match_after_star+0x8f>
mov    (%r14),%bpl
xor    %r15d,%r15d
jmp    115c <glob_match_after_star+0x4c>
cmp    $0x5b,%bpl
sete   %r15b
add    $0xffffffffffffffff,%r14
jmp    1178 <glob_match_after_star+0x68>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
test   %al,%al
je     1148 <glob_match_after_star+0x38>
test   %r15b,%r15b
jne    1185 <glob_match_after_star+0x75>
movzbl (%rbx),%eax
cmp    %bpl,%al
jne    1170 <glob_match_after_star+0x60>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <glob_match@plt>
test   %rax,%rax
jne    119a <glob_match_after_star+0x8a>
movzbl (%rbx),%eax
jmp    1170 <glob_match_after_star+0x60>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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