#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 */
scalar_t__ basicRgrep(char *, char *, int, int);
size_t checkForSpecialChar(char *);
int /*<<< orphan*/ escapeChar(char *, char *);
int firstOccur(char *, char);
int /*<<< orphan*/ matchPatternDots(char *, char *);
int /*<<< orphan*/ multiplePlus(char *, char *);
int /*<<< orphan*/ patternDotAfterPlus(char *, char *);
int /*<<< orphan*/ patternSinglePlus(char *, char *);
int /*<<< orphan*/ quesCount(char *);
int /*<<< orphan*/ quesMark(char *, char *);
int /*<<< orphan*/ samePattern(char *);
int strleng(char *);
int rgrep_matches(char *line, char *pattern) {
  int n = strleng(pattern);
  int m = strleng(line);
  if (n == 0 || m == 0) {
    return 0;
  }
  if (checkForSpecialChar(pattern) != 5000) {
    switch (pattern[checkForSpecialChar(pattern)]) {
    case '.':
      if (samePattern(pattern)) {
        if (m == n)
          return 1;
        else
          return 0;
      } else if (firstOccur(pattern, '+') != 5000) {
        if (patternDotAfterPlus(pattern, line)) {
          return 1;
        }
        return 0;
      } else if (firstOccur(pattern, '?') != 5000) {
        if (m == n - quesCount(pattern)) {
          return 1;
        }
        return 0;
      } else if (matchPatternDots(pattern, line)) {
        return 1;
      } else
        return 0;
    case '\\':
      if (n == 2) {
        if (pattern[1] == '?') {
          pattern = "?";
          if (basicRgrep(pattern, line, 1, m))
            return 1;
        } else if (pattern[1] == '.') {
          pattern = ".";
          if (basicRgrep(pattern, line, 1, m))
            return 1;
        }
        return 0;
      } else if (n == 3) {
        if (pattern[1] == '\\') {
          if (pattern[2] == '+') {
            pattern = "\\";
            for (int i = 0; i < m; i++) {
              if (line[i] == pattern[0])
                return 1;
            }
          }
        }
      } else {
        if (escapeChar(pattern, line))
          return 1;
        else
          return 0;
      }
    case '+':
      if (n == 1)
        return 1;
      if (multiplePlus(pattern, line))
        return 1;
      if (patternSinglePlus(pattern, line))
        return 1;
      return 0;
    case '?':
      if (n == 1) {
        pattern = "?";
        if (basicRgrep(pattern, line, 1, m))
          return 1;
      } else if (quesMark(pattern, line))
        return 1;
      else
        return 0;
    default:
      return 0;
    }
  } else {
    if (basicRgrep(pattern, line, n, m))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<rgrep_matches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strleng@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strleng@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11fc <rgrep_matches+0x3c>
cmpl   $0x0,-0x20(%rbp)
jne    1208 <rgrep_matches+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
call   1080 <checkForSpecialChar@plt>
cmp    $0x1388,%rax
je     15e4 <rgrep_matches+0x424>
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x30(%rbp)
call   1080 <checkForSpecialChar@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
sub    $0x2b,%eax
je     14fa <rgrep_matches+0x33a>
jmp    1246 <rgrep_matches+0x86>
mov    -0x28(%rbp),%eax
sub    $0x2e,%eax
je     1279 <rgrep_matches+0xb9>
jmp    1257 <rgrep_matches+0x97>
mov    -0x28(%rbp),%eax
sub    $0x3f,%eax
je     1560 <rgrep_matches+0x3a0>
jmp    1268 <rgrep_matches+0xa8>
mov    -0x28(%rbp),%eax
sub    $0x5c,%eax
je     137c <rgrep_matches+0x1bc>
jmp    15d8 <rgrep_matches+0x418>
mov    -0x18(%rbp),%rdi
call   1040 <samePattern@plt>
cmp    $0x0,%eax
je     12af <rgrep_matches+0xef>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    12a3 <rgrep_matches+0xe3>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
mov    $0x2b,%esi
call   10d0 <firstOccur@plt>
cmp    $0x1388,%eax
je     12f6 <rgrep_matches+0x136>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10b0 <patternDotAfterPlus@plt>
cmp    $0x0,%eax
je     12ea <rgrep_matches+0x12a>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
mov    $0x3f,%esi
call   10d0 <firstOccur@plt>
cmp    $0x1388,%eax
je     134e <rgrep_matches+0x18e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <quesCount@plt>
mov    -0x38(%rbp),%ecx
mov    %eax,%edx
mov    -0x34(%rbp),%eax
sub    %edx,%ecx
cmp    %ecx,%eax
jne    1342 <rgrep_matches+0x182>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <matchPatternDots@plt>
cmp    $0x0,%eax
je     1370 <rgrep_matches+0x1b0>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
cmpl   $0x2,-0x1c(%rbp)
jne    142f <rgrep_matches+0x26f>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3f,%eax
jne    13d2 <rgrep_matches+0x212>
lea    0xc62(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%ecx
mov    $0x1,%edx
call   1050 <basicRgrep@plt>
cmp    $0x0,%rax
je     13cd <rgrep_matches+0x20d>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    1423 <rgrep_matches+0x263>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    141e <rgrep_matches+0x25e>
lea    0xc18(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%ecx
mov    $0x1,%edx
call   1050 <basicRgrep@plt>
cmp    $0x0,%rax
je     1419 <rgrep_matches+0x259>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    141e <rgrep_matches+0x25e>
jmp    1423 <rgrep_matches+0x263>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
cmpl   $0x3,-0x1c(%rbp)
jne    14c2 <rgrep_matches+0x302>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5c,%eax
jne    14bd <rgrep_matches+0x2fd>
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2b,%eax
jne    14b8 <rgrep_matches+0x2f8>
lea    0xba2(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    14b3 <rgrep_matches+0x2f3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    14a0 <rgrep_matches+0x2e0>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    14a5 <rgrep_matches+0x2e5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    146d <rgrep_matches+0x2ad>
jmp    14b8 <rgrep_matches+0x2f8>
jmp    14bd <rgrep_matches+0x2fd>
jmp    14f0 <rgrep_matches+0x330>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <escapeChar@plt>
cmp    $0x0,%eax
je     14e4 <rgrep_matches+0x324>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    14f5 <rgrep_matches+0x335>
jmp    14fa <rgrep_matches+0x33a>
cmpl   $0x1,-0x1c(%rbp)
jne    1510 <rgrep_matches+0x350>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10e0 <multiplePlus@plt>
cmp    $0x0,%eax
je     1532 <rgrep_matches+0x372>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <patternSinglePlus@plt>
cmp    $0x0,%eax
je     1554 <rgrep_matches+0x394>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
cmpl   $0x1,-0x1c(%rbp)
jne    15a5 <rgrep_matches+0x3e5>
lea    0xa8f(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%ecx
mov    $0x1,%edx
call   1050 <basicRgrep@plt>
cmp    $0x0,%rax
je     15a0 <rgrep_matches+0x3e0>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    15d3 <rgrep_matches+0x413>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <quesMark@plt>
cmp    $0x0,%eax
je     15c7 <rgrep_matches+0x407>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    15d8 <rgrep_matches+0x418>
movl   $0x0,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1050 <basicRgrep@plt>
cmp    $0x0,%rax
je     160d <rgrep_matches+0x44d>
movl   $0x1,-0x4(%rbp)
jmp    1619 <rgrep_matches+0x459>
jmp    1612 <rgrep_matches+0x452>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgrep_matches>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1060 <strleng@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1060 <strleng@plt>
xor    %ecx,%ecx
test   %ebp,%ebp
je     1212 <rgrep_matches+0x52>
mov    %eax,%r15d
test   %eax,%eax
je     1212 <rgrep_matches+0x52>
mov    %rbx,%rdi
call   1080 <checkForSpecialChar@plt>
cmp    $0x1388,%rax
jne    1220 <rgrep_matches+0x60>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1050 <basicRgrep@plt>
test   %rax,%rax
setne  %cl
movzbl %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   1080 <checkForSpecialChar@plt>
movsbl (%rbx,%rax,1),%eax
cmp    $0x3e,%eax
jg     1253 <rgrep_matches+0x93>
cmp    $0x2b,%eax
je     1337 <rgrep_matches+0x177>
cmp    $0x2e,%eax
jne    12a7 <rgrep_matches+0xe7>
mov    %rbx,%rdi
call   1040 <samePattern@plt>
test   %eax,%eax
je     12c0 <rgrep_matches+0x100>
cmp    %ebp,%r15d
sete   %cl
jmp    1212 <rgrep_matches+0x52>
cmp    $0x3f,%eax
je     1280 <rgrep_matches+0xc0>
cmp    $0x5c,%eax
jne    12a7 <rgrep_matches+0xe7>
cmp    $0x3,%ebp
je     1302 <rgrep_matches+0x142>
cmp    $0x2,%ebp
jne    1369 <rgrep_matches+0x1a9>
mov    0x1(%rbx),%al
cmp    $0x2e,%al
je     138d <rgrep_matches+0x1cd>
cmp    $0x3f,%al
je     1285 <rgrep_matches+0xc5>
jmp    12a7 <rgrep_matches+0xe7>
cmp    $0x1,%ebp
jne    12ae <rgrep_matches+0xee>
lea    0xd74(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%edx
mov    %r15d,%ecx
call   1050 <basicRgrep@plt>
mov    $0x1,%cl
test   %rax,%rax
jne    1212 <rgrep_matches+0x52>
xor    %ecx,%ecx
jmp    1212 <rgrep_matches+0x52>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <quesMark@plt>
test   %eax,%eax
jmp    120f <rgrep_matches+0x4f>
mov    %rbx,%rdi
mov    $0x2b,%esi
call   10d0 <firstOccur@plt>
cmp    $0x1388,%eax
jne    137b <rgrep_matches+0x1bb>
mov    %rbx,%rdi
mov    $0x3f,%esi
call   10d0 <firstOccur@plt>
mov    %rbx,%rdi
cmp    $0x1388,%eax
jne    1399 <rgrep_matches+0x1d9>
mov    %r14,%rsi
call   1070 <matchPatternDots@plt>
test   %eax,%eax
jmp    120f <rgrep_matches+0x4f>
cmpb   $0x5c,0x1(%rbx)
jne    1342 <rgrep_matches+0x182>
cmpb   $0x2b,0x2(%rbx)
jne    1342 <rgrep_matches+0x182>
test   %r15d,%r15d
jle    13a5 <rgrep_matches+0x1e5>
mov    %r15d,%eax
xor    %ecx,%ecx
lea    0xce1(%rip),%rbx
cmpb   $0x5c,(%r14,%rcx,1)
je     13ae <rgrep_matches+0x1ee>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1323 <rgrep_matches+0x163>
mov    $0x1,%cl
cmp    $0x1,%ebp
je     1212 <rgrep_matches+0x52>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <multiplePlus@plt>
mov    $0x1,%cl
test   %eax,%eax
jne    1212 <rgrep_matches+0x52>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <patternSinglePlus@plt>
test   %eax,%eax
jmp    120f <rgrep_matches+0x4f>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <escapeChar@plt>
test   %eax,%eax
jmp    120f <rgrep_matches+0x4f>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <patternDotAfterPlus@plt>
test   %eax,%eax
jmp    120f <rgrep_matches+0x4f>
lea    0xc6e(%rip),%rdi
jmp    128c <rgrep_matches+0xcc>
call   1030 <quesCount@plt>
sub    %eax,%ebp
jmp    124b <rgrep_matches+0x8b>
lea    0xc58(%rip),%rbx
jmp    1342 <rgrep_matches+0x182>
mov    $0x1,%cl
jmp    1212 <rgrep_matches+0x52>

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [2 x i8] c"\\\00"
define i32 @rgrep_matches(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @strleng(i8* %9)
store i32 %10, i32* %6
%11 = load i8*, i8** %4
%12 = call i32 @strleng(i8* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %2
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15, %2
store i32 0, i32* %3
br label %200
19: ; preds = %15
%20 = load i8*, i8** %5
%21 = call i64 @checkForSpecialChar(i8* %20)
%22 = icmp ne i64 %21, 5000
br i1 %22, label %23, label %190
23: ; preds = %19
%24 = load i8*, i8** %5
%25 = load i8*, i8** %5
%26 = call i64 @checkForSpecialChar(i8* %25)
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
switch i32 %29, label %189 [
i32 46, label %30
i32 92, label %71
i32 43, label %153
i32 63, label %170
]
30: ; preds = %23
%31 = load i8*, i8** %5
%32 = call i32 @samePattern(i8* %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i32, i32* %7
%36 = load i32, i32* %6
%37 = icmp eq i32 %35, %36
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 1, i32* %3
br label %200
39: ; preds = %34
store i32 0, i32* %3
br label %200
40: ; preds = %30
%41 = load i8*, i8** %5
%42 = call i32 @firstOccur(i8* %41, i8 signext 43)
%43 = icmp ne i32 %42, 5000
br i1 %43, label %44, label %51
44: ; preds = %40
%45 = load i8*, i8** %5
%46 = load i8*, i8** %4
%47 = call i32 @patternDotAfterPlus(i8* %45, i8* %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %44
store i32 1, i32* %3
br label %200
50: ; preds = %44
store i32 0, i32* %3
br label %200
51: ; preds = %40
%52 = load i8*, i8** %5
%53 = call i32 @firstOccur(i8* %52, i8 signext 63)
%54 = icmp ne i32 %53, 5000
br i1 %54, label %55, label %64
55: ; preds = %51
%56 = load i32, i32* %7
%57 = load i32, i32* %6
%58 = load i8*, i8** %5
%59 = call i32 @quesCount(i8* %58)
%60 = sub nsw i32 %57, %59
%61 = icmp eq i32 %56, %60
br i1 %61, label %62, label %63
62: ; preds = %55
store i32 1, i32* %3
br label %200
63: ; preds = %55
store i32 0, i32* %3
br label %200
64: ; preds = %51
%65 = load i8*, i8** %5
%66 = load i8*, i8** %4
%67 = call i32 @matchPatternDots(i8* %65, i8* %66)
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %64
store i32 1, i32* %3
br label %200
70: ; preds = %64
store i32 0, i32* %3
br label %200
71: ; preds = %23
%72 = load i32, i32* %6
%73 = icmp eq i32 %72, 2
br i1 %73, label %74, label %104
74: ; preds = %71
%75 = load i8*, i8** %5
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 63
br i1 %79, label %80, label %88
80: ; preds = %74
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5
%81 = load i8*, i8** %5
%82 = load i8*, i8** %4
%83 = load i32, i32* %7
%84 = call i64 @basicRgrep(i8* %81, i8* %82, i32 1, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %80
store i32 1, i32* %3
br label %200
87: ; preds = %80
br label %103
88: ; preds = %74
%89 = load i8*, i8** %5
%90 = getelementptr inbounds i8, i8* %89, i64 1
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 46
br i1 %93, label %94, label %102
94: ; preds = %88
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %5
%95 = load i8*, i8** %5
%96 = load i8*, i8** %4
%97 = load i32, i32* %7
%98 = call i64 @basicRgrep(i8* %95, i8* %96, i32 1, i32 %97)
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %94
store i32 1, i32* %3
br label %200
101: ; preds = %94
br label %102
102: ; preds = %101, %88
br label %103
103: ; preds = %102, %87
store i32 0, i32* %3
br label %200
104: ; preds = %71
%105 = load i32, i32* %6
%106 = icmp eq i32 %105, 3
br i1 %106, label %107, label %144
107: ; preds = %104
%108 = load i8*, i8** %5
%109 = getelementptr inbounds i8, i8* %108, i64 1
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 92
br i1 %112, label %113, label %143
113: ; preds = %107
%114 = load i8*, i8** %5
%115 = getelementptr inbounds i8, i8* %114, i64 2
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 43
br i1 %118, label %119, label %142
119: ; preds = %113
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %5
store i32 0, i32* %8
br label %120
120: ; preds = %138, %119
%121 = load i32, i32* %8
%122 = load i32, i32* %7
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %141
124: ; preds = %120
%125 = load i8*, i8** %4
%126 = load i32, i32* %8
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8, i8* %125, i64 %127
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = load i8*, i8** %5
%132 = getelementptr inbounds i8, i8* %131, i64 0
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %130, %134
br i1 %135, label %136, label %137
136: ; preds = %124
store i32 1, i32* %3
br label %200
137: ; preds = %124
br label %138
138: ; preds = %137
%139 = load i32, i32* %8
%140 = add nsw i32 %139, 1
store i32 %140, i32* %8
br label %120
141: ; preds = %120
br label %142
142: ; preds = %141, %113
br label %143
143: ; preds = %142, %107
br label %151
144: ; preds = %104
%145 = load i8*, i8** %5
%146 = load i8*, i8** %4
%147 = call i32 @escapeChar(i8* %145, i8* %146)
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %150
149: ; preds = %144
store i32 1, i32* %3
br label %200
150: ; preds = %144
store i32 0, i32* %3
br label %200
151: ; preds = %143
br label %152
152: ; preds = %151
br label %153
153: ; preds = %23, %152
%154 = load i32, i32* %6
%155 = icmp eq i32 %154, 1
br i1 %155, label %156, label %157
156: ; preds = %153
store i32 1, i32* %3
br label %200
157: ; preds = %153
%158 = load i8*, i8** %5
%159 = load i8*, i8** %4
%160 = call i32 @multiplePlus(i8* %158, i8* %159)
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %163
162: ; preds = %157
store i32 1, i32* %3
br label %200
163: ; preds = %157
%164 = load i8*, i8** %5
%165 = load i8*, i8** %4
%166 = call i32 @patternSinglePlus(i8* %164, i8* %165)
%167 = icmp ne i32 %166, 0
br i1 %167, label %168, label %169
168: ; preds = %163
store i32 1, i32* %3
br label %200
169: ; preds = %163
store i32 0, i32* %3
br label %200
170: ; preds = %23
%171 = load i32, i32* %6
%172 = icmp eq i32 %171, 1
br i1 %172, label %173, label %181
173: ; preds = %170
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5
%174 = load i8*, i8** %5
%175 = load i8*, i8** %4
%176 = load i32, i32* %7
%177 = call i64 @basicRgrep(i8* %174, i8* %175, i32 1, i32 %176)
%178 = icmp ne i64 %177, 0
br i1 %178, label %179, label %180
179: ; preds = %173
store i32 1, i32* %3
br label %200
180: ; preds = %173
br label %188
181: ; preds = %170
%182 = load i8*, i8** %5
%183 = load i8*, i8** %4
%184 = call i32 @quesMark(i8* %182, i8* %183)
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %187
186: ; preds = %181
store i32 1, i32* %3
br label %200
187: ; preds = %181
store i32 0, i32* %3
br label %200
188: ; preds = %180
br label %189
189: ; preds = %23, %188
store i32 0, i32* %3
br label %200
190: ; preds = %19
%191 = load i8*, i8** %5
%192 = load i8*, i8** %4
%193 = load i32, i32* %6
%194 = load i32, i32* %7
%195 = call i64 @basicRgrep(i8* %191, i8* %192, i32 %193, i32 %194)
%196 = icmp ne i64 %195, 0
br i1 %196, label %197, label %198
197: ; preds = %190
store i32 1, i32* %3
br label %200
198: ; preds = %190
br label %199
199: ; preds = %198
store i32 0, i32* %3
br label %200
200: ; preds = %199, %197, %189, %187, %186, %179, %169, %168, %162, %156, %150, %149, %136, %103, %100, %86, %70, %69, %63, %62, %50, %49, %39, %38, %18
%201 = load i32, i32* %3
ret i32 %201
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [2 x i8] c"\\\00"
define i32 @rgrep_matches(i8* %0, i8* %1) {
%3 = tail call i32 @strleng(i8* %1)
%4 = tail call i32 @strleng(i8* %0)
%5 = icmp eq i32 %3, 0
%6 = icmp eq i32 %4, 0
%7 = select i1 %5, i1 true, i1 %6
br i1 %7, label %93, label %8
8: ; preds = %2
%9 = tail call i64 @checkForSpecialChar(i8* %1)
%10 = icmp eq i64 %9, 5000
br i1 %10, label %90, label %11
11: ; preds = %8
%12 = tail call i64 @checkForSpecialChar(i8* %1)
%13 = getelementptr inbounds i8, i8* %1, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %89 [
i32 46, label %16
i32 92, label %37
i32 43, label %71
i32 63, label %81
]
16: ; preds = %11
%17 = tail call i32 @samePattern(i8* %1)
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = icmp eq i32 %4, %3
br label %93
21: ; preds = %16
%22 = tail call i32 @firstOccur(i8* %1, i8 signext 43)
%23 = icmp eq i32 %22, 5000
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = tail call i32 @patternDotAfterPlus(i8* %1, i8* %0)
%26 = icmp ne i32 %25, 0
br label %93
27: ; preds = %21
%28 = tail call i32 @firstOccur(i8* %1, i8 signext 63)
%29 = icmp eq i32 %28, 5000
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = tail call i32 @quesCount(i8* %1)
%32 = sub nsw i32 %3, %31
%33 = icmp eq i32 %4, %32
br label %93
34: ; preds = %27
%35 = tail call i32 @matchPatternDots(i8* %1, i8* %0)
%36 = icmp ne i32 %35, 0
br label %93
37: ; preds = %11
switch i32 %3, label %68 [
i32 2, label %38
i32 3, label %48
]
38: ; preds = %37
%39 = getelementptr inbounds i8, i8* %1, i64 1
%40 = load i8, i8* %39
switch i8 %40, label %47 [
i8 63, label %41
i8 46, label %44
]
41: ; preds = %38
%42 = tail call i64 @basicRgrep(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %0, i32 1, i32 %4)
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %93
44: ; preds = %38
%45 = tail call i64 @basicRgrep(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 1, i32 %4)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %93
47: ; preds = %38, %44, %41
br label %93
48: ; preds = %37
%49 = getelementptr inbounds i8, i8* %1, i64 1
%50 = load i8, i8* %49
%51 = icmp eq i8 %50, 92
br i1 %51, label %52, label %74
52: ; preds = %48
%53 = getelementptr inbounds i8, i8* %1, i64 2
%54 = load i8, i8* %53
%55 = icmp eq i8 %54, 43
br i1 %55, label %56, label %74
56: ; preds = %52
%57 = icmp sgt i32 %4, 0
br i1 %57, label %58, label %74
58: ; preds = %56
%59 = zext i32 %4 to i64
br label %62
60: ; preds = %62
%61 = icmp eq i64 %67, %59
br i1 %61, label %71, label %62
62: ; preds = %58, %60
%63 = phi i64 [ 0, %58 ], [ %67, %60 ]
%64 = getelementptr inbounds i8, i8* %0, i64 %63
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 92
%67 = add nuw nsw i64 %63, 1
br i1 %66, label %93, label %60
68: ; preds = %37
%69 = tail call i32 @escapeChar(i8* %1, i8* %0)
%70 = icmp ne i32 %69, 0
br label %93
71: ; preds = %60, %11
%72 = phi i8* [ %1, %11 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %60 ]
%73 = icmp eq i32 %3, 1
br i1 %73, label %93, label %74
74: ; preds = %56, %52, %48, %71
%75 = phi i8* [ %72, %71 ], [ %1, %48 ], [ %1, %52 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %56 ]
%76 = tail call i32 @multiplePlus(i8* %75, i8* %0)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %93
78: ; preds = %74
%79 = tail call i32 @patternSinglePlus(i8* %75, i8* %0)
%80 = icmp ne i32 %79, 0
br label %93
81: ; preds = %11
%82 = icmp eq i32 %3, 1
br i1 %82, label %83, label %86
83: ; preds = %81
%84 = tail call i64 @basicRgrep(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %0, i32 1, i32 %4)
%85 = icmp eq i64 %84, 0
br i1 %85, label %89, label %93
86: ; preds = %81
%87 = tail call i32 @quesMark(i8* %1, i8* %0)
%88 = icmp ne i32 %87, 0
br label %93
89: ; preds = %83, %11
br label %93
90: ; preds = %8
%91 = tail call i64 @basicRgrep(i8* %1, i8* %0, i32 %3, i32 %4)
%92 = icmp ne i64 %91, 0
br label %93
93: ; preds = %62, %90, %86, %83, %78, %74, %71, %68, %44, %41, %34, %30, %24, %19, %2, %89, %47
%94 = phi i1 [ false, %89 ], [ false, %47 ], [ false, %2 ], [ %20, %19 ], [ %26, %24 ], [ %33, %30 ], [ %36, %34 ], [ true, %41 ], [ true, %44 ], [ %70, %68 ], [ true, %71 ], [ true, %74 ], [ %80, %78 ], [ true, %83 ], [ %88, %86 ], [ %92, %90 ], [ true, %62 ]
%95 = zext i1 %94 to i32
ret i32 %95
}