#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 osc_match_bracket(char const *, char const *);
int osc_match_curly_brace(char const *, char const *);
int osc_match_single_char(const char *pattern, const char *address) {
  switch (*pattern) {
  case '[':
    return osc_match_bracket(pattern, address);
  case ']':
    while (*pattern != '[') {
      pattern--;
    }
    return osc_match_bracket(pattern, address);
  case '{':
    return osc_match_curly_brace(pattern, address);
  case '}':
    while (*pattern != '{') {
      pattern--;
    }
    return osc_match_curly_brace(pattern, address);
  case '?':
    return 1;
  default:
    if (*pattern == *address) {
      return 1;
    } else {
      return 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<osc_match_single_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x3f,%eax
je     122c <osc_match_single_char+0x10c>
jmp    1148 <osc_match_single_char+0x28>
mov    -0x1c(%rbp),%eax
sub    $0x5b,%eax
je     118c <osc_match_single_char+0x6c>
jmp    1159 <osc_match_single_char+0x39>
mov    -0x1c(%rbp),%eax
sub    $0x5d,%eax
je     11a1 <osc_match_single_char+0x81>
jmp    116a <osc_match_single_char+0x4a>
mov    -0x1c(%rbp),%eax
sub    $0x7b,%eax
je     11dc <osc_match_single_char+0xbc>
jmp    117b <osc_match_single_char+0x5b>
mov    -0x1c(%rbp),%eax
sub    $0x7d,%eax
je     11f1 <osc_match_single_char+0xd1>
jmp    1238 <osc_match_single_char+0x118>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <osc_match_bracket@plt>
mov    %eax,-0x4(%rbp)
jmp    1261 <osc_match_single_char+0x141>
jmp    11a6 <osc_match_single_char+0x86>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
je     11c7 <osc_match_single_char+0xa7>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    11a6 <osc_match_single_char+0x86>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <osc_match_bracket@plt>
mov    %eax,-0x4(%rbp)
jmp    1261 <osc_match_single_char+0x141>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <osc_match_curly_brace@plt>
mov    %eax,-0x4(%rbp)
jmp    1261 <osc_match_single_char+0x141>
jmp    11f6 <osc_match_single_char+0xd6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
je     1217 <osc_match_single_char+0xf7>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    11f6 <osc_match_single_char+0xd6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <osc_match_curly_brace@plt>
mov    %eax,-0x4(%rbp)
jmp    1261 <osc_match_single_char+0x141>
movl   $0x1,-0x4(%rbp)
jmp    1261 <osc_match_single_char+0x141>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    125a <osc_match_single_char+0x13a>
movl   $0x1,-0x4(%rbp)
jmp    1261 <osc_match_single_char+0x141>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osc_match_single_char>:
mov    (%rdi),%cl
movsbl %cl,%edx
lea    -0x5b(%rdx),%eax
cmp    $0x22,%eax
ja     1165 <osc_match_single_char+0x45>
lea    0xecc(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
cmp    $0x5b,%cl
jne    1150 <osc_match_single_char+0x30>
jmp    1030 <osc_match_bracket@plt>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rdi),%rax
cmpb   $0x5b,-0x1(%rdi)
mov    %rax,%rdi
jne    1150 <osc_match_single_char+0x30>
mov    %rax,%rdi
jmp    1030 <osc_match_bracket@plt>
mov    $0x1,%eax
cmp    $0x3f,%edx
je     1176 <osc_match_single_char+0x56>
xor    %eax,%eax
cmp    (%rsi),%cl
sete   %al
ret
cmp    $0x7b,%cl
jne    1190 <osc_match_single_char+0x70>
jmp    1040 <osc_match_curly_brace@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rdi),%rax
cmpb   $0x7b,-0x1(%rdi)
mov    %rax,%rdi
jne    1190 <osc_match_single_char+0x70>
mov    %rax,%rdi
jmp    1040 <osc_match_curly_brace@plt>

LLVM IR (-O0):
define i32 @osc_match_single_char(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 %44 [
i32 91, label %9
i32 93, label %13
i32 123, label %26
i32 125, label %30
i32 63, label %43
]
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = call i32 @osc_match_bracket(i8* %10, i8* %11)
store i32 %12, i32* %3
br label %54
13: ; preds = %2
br label %14
14: ; preds = %19, %13
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 91
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 -1
store i8* %21, i8** %4
br label %14
22: ; preds = %14
%23 = load i8*, i8** %4
%24 = load i8*, i8** %5
%25 = call i32 @osc_match_bracket(i8* %23, i8* %24)
store i32 %25, i32* %3
br label %54
26: ; preds = %2
%27 = load i8*, i8** %4
%28 = load i8*, i8** %5
%29 = call i32 @osc_match_curly_brace(i8* %27, i8* %28)
store i32 %29, i32* %3
br label %54
30: ; preds = %2
br label %31
31: ; preds = %36, %30
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 123
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i32 -1
store i8* %38, i8** %4
br label %31
39: ; preds = %31
%40 = load i8*, i8** %4
%41 = load i8*, i8** %5
%42 = call i32 @osc_match_curly_brace(i8* %40, i8* %41)
store i32 %42, i32* %3
br label %54
43: ; preds = %2
store i32 1, i32* %3
br label %54
44: ; preds = %2
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = load i8*, i8** %5
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %47, %50
br i1 %51, label %52, label %53
52: ; preds = %44
store i32 1, i32* %3
br label %54
53: ; preds = %44
store i32 0, i32* %3
br label %54
54: ; preds = %53, %52, %43, %39, %26, %22, %9
%55 = load i32, i32* %3
ret i32 %55
}

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