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

  result.matched = false;

  // Make sure the string is even long enough before attempting matching.
  length = strlen( input );

  if ( length < graph->min_length )
    return result;

  if ( graph->options & DRE2_THREAD_SAFE )
  {
    r_temp = ( int * )malloc( sizeof( int ) * graph->count );
    reachable = ( int * )malloc( sizeof( int ) * graph->count );
    state = ( int * )calloc( graph->count, sizeof( int ) );
  } else
  {
    r_temp = graph->r_temp;
    reachable = graph->reachable;
    state = graph->state;
  }

  if ( graph->options & DRE2_FULL_MATCH )
  {
    result = dre2_full_match( graph, input, length, r_temp, reachable, state );
  } else
  {
    switch ( graph->match_method )
    {
      case DRE2_SN_SC_H:
        result = dre2_sn_sc_horspool( graph, input, length, r_temp, reachable, state );
        break;
      case DRE2_SN_SC:
        result = dre2_sn_sc( graph, input, length, r_temp, reachable, state );
        break;
      case DRE2_SN_MC_H:
        result = dre2_sn_mc_horspool( graph, input, length, r_temp, reachable, state );
        break;
      case DRE2_SN_MC:
        result = dre2_sn_mc( graph, input, length, r_temp, reachable, state );
        break;
      case DRE2_MN:
        result = dre2_mn( graph, input, length, r_temp, reachable, state );
        break;
    }
  }

  if ( result.matched && ( graph->options & DRE2_GREEDY ) && graph->has_loop )
    result = dre2_expanded_match( graph, input, length, r_temp, reachable, state, &result );

  if ( ( graph->options & DRE2_THREAD_SAFE ) || graph->count >= RANGE )
  {
    free( reachable ); reachable = NULL;
    free( r_temp ); r_temp = NULL;
    free( state ); state = NULL;
  }
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2120
movq %rax, %rbp
cmpl %ebp, 0x40c(%rbx)
jle 0x6f81
xorl %r12d, %r12d
jmp 0x7110
movl 0x43c(%rbx), %r13d
testb $0x10, %r13b
jne 0x6fa5
movq 0x440(%rbx), %r12
movq 0x448(%rbx), %r15
movq 0x450(%rbx), %rax
jmp 0x6fe2
movq %rbp, (%rsp)
movq %r14, %rbp
movslq 0x8(%rbx), %r14
leaq (,%r14,4), %r15
movq %r15, %rdi
callq 0x22a0
movq %rax, %r12
movq %r15, %rdi
callq 0x22a0
movq %rax, %r15
movl $0x4, %esi
movq %r14, %rdi
movq %rbp, %r14
movq (%rsp), %rbp
callq 0x2200
testb $0x2, %r13b
movq %r12, (%rsp)
movq %r15, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %r14, 0x18(%rsp)
jne 0x7033
movl 0x424(%rbx), %edx
cmpq $0x4, %rdx
ja 0x719e
leaq 0x10ea(%rip), %rcx      # 0x80fc
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r9
callq 0x20e0
jmp 0x7049
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r9
callq 0x22f0
movq %rax, %r12
movq %rax, %r15
shrq $0x20, %r15
movq %rdx, %r14
shrq $0x20, %r14
movl 0x43c(%rbx), %r13d
testl %r12d, %r12d
je 0x70db
testb $0x1, %r13b
je 0x70de
cmpl $0x0, 0x868(%rbx)
je 0x70de
movslq %edx, %rcx
movq 0x18(%rsp), %r13
addq %r13, %rcx
leaq 0x20(%rsp), %rdi
xorl %r15d, %r15d
movl $0x1, %r12d
movq %rbx, %rsi
movq %rdx, %r14
movq %rcx, %rdx
xorl %r8d, %r8d
movl $0x1, %r9d
pushq 0x8(%rsp)
pushq 0x18(%rsp)
pushq 0x10(%rsp)
pushq %rbp
callq 0x2290
movq %r14, %rdx
addq $0x20, %rsp
leaq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl %eax, %r14d
subl %r13d, %r14d
incl %r14d
testq %rax, %rax
cmovel %r15d, %r14d
movl 0x43c(%rbx), %r13d
jmp 0x70de
xorl %r12d, %r12d
testb $0x10, %r13b
jne 0x70ed
cmpl $0x100, 0x8(%rbx)       # imm = 0x100
jl 0x7110
movq 0x10(%rsp), %rdi
movq %rdx, %rbx
callq 0x2070
movq (%rsp), %rdi
callq 0x2070
movq 0x8(%rsp), %rdi
callq 0x2070
movq %rbx, %rdx
shlq $0x20, %r15
movl %r12d, %eax
orq %r15, %rax
shlq $0x20, %r14
movl %edx, %edx
orq %r14, %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r9
callq 0x21a0
jmp 0x7049
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r9
callq 0x2250
jmp 0x7049
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r9
callq 0x2220
jmp 0x7049
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r9
callq 0x2340
jmp 0x7049
xorl %r12d, %r12d
jmp 0x70de