// File: /workspace/github_c_makefile_star2_O1/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, %r13
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rsi
movslq %edx, %r9
movq %r14, %rbx
testl %r9d, %r9d
js 0x6c17
leaq (%r14,%r9), %rcx
incq %rcx
xorl %eax, %eax
movq %r14, %rbx
movzbl (%r14,%rax), %r8d
testq %r8, %r8
je 0x6c11
movq 0x418(%rsi), %rdi
cmpl $0x0, (%rdi,%r8,4)
jne 0x6c17
incq %rbx
incq %rax
cmpq %r9, %rax
jle 0x6be9
movq %rcx, %rbx
jmp 0x6c17
addq %r14, %rax
movq %rax, %rbx
movq %rbx, %rax
subq %r14, %rax
cmpq %r9, %rax
jle 0x6c2b
xorl %eax, %eax
xorl %esi, %esi
jmp 0x6dde
leaq (%r14,%r9), %rax
movq %rax, 0x60(%rsp)
movl $0x1, %eax
subq %r14, %rax
movq %rax, 0x50(%rsp)
leaq 0x38(%rsp), %rdi
movq %r14, 0x10(%rsp)
movq %rsi, 0x20(%rsp)
movq %r9, 0x58(%rsp)
movq %r13, 0x30(%rsp)
movq %r11, 0x28(%rsp)
movq %r10, 0x18(%rsp)
cmpb $0x0, (%rbx)
je 0x6dba
cmpl $0x0, 0x438(%rsi)
jle 0x6d6d
xorl %r12d, %r12d
movq 0x430(%rsi), %rax
movl (%rax,%r12,4), %r8d
movq %r14, %rdx
movq %rbx, %rcx
movq %rsi, %r15
xorl %r9d, %r9d
pushq %r10
pushq %r11
pushq %r13
pushq %rbp
movq %r10, %r13
callq 0x2290
addq $0x20, %rsp
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x6d25
subl %r14d, %eax
movl %eax, 0xc(%rsp)
movq 0x430(%r15), %rax
movl (%rax,%r12,4), %r8d
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movl $0x1, %r9d
pushq %r13
movq 0x30(%rsp), %r14
pushq %r14
movq 0x40(%rsp), %r13
pushq %r13
movq %rbp, %r15
pushq %rbp
callq 0x2290
addq $0x20, %rsp
movq 0x48(%rsp), %rcx
testq %rcx, %rcx
jne 0x6dc0
movq %r14, %r11
movl 0x38(%rsp), %eax
movslq 0x40(%rsp), %rcx
cmpl $-0x1, %ecx
je 0x6d3b
movq 0x10(%rsp), %r14
addq %r14, %rcx
movq %rcx, %rbx
movq 0x18(%rsp), %r10
jmp 0x6d45
movl 0x38(%rsp), %eax
movq %r13, %r10
movq 0x28(%rsp), %r11
movq 0x30(%rsp), %r13
movq %r15, %rsi
jmp 0x6d4d
movq 0x18(%rsp), %r10
movq 0x10(%rsp), %r14
movq %r15, %rbp
movq 0x20(%rsp), %rsi
testl %eax, %eax
cmovneq 0x60(%rsp), %rbx
incq %r12
movslq 0x438(%rsi), %rax
cmpq %rax, %r12
leaq 0x38(%rsp), %rdi
jl 0x6c7d
movq %r14, %r15
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rcx
incq %rbx
movq %rbx, %rdx
movq 0x58(%rsp), %r9
movq %rdx, %rbx
movq %rcx, %rax
cmpq %r9, %rcx
jg 0x6dae
movzbl (%rbx), %r8d
testq %r8, %r8
je 0x6dae
movq 0x418(%rsi), %r14
leaq 0x1(%rbx), %rdx
leaq 0x1(%rax), %rcx
cmpl $0x0, (%r14,%r8,4)
je 0x6d84
cmpq %r9, %rax
movq %r15, %r14
jle 0x6c64
xorl %esi, %esi
xorl %eax, %eax
jmp 0x6dda
subl 0x10(%rsp), %ecx
shlq $0x20, %rcx
movabsq $0x100000000, %rsi      # imm = 0x100000000
addq %rcx, %rsi
movl $0x1, %eax
movl 0xc(%rsp), %ecx
movl %ecx, %edx
orq %rsi, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq