#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*/ osc_match_single_char(char const *, char const *);
int osc_match_star_r(const char *pattern, const char *address) {
  if (*address == '/' || *address == '\0') {
    if (*pattern == '/' || *pattern == '\0' ||
        (*pattern == '*' &&
         ((*(pattern + 1) == '/') || *(pattern + 1) == '\0'))) {
      return 1;
    } else {
      return 0;
    }
  }
  if (*pattern == '*') {
    if (osc_match_star_r(pattern + 1, address)) {
      return 1;
    } else {
      return osc_match_star_r(pattern, address + 1);
    }
  } else {
    if (!osc_match_single_char(pattern, address)) {
      return 0;
    }
    if (*pattern == '[' || *pattern == '{') {
      while (*pattern != ']' && *pattern != '}') {
        pattern++;
      }
    }
    return osc_match_star_r(pattern + 1, address + 1);
  }
}


x86 assembly (clang, -O0):
<osc_match_star_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1150 <osc_match_star_r+0x30>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11ba <osc_match_star_r+0x9a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     11a2 <osc_match_star_r+0x82>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a2 <osc_match_star_r+0x82>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    11ae <osc_match_star_r+0x8e>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
je     11a2 <osc_match_star_r+0x82>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    11ae <osc_match_star_r+0x8e>
movl   $0x1,-0x4(%rbp)
jmp    12b3 <osc_match_star_r+0x193>
movl   $0x0,-0x4(%rbp)
jmp    12b3 <osc_match_star_r+0x193>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1209 <osc_match_star_r+0xe9>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <osc_match_star_r@plt>
cmp    $0x0,%eax
je     11f0 <osc_match_star_r+0xd0>
movl   $0x1,-0x4(%rbp)
jmp    12b3 <osc_match_star_r+0x193>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1040 <osc_match_star_r@plt>
mov    %eax,-0x4(%rbp)
jmp    12b3 <osc_match_star_r+0x193>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <osc_match_single_char@plt>
cmp    $0x0,%eax
jne    122b <osc_match_star_r+0x10b>
movl   $0x0,-0x4(%rbp)
jmp    12b3 <osc_match_star_r+0x193>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
je     124b <osc_match_star_r+0x12b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
jne    129b <osc_match_star_r+0x17b>
jmp    1250 <osc_match_star_r+0x130>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5d,%ecx
mov    %al,-0x19(%rbp)
je     1275 <osc_match_star_r+0x155>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1285 <osc_match_star_r+0x165>
jmp    1296 <osc_match_star_r+0x176>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1250 <osc_match_star_r+0x130>
jmp    129b <osc_match_star_r+0x17b>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1040 <osc_match_star_r@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osc_match_star_r>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x1(%r14),%r15
nop
movzbl (%rbx),%eax
cmp    $0x2f,%al
je     11aa <osc_match_star_r+0x8a>
test   %al,%al
je     11aa <osc_match_star_r+0x8a>
cmpb   $0x2a,(%r14)
jne    1160 <osc_match_star_r+0x40>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <osc_match_star_r@plt>
test   %eax,%eax
jne    11d4 <osc_match_star_r+0xb4>
add    $0x1,%rbx
jmp    1130 <osc_match_star_r+0x10>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <osc_match_single_char@plt>
test   %eax,%eax
je     11db <osc_match_star_r+0xbb>
mov    (%r14),%al
mov    %eax,%ecx
or     $0x20,%cl
cmp    $0x7b,%cl
jne    11a0 <osc_match_star_r+0x80>
nopl   0x0(%rax)
or     $0x20,%al
cmp    $0x7d,%al
je     11a0 <osc_match_star_r+0x80>
movzbl 0x1(%r14),%eax
add    $0x1,%r14
jmp    1180 <osc_match_star_r+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
add    $0x1,%rbx
jmp    112b <osc_match_star_r+0xb>
mov    (%r14),%cl
mov    $0x1,%eax
test   %cl,%cl
je     11dd <osc_match_star_r+0xbd>
cmp    $0x2f,%cl
je     11dd <osc_match_star_r+0xbd>
cmp    $0x2a,%cl
jne    11db <osc_match_star_r+0xbb>
mov    (%r15),%al
cmp    $0x2f,%al
sete   %cl
test   %al,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
jmp    11dd <osc_match_star_r+0xbd>
mov    $0x1,%eax
jmp    11dd <osc_match_star_r+0xbd>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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