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

  result.assertion_match = false;
  c = graph->c;
  pch = memchr( input + graph->initial_skip, c, length );
  while ( pch != NULL && pch - input <= length && *pch != '\0' )
  {
    if ( graph->starting_point == 0 )
    {
      result = dre2_matcher( graph, input, pch, graph->starting_point, DRE2_RIGHT, length, r_temp, reachable, state );
      if ( result.match != NULL )
      {
        ret_val.matched = true;
        ret_val.start_pos = pch - input;
        ret_val.end_pos = result.match - input + 1;
        return ret_val;
      }
      if ( result.skip_to != DRE2_INFINITE )
        pch = input + result.skip_to;
    } else
    {
      result = dre2_matcher( graph, input, pch, graph->starting_point, 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_point, 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 = memchr( pch + 1, c, length - ( pch - input ) );
  }
  ret_val.matched = false;
  return ret_val;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x50(%rsp)
movq %r8, %r15
movq %rcx, %rbx
movl %edx, %r13d
movq %rsi, %r14
movzbl 0x428(%rdi), %esi
movq %rdi, 0x48(%rsp)
movslq 0x864(%rdi), %rdi
addq %r14, %rdi
movslq %edx, %r12
movl %esi, 0x1c(%rsp)
movq %r12, %rdx
callq 0x21e0
testq %rax, %rax
je 0x67a1
movq %rax, %rbp
movq %r12, 0x40(%rsp)
addq %r14, %r12
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
movq %r14, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x38(%rsp)
movq %r13, %r14
movq %rbx, %r13
movq %r15, %rbx
movq 0x50(%rsp), %r15
movq %rbp, %r12
subq %rdx, %r12
cmpq 0x40(%rsp), %r12
jg 0x6796
cmpb $0x0, (%rbp)
je 0x6796
movq 0x48(%rsp), %rsi
movl 0x410(%rsi), %r8d
testl %r8d, %r8d
je 0x670e
movq %rsi, %r12
movq %rbp, %rcx
xorl %r9d, %r9d
pushq %r15
pushq %rbx
movq %r13, %rbx
pushq %r13
movq %r14, %r13
pushq %r14
callq 0x2290
addq $0x20, %rsp
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x6757
movq %r13, %r10
movl %eax, %r13d
movq 0x8(%rsp), %rdx
subl %edx, %r13d
movl 0x410(%r12), %r8d
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rcx
movl $0x1, %r9d
pushq %r15
movq 0x40(%rsp), %r12
pushq %r12
movq %rbx, %r15
pushq %rbx
pushq %r10
callq 0x2290
addq $0x20, %rsp
movq 0x30(%rsp), %rcx
testq %rcx, %rcx
jne 0x67be
movq %r12, %rdx
movl 0x20(%rsp), %eax
movslq 0x28(%rsp), %rcx
cmpl $-0x1, %ecx
movq 0x10(%rsp), %r12
movl %r13d, 0x4(%rsp)
je 0x6703
addq 0x8(%rsp), %rcx
movq %rcx, %rbp
movq %r14, %r13
movq %r15, %rbx
movq %rdx, %r15
jmp 0x6765
movq %rbp, %rcx
movl $0x1, %r9d
pushq %r15
pushq %rbx
pushq %r13
pushq %r14
callq 0x2290
addq $0x20, %rsp
movq 0x30(%rsp), %rcx
testq %rcx, %rcx
jne 0x67cd
movslq 0x28(%rsp), %rax
cmpl $-0x1, %eax
je 0x6747
addq 0x8(%rsp), %rax
movq %rax, %rbp
movq %rbx, %r15
movq %r13, %rbx
movq %r14, %r13
movq 0x10(%rsp), %r12
jmp 0x676b
movl 0x20(%rsp), %eax
movq 0x10(%rsp), %r12
movq 0x38(%rsp), %r15
testl %eax, %eax
cmovneq %r12, %rbp
movq %r12, %rdx
subq %rbp, %rdx
incq %rbp
movq %rbp, %rdi
movl 0x1c(%rsp), %esi
callq 0x21e0
movq %rax, %rbp
testq %rax, %rax
movq 0x8(%rsp), %rdx
leaq 0x20(%rsp), %rdi
jne 0x6628
xorl %ecx, %ecx
xorl %eax, %eax
movl 0x4(%rsp), %r13d
jmp 0x67a5
xorl %eax, %eax
xorl %ecx, %ecx
shlq $0x20, %rcx
movl %r13d, %edx
orq %rcx, %rdx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq 0x8(%rsp), %rcx
incq %rcx
movl $0x1, %eax
jmp 0x67a5
subq 0x8(%rsp), %rcx
incq %rcx
movl $0x1, %eax
movl %r12d, %r13d
jmp 0x67a5