#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 */
int /*<<< orphan*/ glob_inrange_unsigned(unsigned char const **,
                                         unsigned char const);
int glob_match_unsigned(const unsigned char *pattern,
                        const unsigned char *string) {
  int is_match = 0;
  if (!*string) {
    if (*pattern == '*')
      is_match = glob_match_unsigned(pattern + 1, string);
    else
      is_match = !*pattern;
  } else {
    switch (*pattern) {
    case '\0':
      is_match = !*string;
      break;
    case '*':
      if (glob_match_unsigned(pattern + 1, string))
        is_match = (!0);
      else
        is_match = glob_match_unsigned(pattern, string + 1);
      break;
    case '?':
      is_match = glob_match_unsigned(pattern + 1, string + 1);
      break;
    case '[':
      is_match = glob_inrange_unsigned(&pattern, *string) &&
                 (!*pattern || glob_match_unsigned(pattern + 1, string + 1));
      break;
    default:
      is_match =
          *pattern == *string && glob_match_unsigned(pattern + 1, string + 1);
      break;
    }
  }
  return is_match;
}


x86 assembly (clang, -O0):
<glob_match_unsigned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1186 <glob_match_unsigned+0x66>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2a,%eax
jne    116d <glob_match_unsigned+0x4d>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <glob_match_unsigned@plt>
mov    %eax,-0x14(%rbp)
jmp    1181 <glob_match_unsigned+0x61>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
jmp    12f4 <glob_match_unsigned+0x1d4>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     11d0 <glob_match_unsigned+0xb0>
jmp    119d <glob_match_unsigned+0x7d>
mov    -0x18(%rbp),%eax
sub    $0x2a,%eax
je     11e9 <glob_match_unsigned+0xc9>
jmp    11ae <glob_match_unsigned+0x8e>
mov    -0x18(%rbp),%eax
sub    $0x3f,%eax
je     1228 <glob_match_unsigned+0x108>
jmp    11bf <glob_match_unsigned+0x9f>
mov    -0x18(%rbp),%eax
sub    $0x5b,%eax
je     1245 <glob_match_unsigned+0x125>
jmp    12ab <glob_match_unsigned+0x18b>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
jmp    12ef <glob_match_unsigned+0x1cf>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <glob_match_unsigned@plt>
cmp    $0x0,%eax
je     120f <glob_match_unsigned+0xef>
movl   $0x1,-0x14(%rbp)
jmp    1223 <glob_match_unsigned+0x103>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1040 <glob_match_unsigned@plt>
mov    %eax,-0x14(%rbp)
jmp    12ef <glob_match_unsigned+0x1cf>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1040 <glob_match_unsigned@plt>
mov    %eax,-0x14(%rbp)
jmp    12ef <glob_match_unsigned+0x1cf>
mov    -0x10(%rbp),%rax
lea    -0x8(%rbp),%rdi
movzbl (%rax),%esi
call   1030 <glob_inrange_unsigned@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     129b <glob_match_unsigned+0x17b>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,(%rcx)
mov    %al,-0x1a(%rbp)
je     1295 <glob_match_unsigned+0x175>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1040 <glob_match_unsigned@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
jmp    12ef <glob_match_unsigned+0x1cf>
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x10(%rbp),%rax
movzbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x1b(%rbp)
jne    12e4 <glob_match_unsigned+0x1c4>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1040 <glob_match_unsigned@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
jmp    12f4 <glob_match_unsigned+0x1d4>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glob_match_unsigned>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rdi,(%rsp)
mov    (%rsi),%al
test   %al,%al
je     117b <glob_match_unsigned+0x5b>
mov    %rsi,%r14
add    $0x1,%r14
jmp    1159 <glob_match_unsigned+0x39>
nopw   0x0(%rax,%rax,1)
cmp    $0x3f,%cl
jne    11a6 <glob_match_unsigned+0x86>
add    $0x1,%rbx
mov    %rbx,(%rsp)
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
je     117b <glob_match_unsigned+0x5b>
movzbl (%rbx),%ecx
cmp    $0x3e,%cl
jg     1140 <glob_match_unsigned+0x20>
cmp    $0x2a,%cl
jne    11c9 <glob_match_unsigned+0xa9>
lea    -0x1(%r14),%rsi
lea    0x1(%rbx),%rdi
call   1040 <glob_match_unsigned@plt>
test   %eax,%eax
je     1149 <glob_match_unsigned+0x29>
mov    $0x1,%al
jmp    11e9 <glob_match_unsigned+0xc9>
mov    (%rbx),%al
cmp    $0x2a,%al
jne    119f <glob_match_unsigned+0x7f>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,(%rsp)
movzbl (%rbx),%eax
add    $0x1,%rbx
cmp    $0x2a,%al
je     1190 <glob_match_unsigned+0x70>
test   %al,%al
sete   %al
jmp    11e9 <glob_match_unsigned+0xc9>
cmp    $0x5b,%cl
jne    11cd <glob_match_unsigned+0xad>
movzbl %al,%esi
mov    %rsp,%rdi
call   1030 <glob_inrange_unsigned@plt>
test   %eax,%eax
je     11e7 <glob_match_unsigned+0xc7>
mov    (%rsp),%rdi
cmpb   $0x0,(%rdi)
je     1177 <glob_match_unsigned+0x57>
add    $0x1,%rdi
jmp    11d8 <glob_match_unsigned+0xb8>
test   %cl,%cl
je     11e7 <glob_match_unsigned+0xc7>
cmp    %al,%cl
jne    11e7 <glob_match_unsigned+0xc7>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <glob_match_unsigned@plt>
test   %eax,%eax
setne  %al
jmp    11e9 <glob_match_unsigned+0xc9>
xor    %eax,%eax
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @glob_match_unsigned(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %27, %2
%7 = phi i8* [ %0, %2 ], [ %28, %27 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 42
br i1 %9, label %10, label %15
10: ; preds = %6, %10
%11 = phi i8* [ %12, %10 ], [ %7, %6 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8* %12, i8** %3
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 42
br i1 %14, label %10, label %15
15: ; preds = %10, %6
%16 = phi i8 [ %8, %6 ], [ %13, %10 ]
%17 = icmp eq i8 %16, 0
br label %48
18: ; preds = %2, %27
%19 = phi i8 [ %30, %27 ], [ %4, %2 ]
%20 = phi i8* [ %29, %27 ], [ %1, %2 ]
%21 = phi i8* [ %28, %27 ], [ %0, %2 ]
%22 = load i8, i8* %21
switch i8 %22, label %46 [
i8 0, label %48
i8 42, label %23
i8 63, label %32
i8 91, label %34
]
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %21, i64 1
%25 = tail call i32 @glob_match_unsigned(i8* %24, i8* %20)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %48
27: ; preds = %23, %32
%28 = phi i8* [ %33, %32 ], [ %21, %23 ]
%29 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %28, i8** %3
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %6, label %18
32: ; preds = %18
%33 = getelementptr inbounds i8, i8* %21, i64 1
br label %27
34: ; preds = %18
%35 = call i32 @glob_inrange_unsigned(i8** %3, i8 zeroext %19)
%36 = icmp eq i32 %35, 0
br i1 %36, label %48, label %37
37: ; preds = %34
%38 = load i8*, i8** %3
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %37
%42 = getelementptr inbounds i8, i8* %38, i64 1
%43 = getelementptr inbounds i8, i8* %20, i64 1
%44 = call i32 @glob_match_unsigned(i8* %42, i8* %43)
%45 = icmp ne i32 %44, 0
br label %48
46: ; preds = %18
%47 = icmp eq i8 %22, %19
br i1 %47, label %51, label %48
48: ; preds = %18, %23, %15, %37, %41, %34, %46, %51
%49 = phi i1 [ %55, %51 ], [ %17, %15 ], [ false, %34 ], [ true, %37 ], [ %45, %41 ], [ false, %46 ], [ true, %23 ], [ false, %18 ]
%50 = zext i1 %49 to i32
ret i32 %50
51: ; preds = %46
%52 = getelementptr inbounds i8, i8* %21, i64 1
%53 = getelementptr inbounds i8, i8* %20, i64 1
%54 = tail call i32 @glob_match_unsigned(i8* %52, i8* %53)
%55 = icmp ne i32 %54, 0
br label %48
}