// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/tre/lib/regexec.c
// Function: tre_fill_pmatch
void
tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
		const tre_tnfa_t *tnfa, int *tags, int match_eo)
{
  tre_submatch_data_t *submatch_data;
  unsigned int i, j;
  int *parents;

  i = 0;
  if (match_eo >= 0 && !(cflags & REG_NOSUB))
    {
      /* Construct submatch offsets from the tags. */
      DPRINT(("end tag = t%d = %d\n", tnfa->end_tag, match_eo));
      submatch_data = tnfa->submatch_data;
      while (i < tnfa->num_submatches && i < nmatch)
	{
	  if (submatch_data[i].so_tag == tnfa->end_tag)
	    pmatch[i].rm_so = match_eo;
	  else
	    pmatch[i].rm_so = tags[submatch_data[i].so_tag];

	  if (submatch_data[i].eo_tag == tnfa->end_tag)
	    pmatch[i].rm_eo = match_eo;
	  else
	    pmatch[i].rm_eo = tags[submatch_data[i].eo_tag];

	  /* If either of the endpoints were not used, this submatch
	     was not part of the match. */
	  if (pmatch[i].rm_so == -1 || pmatch[i].rm_eo == -1)
	    pmatch[i].rm_so = pmatch[i].rm_eo = -1;

	  DPRINT(("pmatch[%d] = {t%d = %d, t%d = %d}\n", i,
		  submatch_data[i].so_tag, pmatch[i].rm_so,
		  submatch_data[i].eo_tag, pmatch[i].rm_eo));
	  i++;
	}
      /* Reset all submatches that are not within all of their parent
	 submatches. */
      i = 0;
      while (i < tnfa->num_submatches && i < nmatch)
	{
	  if (pmatch[i].rm_eo == -1)
	    assert(pmatch[i].rm_so == -1);
	  assert(pmatch[i].rm_so <= pmatch[i].rm_eo);

	  parents = submatch_data[i].parents;
	  if (parents != NULL)
	    for (j = 0; parents[j] >= 0; j++)
	      {
		DPRINT(("pmatch[%d] parent %d\n", i, parents[j]));
		if (pmatch[i].rm_so < pmatch[parents[j]].rm_so
		    || pmatch[i].rm_eo > pmatch[parents[j]].rm_eo)
		  pmatch[i].rm_so = pmatch[i].rm_eo = -1;
	      }
	  i++;
	}
    }

  while (i < nmatch)
    {
      pmatch[i].rm_so = -1;
      pmatch[i].rm_eo = -1;
      i++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testl %r9d, %r9d
sets %r10b
andl $0x8, %edx
shrl $0x3, %edx
xorl %eax, %eax
orb %r10b, %dl
jne 0x8fbeb
movq 0x20(%rcx), %rdx
movl 0x34(%rcx), %r10d
testq %r10, %r10
sete %r11b
testq %rdi, %rdi
sete %bl
orb %r11b, %bl
jne 0x8fb54
movl 0x50(%rcx), %ecx
cmpq %rdi, %r10
movq %rdi, %r11
cmovbq %r10, %r11
leaq 0x4(%rdx), %rbx
xorl %r14d, %r14d
movslq -0x4(%rbx), %r15
movl %r9d, %ebp
cmpl %ecx, %r15d
je 0x8fb19
movl (%r8,%r15,4), %ebp
movl %ebp, (%rsi,%r14,8)
movslq (%rbx), %r15
movl %r9d, %ebp
cmpl %ecx, %r15d
je 0x8fb2c
movl (%r8,%r15,4), %ebp
movl %ebp, 0x4(%rsi,%r14,8)
cmpl $-0x1, (%rsi,%r14,8)
je 0x8fb40
cmpl $-0x1, 0x4(%rsi,%r14,8)
jne 0x8fb48
movq $-0x1, (%rsi,%r14,8)
incq %r14
addq $0x10, %rbx
cmpq %r11, %r14
jb 0x8fb09
testq %r10, %r10
sete %cl
testq %rdi, %rdi
sete %r8b
orb %cl, %r8b
jne 0x8fbeb
cmpq %rdi, %r10
cmovaeq %rdi, %r10
xorl %eax, %eax
movl 0x4(%rsi,%rax,8), %ecx
cmpl $-0x1, %ecx
jne 0x8fb86
cmpl $-0x1, (%rsi,%rax,8)
jne 0x8fc30
cmpl %ecx, (%rsi,%rax,8)
jg 0x8fc11
movq %rax, %rcx
shlq $0x4, %rcx
movq 0x8(%rdx,%rcx), %rcx
testq %rcx, %rcx
je 0x8fbe3
movl (%rcx), %r11d
testl %r11d, %r11d
js 0x8fbe3
movl (%rsi,%rax,8), %r9d
movl $0x1, %r8d
movl %r11d, %r11d
cmpl (%rsi,%r11,8), %r9d
jl 0x8fbc6
movl 0x4(%rsi,%rax,8), %ebx
cmpl 0x4(%rsi,%r11,8), %ebx
jle 0x8fbd4
movq $-0x1, (%rsi,%rax,8)
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl %r8d, %r11d
movl (%rcx,%r11,4), %r11d
incl %r8d
testl %r11d, %r11d
jns 0x8fbb2
incq %rax
cmpq %r10, %rax
jb 0x8fb73
movl %eax, %eax
cmpq %rdi, %rax
jae 0x8fc06
leal 0x1(%rax), %ecx
movq $-0x1, (%rsi,%rax,8)
movl %ecx, %eax
incl %ecx
cmpq %rdi, %rax
jb 0x8fbf5
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x673f2(%rip), %rdi     # 0xf700a
leaq 0x6737c(%rip), %rsi     # 0xf6f9b
leaq 0x67394(%rip), %rcx     # 0xf6fba
movl $0x61, %edx
callq 0xb400
leaq 0x6734e(%rip), %rdi     # 0xf6f85
leaq 0x6735d(%rip), %rsi     # 0xf6f9b
leaq 0x67375(%rip), %rcx     # 0xf6fba
movl $0x60, %edx
callq 0xb400