#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*/ toupper(char const);
int strwildmatch(const char *pattern, const char *string) {
  switch (*pattern) {
  case '\0':
    return *string;
  case '*':
    return !(!strwildmatch(pattern + 1, string) ||
             *string && !strwildmatch(pattern, string + 1));
  case '?':
    return !(*string && !strwildmatch(pattern + 1, string + 1));
  default:
    return !((toupper(*pattern) == toupper(*string)) &&
             !strwildmatch(pattern + 1, string + 1));
  }
}


x86 assembly (clang, -O0):
<strwildmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     1169 <strwildmatch+0x49>
jmp    1147 <strwildmatch+0x27>
mov    -0x1c(%rbp),%eax
sub    $0x2a,%eax
je     1178 <strwildmatch+0x58>
jmp    1158 <strwildmatch+0x38>
mov    -0x1c(%rbp),%eax
sub    $0x3f,%eax
je     11e2 <strwildmatch+0xc2>
jmp    1229 <strwildmatch+0x109>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1283 <strwildmatch+0x163>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strwildmatch@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     11d0 <strwildmatch+0xb0>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1e(%rbp)
je     11ca <strwildmatch+0xaa>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1040 <strwildmatch@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1283 <strwildmatch+0x163>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1f(%rbp)
je     1217 <strwildmatch+0xf7>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1040 <strwildmatch@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1f(%rbp)
mov    -0x1f(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1283 <strwildmatch+0x163>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x24(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x20(%rbp)
jne    1276 <strwildmatch+0x156>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1040 <strwildmatch@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x20(%rbp)
mov    -0x20(%rbp),%al
xor    $0xff,%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):
<strwildmatch>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
cmp    $0x3f,%edi
je     1141 <strwildmatch+0x21>
cmp    $0x2a,%edi
je     1149 <strwildmatch+0x29>
test   %edi,%edi
jne    1166 <strwildmatch+0x46>
movsbl (%r14),%eax
jmp    11a1 <strwildmatch+0x81>
cmpb   $0x0,(%r14)
jne    1181 <strwildmatch+0x61>
jmp    115f <strwildmatch+0x3f>
lea    0x1(%rbx),%rdi
mov    %r14,%rsi
call   1040 <strwildmatch@plt>
test   %eax,%eax
je     119f <strwildmatch+0x7f>
cmpb   $0x0,(%r14)
jne    1185 <strwildmatch+0x65>
mov    $0x1,%eax
jmp    11a1 <strwildmatch+0x81>
call   1030 <toupper@plt>
mov    %eax,%ebp
movsbl (%r14),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%ebp
jne    11a1 <strwildmatch+0x81>
add    $0x1,%rbx
add    $0x1,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strwildmatch@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    11a1 <strwildmatch+0x81>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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