#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int rm_so;
  int rm_eo;
};
typedef TYPE_1__ regmatch_t;

/* Variables and functions */
char find_highlight_matches(regmatch_t *matches, char use_regex, int offset) {
  int match_offset;
  if (!matches)
    return 0;
  for (match_offset = 0; match_offset < (80); match_offset++) {
    char matching;
    if (matches[match_offset].rm_so == -1) {
      return 0;
    }
    matching = offset >= matches[match_offset].rm_so &&
               offset < matches[match_offset].rm_eo;
    if ((use_regex == 'c' && matching) || (use_regex == 'C' && !matching)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<find_highlight_matches>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1125 <find_highlight_matches+0x25>
movb   $0x0,-0x1(%rbp)
jmp    11db <find_highlight_matches+0xdb>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x50,-0x1c(%rbp)
jge    11d7 <find_highlight_matches+0xd7>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,8)
jne    1151 <find_highlight_matches+0x51>
movb   $0x0,-0x1(%rbp)
jmp    11db <find_highlight_matches+0xdb>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rdx
movslq -0x1c(%rbp),%rsi
xor    %eax,%eax
cmp    (%rdx,%rsi,8),%ecx
mov    %al,-0x1e(%rbp)
jl     117f <find_highlight_matches+0x7f>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    0x4(%rcx,%rdx,8),%eax
setl   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x1d(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x63,%eax
jne    11a4 <find_highlight_matches+0xa4>
movsbl -0x1d(%rbp),%eax
cmp    $0x0,%eax
jne    11bb <find_highlight_matches+0xbb>
movsbl -0x11(%rbp),%eax
cmp    $0x43,%eax
jne    11c4 <find_highlight_matches+0xc4>
cmpb   $0x0,-0x1d(%rbp)
jne    11c4 <find_highlight_matches+0xc4>
movb   $0x1,-0x1(%rbp)
jmp    11db <find_highlight_matches+0xdb>
jmp    11c9 <find_highlight_matches+0xc9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112c <find_highlight_matches+0x2c>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_highlight_matches>:
test   %rdi,%rdi
je     1197 <find_highlight_matches+0x97>
xor    %r10d,%r10d
jmp    111a <find_highlight_matches+0x1a>
xchg   %ax,%ax
add    $0x2,%r10
cmp    $0x50,%r10
je     1197 <find_highlight_matches+0x97>
mov    (%rdi,%r10,8),%eax
cmp    $0xffffffff,%eax
je     1197 <find_highlight_matches+0x97>
cmp    %edx,%eax
jle    1130 <find_highlight_matches+0x30>
xor    %r8d,%r8d
jmp    1145 <find_highlight_matches+0x45>
nopl   0x0(%rax)
mov    0x4(%rdi,%r10,8),%eax
cmp    %edx,%eax
setg   %r8b
cmp    $0x63,%sil
jne    1145 <find_highlight_matches+0x45>
cmp    %edx,%eax
jg     119a <find_highlight_matches+0x9a>
mov    $0x1,%al
cmp    $0x43,%sil
jne    1152 <find_highlight_matches+0x52>
test   %r8b,%r8b
je     1196 <find_highlight_matches+0x96>
mov    0x8(%rdi,%r10,8),%ecx
cmp    $0xffffffff,%ecx
je     1197 <find_highlight_matches+0x97>
cmp    %edx,%ecx
jle    1170 <find_highlight_matches+0x70>
xor    %r8d,%r8d
jmp    1187 <find_highlight_matches+0x87>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xc(%rdi,%r10,8),%r9d
cmp    %edx,%r9d
setg   %r8b
cmp    $0x63,%sil
jne    1187 <find_highlight_matches+0x87>
cmp    %edx,%r9d
jg     1196 <find_highlight_matches+0x96>
cmp    $0x43,%sil
jne    1110 <find_highlight_matches+0x10>
test   %r8b,%r8b
jne    1110 <find_highlight_matches+0x10>
ret
xor    %eax,%eax
ret
mov    $0x1,%al
ret

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

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
define signext i8 @find_highlight_matches(%struct.TYPE_3__* %0, i8 signext %1, i32 %2) {
%4 = icmp eq %struct.TYPE_3__* %0, null
br i1 %4, label %41, label %5
5: ; preds = %3
%6 = icmp eq i8 %1, 99
%7 = icmp ne i8 %1, 67
br label %26
8: ; preds = %38
%9 = or i64 %27, 1
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 %9, i32 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, -1
br i1 %12, label %41, label %13
13: ; preds = %8
%14 = icmp sgt i32 %11, %2
br i1 %14, label %20, label %15
15: ; preds = %13
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 %9, i32 1
%17 = load i32, i32* %16
%18 = icmp sgt i32 %17, %2
%19 = select i1 %6, i1 %18, i1 false
br i1 %19, label %41, label %20
20: ; preds = %15, %13
%21 = phi i1 [ %18, %15 ], [ false, %13 ]
%22 = select i1 %7, i1 true, i1 %21
br i1 %22, label %23, label %41
23: ; preds = %20
%24 = add nuw nsw i64 %27, 2
%25 = icmp eq i64 %24, 80
br i1 %25, label %41, label %26
26: ; preds = %23, %5
%27 = phi i64 [ 0, %5 ], [ %24, %23 ]
%28 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 %27, i32 0
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, -1
br i1 %30, label %41, label %31
31: ; preds = %26
%32 = icmp sgt i32 %29, %2
br i1 %32, label %38, label %33
33: ; preds = %31
%34 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 %27, i32 1
%35 = load i32, i32* %34
%36 = icmp sgt i32 %35, %2
%37 = select i1 %6, i1 %36, i1 false
br i1 %37, label %41, label %38
38: ; preds = %31, %33
%39 = phi i1 [ %36, %33 ], [ false, %31 ]
%40 = select i1 %7, i1 true, i1 %39
br i1 %40, label %8, label %41
41: ; preds = %33, %26, %38, %8, %15, %20, %23, %3
%42 = phi i8 [ 0, %3 ], [ 0, %26 ], [ 1, %33 ], [ 1, %38 ], [ 0, %8 ], [ 1, %15 ], [ 1, %20 ], [ 0, %23 ]
ret i8 %42
}