#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 */
char *next_char_utf8(char const *);
int _Wildcard_Match_Core(const char *WC, const char *Str) {
  if (*WC == '\0')
    return *Str == '\0';
  if (*WC == '?')
    return _Wildcard_Match_Core(WC = next_char_utf8(WC),
                                Str = next_char_utf8(Str));
  else if (*WC == '*') {
    for (WC = next_char_utf8(WC); *Str; Str = next_char_utf8(Str))
      if (_Wildcard_Match_Core(WC, Str))
        return 1;
    return *WC == '\0';
  } else
    return *WC == *Str && _Wildcard_Match_Core(WC = next_char_utf8(WC),
                                               Str = next_char_utf8(Str));
  return -1;
}


x86 assembly (clang, -O0):
<_Wildcard_Match_Core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    115a <_Wildcard_Match_Core+0x3a>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1272 <_Wildcard_Match_Core+0x152>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
jne    119c <_Wildcard_Match_Core+0x7c>
mov    -0x10(%rbp),%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,-0x20(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <next_char_utf8@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
mov    %rsi,-0x18(%rbp)
call   1040 <_Wildcard_Match_Core@plt>
mov    %eax,-0x4(%rbp)
jmp    1272 <_Wildcard_Match_Core+0x152>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1219 <_Wildcard_Match_Core+0xf9>
mov    -0x10(%rbp),%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ff <_Wildcard_Match_Core+0xdf>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <_Wildcard_Match_Core@plt>
cmp    $0x0,%eax
je     11e8 <_Wildcard_Match_Core+0xc8>
movl   $0x1,-0x4(%rbp)
jmp    1272 <_Wildcard_Match_Core+0x152>
jmp    11ed <_Wildcard_Match_Core+0xcd>
mov    -0x18(%rbp),%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,-0x18(%rbp)
jmp    11b9 <_Wildcard_Match_Core+0x99>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1272 <_Wildcard_Match_Core+0x152>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x21(%rbp)
jne    1267 <_Wildcard_Match_Core+0x147>
mov    -0x10(%rbp),%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,-0x30(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <next_char_utf8@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
mov    %rsi,-0x18(%rbp)
call   1040 <_Wildcard_Match_Core@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Wildcard_Match_Core>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
cmp    $0x3f,%al
jne    114f <_Wildcard_Match_Core+0x2f>
mov    %rbx,%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,%r14
jmp    1130 <_Wildcard_Match_Core+0x10>
cmp    $0x2a,%al
je     1160 <_Wildcard_Match_Core+0x40>
test   %al,%al
jne    11a7 <_Wildcard_Match_Core+0x87>
cmpb   $0x0,(%r14)
sete   %al
jmp    11d7 <_Wildcard_Match_Core+0xb7>
mov    %rbx,%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,%rbx
cmpb   $0x0,(%r14)
je     119f <_Wildcard_Match_Core+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <_Wildcard_Match_Core@plt>
test   %eax,%eax
jne    11d5 <_Wildcard_Match_Core+0xb5>
mov    %r14,%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,%r14
cmpb   $0x0,(%rax)
jne    1180 <_Wildcard_Match_Core+0x60>
cmpb   $0x0,(%rbx)
sete   %al
jmp    11d7 <_Wildcard_Match_Core+0xb7>
cmp    (%r14),%al
jne    11d1 <_Wildcard_Match_Core+0xb1>
mov    %rbx,%rdi
call   1030 <next_char_utf8@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <next_char_utf8@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <_Wildcard_Match_Core@plt>
test   %eax,%eax
setne  %al
jmp    11d7 <_Wildcard_Match_Core+0xb7>
xor    %eax,%eax
jmp    11d7 <_Wildcard_Match_Core+0xb7>
mov    $0x1,%al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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