// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/tre/lib/regexec.c
// Function: tre_match
static int
tre_match(const tre_tnfa_t *tnfa, const void *string, size_t len,
	  tre_str_type_t type, size_t nmatch, regmatch_t pmatch[],
	  int eflags)
{
  reg_errcode_t status;
  int *tags = NULL, eo;
  if (tnfa->num_tags > 0 && nmatch > 0)
    {
#ifdef TRE_USE_ALLOCA
      tags = alloca(sizeof(*tags) * tnfa->num_tags);
#else /* !TRE_USE_ALLOCA */
      tags = xmalloc(sizeof(*tags) * tnfa->num_tags);
#endif /* !TRE_USE_ALLOCA */
      if (tags == NULL)
	return REG_ESPACE;
    }

  /* Dispatch to the appropriate matcher. */
  if (tnfa->have_backrefs || eflags & REG_BACKTRACKING_MATCHER)
    {
      /* The regex has back references, use the backtracking matcher. */
      if (type == STR_USER)
	{
	  const tre_str_source *source = string;
	  if (source->rewind == NULL || source->compare == NULL)
	    /* The backtracking matcher requires rewind and compare
	       capabilities from the input stream. */
	    return REG_BADPAT;
	}
      status = tre_tnfa_run_backtrack(tnfa, string, (int)len, type,
				      tags, eflags, &eo);
    }
#ifdef TRE_APPROX
  else if (tnfa->have_approx || eflags & REG_APPROX_MATCHER)
    {
      /* The regex uses approximate matching, use the approximate matcher. */
      regamatch_t match;
      regaparams_t params;
      tre_regaparams_default(&params);
      params.max_err = 0;
      params.max_cost = 0;
      status = tre_tnfa_run_approx(tnfa, string, (int)len, type, tags,
				   &match, params, eflags, &eo);
    }
#endif /* TRE_APPROX */
  else
    {
      /* Exact matching, no back references, use the parallel matcher. */
      status = tre_tnfa_run_parallel(tnfa, string, (int)len, type,
				     tags, eflags, &eo);
    }

  if (status == REG_OK)
    /* A match was found, so fill the submatch registers. */
    tre_fill_pmatch(nmatch, pmatch, tnfa->cflags, tnfa, tags, eo);
#ifndef TRE_USE_ALLOCA
  if (tags)
    xfree(tags);
#endif /* !TRE_USE_ALLOCA */
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r13
movq %r8, %r14
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r15
movslq 0x48(%rdi), %rdi
testq %rdi, %rdi
setle %al
testq %r8, %r8
sete %cl
orb %al, %cl
jne 0x8fccf
shlq $0x2, %rdi
movq %rdx, %r12
callq 0xb810
movq %r12, %rdx
movq %rax, %r12
testq %rax, %rax
jne 0x8fcd2
movl $0xc, %r13d
jmp 0x8fd65
xorl %r12d, %r12d
movq %r13, 0x10(%rsp)
movl 0x50(%rsp), %r9d
movl %r9d, %eax
andl $0x8, %eax
orl 0x5c(%r15), %eax
je 0x8fd1c
cmpl $0x3, %ebp
jne 0x8fd01
movl $0x2, %r13d
cmpq $0x0, 0x8(%rbx)
je 0x8fd65
cmpq $0x0, 0x10(%rbx)
je 0x8fd65
leaq 0xc(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %ecx
movq %r12, %r8
callq 0x93290
jmp 0x8fd35
leaq 0xc(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %ecx
movq %r12, %r8
callq 0x94414
movl %eax, %r13d
testl %eax, %eax
jne 0x8fd58
movl 0x58(%r15), %edx
movl 0xc(%rsp), %r9d
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rcx
movq %r12, %r8
callq 0x8fabc
testq %r12, %r12
je 0x8fd65
movq %r12, %rdi
callq 0xb790
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq