// File: /workspace/github_c_makefile_star2_O3/jondurbin[P]dre2/src/dre2_match.c
// Function: dre2_mn
struct dre2_match_value dre2_mn( struct dre2 *graph, unsigned char *input, int length, int *r_temp, int *reachable, int *state )
{
  int i;
  unsigned char *pch;
  struct dre2_single_match result;
  struct dre2_match_value ret_val;

  result.assertion_match = false;
  pch = input;
  while ( pch - input <= length && *pch != '\0' && !graph->starting_chars[*pch] )
    *pch++;
  while ( pch - input <= length && *pch != '\0' )
  {
    for ( i = 0; i < graph->starting_count; i++ )
    {
      result = dre2_matcher( graph, input, pch, graph->starting_points[i], DRE2_LEFT, length, r_temp, reachable, state );
      if ( result.match != NULL )
      {
        ret_val.start_pos = result.match - input;
        result = dre2_matcher( graph, input, pch, graph->starting_points[i], DRE2_RIGHT, length, r_temp, reachable, state );
        if ( result.match != NULL )
        {
          ret_val.matched = true;
          ret_val.end_pos = result.match - input + 1; 
          return ret_val;
        }
        if ( result.skip_to != DRE2_INFINITE )
          pch = input + result.skip_to;
      }
      if ( result.assertion_match )
        pch = input + length;
    }
    *pch++;
    while ( pch - input <= length && *pch != 0 && !graph->starting_chars[*pch] )
      *pch++;
  }
  ret_val.matched = false;
  return ret_val;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, %r10
movq %r8, %r11
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r9
movq %rdi, %rsi
movslq %edx, %r8
testl %r8d, %r8d
js 0x6c2c
leaq (%r9,%r8), %rcx
incq %rcx
xorl %eax, %eax
movq %r9, %rbx
movzbl (%r9,%rax), %edx
testq %rdx, %rdx
je 0x6c37
movq 0x418(%rsi), %rdi
cmpl $0x0, (%rdi,%rdx,4)
jne 0x6c31
incq %rbx
incq %rax
cmpq %r8, %rax
jle 0x6c05
movq %rcx, %rbx
jmp 0x6c37
movq %r9, %rbx
jmp 0x6c37
addq %r9, %rax
movq %rax, %rbx
movq %rbx, %rax
subq %r9, %rax
cmpq %r8, %rax
jg 0x6de3
cmpb $0x0, (%rbx)
je 0x6de3
leaq (%r9,%r8), %rax
movq %rax, 0x60(%rsp)
movl $0x1, %eax
movq %r9, %r12
subq %r9, %rax
movq %rax, 0x50(%rsp)
leaq 0x38(%rsp), %rdi
movq %r9, 0x8(%rsp)
movq %rsi, 0x20(%rsp)
movq %r8, 0x58(%rsp)
movq %r15, 0x30(%rsp)
movq %r11, 0x28(%rsp)
movq %r10, 0x18(%rsp)
cmpl $0x0, 0x438(%rsi)
jle 0x6d91
xorl %r13d, %r13d
movq %r12, %r14
movq 0x430(%rsi), %rax
movl (%rax,%r13,4), %r8d
movq %r14, %rdx
movq %rbx, %rcx
movq %rsi, %r12
xorl %r9d, %r9d
pushq %r10
pushq %r11
pushq %r15
pushq %rbp
movq %r10, %r15
callq 0x2290
addq $0x20, %rsp
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x6d47
subl %r14d, %eax
movl %eax, 0x14(%rsp)
movq 0x430(%r12), %rax
movl (%rax,%r13,4), %r8d
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movl $0x1, %r9d
pushq %r15
movq 0x30(%rsp), %r14
pushq %r14
movq 0x40(%rsp), %r15
pushq %r15
movq %rbp, %r12
pushq %rbp
callq 0x2290
addq $0x20, %rsp
movq 0x48(%rsp), %rcx
testq %rcx, %rcx
jne 0x6dfe
movq %r14, %r11
movl 0x38(%rsp), %eax
movslq 0x40(%rsp), %rcx
cmpl $-0x1, %ecx
je 0x6d5d
movq 0x8(%rsp), %r14
addq %r14, %rcx
movq %rcx, %rbx
movq 0x18(%rsp), %r10
jmp 0x6d67
movl 0x38(%rsp), %eax
movq %r15, %r10
movq 0x28(%rsp), %r11
movq 0x30(%rsp), %r15
movq %r12, %rsi
jmp 0x6d6f
movq 0x18(%rsp), %r10
movq 0x8(%rsp), %r14
movq %r12, %rbp
movq 0x20(%rsp), %rsi
testl %eax, %eax
cmovneq 0x60(%rsp), %rbx
incq %r13
movslq 0x438(%rsi), %rax
cmpq %rax, %r13
leaq 0x38(%rsp), %rdi
jl 0x6c9e
jmp 0x6d94
movq %r12, %r14
movq %r14, %r12
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %r9
incq %rbx
movq %rbx, %rcx
movq 0x58(%rsp), %r8
xorl %eax, %eax
cmpq %r8, %r9
jg 0x6de5
movq %rcx, %rbx
movzbl (%rcx), %edx
testq %rdx, %rdx
je 0x6dd2
movq 0x418(%rsi), %r14
leaq 0x1(%rbx), %rcx
incq %r9
cmpl $0x0, (%r14,%rdx,4)
je 0x6dad
cmpb $0x0, (%rbx)
movl $0x0, %r9d
jne 0x6c8b
jmp 0x6de8
xorl %eax, %eax
xorl %r9d, %r9d
movl 0x14(%rsp), %edx
orq %r9, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subl 0x8(%rsp), %ecx
shlq $0x20, %rcx
movabsq $0x100000000, %r9       # imm = 0x100000000
addq %rcx, %r9
movl $0x1, %eax
jmp 0x6de8