// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/tre-compile.c
// Function: tre_make_trans
static reg_errcode_t
tre_make_trans(tre_pos_and_tags_t *p1, tre_pos_and_tags_t *p2,
	       tre_tnfa_transition_t *transitions,
	       int *counts, int *offs)
{
  tre_pos_and_tags_t *orig_p2 = p2;
  tre_tnfa_transition_t *trans;
  int i, j, k, l, dup, prev_p2_pos;

  if (transitions != NULL)
    while (p1->position >= 0)
      {
	p2 = orig_p2;
	prev_p2_pos = -1;
	while (p2->position >= 0)
	  {
	    /* Optimization: if this position was already handled, skip it. */
	    if (p2->position == prev_p2_pos)
	      {
		p2++;
		continue;
	      }
	    prev_p2_pos = p2->position;
	    /* Set `trans' to point to the next unused transition from
	       position `p1->position'. */
	    trans = transitions + offs[p1->position];
	    while (trans->state != NULL)
	      {
#if 0
		/* If we find a previous transition from `p1->position' to
		   `p2->position', it is overwritten.  This can happen only
		   if there are nested loops in the regexp, like in "((a)*)*".
		   In POSIX.2 repetition using the outer loop is always
		   preferred over using the inner loop.	 Therefore the
		   transition for the inner loop is useless and can be thrown
		   away. */
		/* XXX - The same position is used for all nodes in a bracket
		   expression, so this optimization cannot be used (it will
		   break bracket expressions) unless I figure out a way to
		   detect it here. */
		if (trans->state_id == p2->position)
		  {
		    DPRINT(("*"));
		    break;
		  }
#endif
		trans++;
	      }

	    if (trans->state == NULL)
	      (trans + 1)->state = NULL;
	    /* Use the character ranges, assertions, etc. from `p1' for
	       the transition from `p1' to `p2'. */
	    trans->code_min = (tre_cint_t) p1->code_min;
	    trans->code_max = (tre_cint_t) p1->code_max;
	    trans->state = transitions + offs[p2->position];
	    trans->state_id = p2->position;
	    trans->assertions = p1->assertions | p2->assertions
	      | (p1->class ? ASSERT_CHAR_CLASS : 0)
	      | (p1->neg_classes != NULL ? ASSERT_CHAR_CLASS_NEG : 0);
	    if (p1->backref >= 0)
	      {
		assert((trans->assertions & ASSERT_CHAR_CLASS) == 0);
		assert(p2->backref < 0);
		trans->u.backref = p1->backref;
		trans->assertions |= ASSERT_BACKREF;
	      }
	    else
	      trans->u.class = p1->class;
	    if (p1->neg_classes != NULL)
	      {
		for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++);
		trans->neg_classes =
		  xmalloc(sizeof(*trans->neg_classes) * (i + 1));
		if (trans->neg_classes == NULL)
		  return REG_ESPACE;
		for (i = 0; p1->neg_classes[i] != (tre_ctype_t)0; i++)
		  trans->neg_classes[i] = p1->neg_classes[i];
		trans->neg_classes[i] = (tre_ctype_t)0;
	      }
	    else
	      trans->neg_classes = NULL;

	    /* Find out how many tags this transition has. */
	    i = 0;
	    if (p1->tags != NULL)
	      while(p1->tags[i] >= 0)
		i++;
	    j = 0;
	    if (p2->tags != NULL)
	      while(p2->tags[j] >= 0)
		j++;

	    /* If we are overwriting a transition, free the old tag array. */
	    if (trans->tags != NULL)
	      xfree(trans->tags);
	    trans->tags = NULL;

	    /* If there were any tags, allocate an array and fill it. */
	    if (i + j > 0)
	      {
		trans->tags = xmalloc(sizeof(*trans->tags) * (i + j + 1));
		if (!trans->tags)
		  return REG_ESPACE;
		i = 0;
		if (p1->tags != NULL)
		  while(p1->tags[i] >= 0)
		    {
		      trans->tags[i] = p1->tags[i];
		      i++;
		    }
		l = i;
		j = 0;
		if (p2->tags != NULL)
		  while (p2->tags[j] >= 0)
		    {
		      /* Don't add duplicates. */
		      dup = 0;
		      for (k = 0; k < i; k++)
			if (trans->tags[k] == p2->tags[j])
			  {
			    dup = 1;
			    break;
			  }
		      if (!dup)
			trans->tags[l++] = p2->tags[j];
		      j++;
		    }
		trans->tags[l] = -1;
	      }

	    /* Set the parameter array.	 If both `p2' and `p1' have same
	       parameters, the values in `p2' override those in `p1'. */
	    if (p1->params || p2->params)
	      {
		if (!trans->params)
		  trans->params = xmalloc(sizeof(*trans->params)
					  * TRE_PARAM_LAST);
		if (!trans->params)
		  return REG_ESPACE;
		for (i = 0; i < TRE_PARAM_LAST; i++)
		  {
		    trans->params[i] = TRE_PARAM_UNSET;
		    if (p1->params && p1->params[i] != TRE_PARAM_UNSET)
		      trans->params[i] = p1->params[i];
		    if (p2->params && p2->params[i] != TRE_PARAM_UNSET)
		      trans->params[i] = p2->params[i];
		  }
	      }
	    else
	      {
		if (trans->params)
		  xfree(trans->params);
		trans->params = NULL;
	      }


#ifdef TRE_DEBUG
	    {
	      int *tags;

	      DPRINT(("	 %2d -> %2d on %3d", p1->position, p2->position,
		      p1->code_min));
	      if (p1->code_max != p1->code_min)
		DPRINT(("-%3d", p1->code_max));
	      tags = trans->tags;
	      if (tags)
		{
		  DPRINT((", tags ["));
		  while (*tags >= 0)
		    {
		      DPRINT(("%d", *tags));
		      tags++;
		      if (*tags >= 0)
			DPRINT((","));
		    }
		  DPRINT(("]"));
		}
	      if (trans->assertions)
		DPRINT((", assert %d", trans->assertions));
	      if (trans->assertions & ASSERT_BACKREF)
		DPRINT((", backref %d", trans->u.backref));
	      else if (trans->u.class)
		DPRINT((", class %ld", (GtWord)trans->u.class));
	      if (trans->neg_classes)
		DPRINT((", neg_classes %p", trans->neg_classes));
	      if (trans->params)
		{
		  DPRINT((", "));
		  tre_print_params(trans->params);
		}
	      DPRINT(("\n"));
	    }
#endif /* TRE_DEBUG */
	    p2++;
	  }
	p1++;
      }
  else
    /* Compute a maximum limit for the number of transitions leaving
       from each state. */
    while (p1->position >= 0)
      {
	p2 = orig_p2;
	while (p2->position >= 0)
	  {
	    counts[p1->position]++;
	    p2++;
	  }
	p1++;
      }
  return REG_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r9
movq %rdi, %r14
movl (%rdi), %esi
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0x92b3b
testl %esi, %esi
js 0x92b37
movq 0x8(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x20(%rsp)
movq %r9, 0x18(%rsp)
movq %r8, 0x10(%rsp)
movl (%r9), %eax
testl %eax, %eax
js 0x92b28
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %r9, %rbx
movl %r13d, %ecx
addq $0x40, %rbx
movl %eax, %r13d
cmpl %ecx, %r13d
jne 0x92889
movl (%rbx), %r13d
addq $0x40, %rbx
testl %r13d, %r13d
jns 0x92873
jmp 0x92b28
movslq (%r14), %rax
movslq (%r8,%rax,4), %r12
shlq $0x6, %r12
addq 0x20(%rsp), %r12
cmpq $0x0, 0x10(%r12)
leaq 0x40(%r12), %r12
jne 0x92899
movq $0x0, 0x10(%r12)
movq 0x4(%r14), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, -0x38(%r12)
movl %r13d, %eax
movslq (%r8,%rax,4), %rax
shlq $0x6, %rax
addq 0x8(%rsp), %rax
movq %rax, -0x30(%r12)
movl %r13d, -0x28(%r12)
movl -0x28(%rbx), %eax
orl 0x18(%r14), %eax
movq 0x20(%r14), %rcx
xorl %edx, %edx
testq %rcx, %rcx
setne %dl
shll $0x2, %edx
orl %eax, %edx
xorl %eax, %eax
cmpq $0x0, 0x28(%r14)
setne %al
shll $0x3, %eax
orl %edx, %eax
movl %eax, -0x10(%r12)
movl 0x30(%r14), %esi
testl %esi, %esi
js 0x92933
testb $0x4, %dl
jne 0x92b7e
cmpl $0x0, -0x10(%rbx)
jns 0x92b9d
movl %esi, -0x8(%r12)
orl $0x100, %eax            # imm = 0x100
movl %eax, -0x10(%r12)
jmp 0x92938
movq %rcx, -0x8(%r12)
movq 0x28(%r14), %r15
movq %r12, %rax
testq %r15, %r15
je 0x9299b
xorl %edi, %edi
cmpq $0x0, (%r15,%rdi)
leaq 0x8(%rdi), %rdi
jne 0x92946
movabsq $0x7fffffff8, %rax      # imm = 0x7FFFFFFF8
andq %rax, %rdi
callq 0xb810
movq %rax, (%r12)
testq %rax, %rax
je 0x92b6a
movq (%r15), %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
je 0x92997
movq (%r12), %rax
movq %rdx, (%rax,%rcx,8)
movq 0x28(%r14), %rax
movq 0x8(%rax,%rcx,8), %rdx
incq %rcx
testq %rdx, %rdx
jne 0x9297a
movq (%r12), %rax
leaq (%rax,%rcx,8), %rax
movq $0x0, (%rax)
movq 0x10(%r14), %rax
xorl %r15d, %r15d
movl $0x0, %ebp
testq %rax, %rax
je 0x929c3
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
incl %ebp
cmpl $0x0, (%rax)
leaq 0x4(%rax), %rax
jns 0x929b8
movq -0x30(%rbx), %rax
testq %rax, %rax
je 0x929de
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
incl %r15d
cmpl $0x0, (%rax)
leaq 0x4(%rax), %rax
jns 0x929d2
movq -0x20(%r12), %rdi
testq %rdi, %rdi
je 0x929ed
callq 0xb790
movq $0x0, -0x20(%r12)
addl %ebp, %r15d
je 0x92a8f
movl %r15d, %eax
leaq 0x4(,%rax,4), %rdi
callq 0xb810
movq %rax, -0x20(%r12)
testq %rax, %rax
je 0x92b6a
movq 0x10(%r14), %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
je 0x92a3e
movl (%rdx), %esi
testl %esi, %esi
js 0x92a3e
xorl %ecx, %ecx
movl %esi, (%rax,%rcx,4)
movl 0x4(%rdx,%rcx,4), %esi
incq %rcx
testl %esi, %esi
jns 0x92a30
movq -0x30(%rbx), %rdx
testq %rdx, %rdx
je 0x92a83
movl (%rdx), %r9d
testl %r9d, %r9d
js 0x92a83
movl %ecx, %edi
xorl %r8d, %r8d
movl %ecx, %esi
testl %ecx, %ecx
je 0x92a6b
xorl %r10d, %r10d
cmpl %r9d, (%rax,%r10,4)
je 0x92a74
incq %r10
cmpq %r10, %rdi
jne 0x92a5d
movslq %esi, %r10
incl %esi
movl %r9d, (%rax,%r10,4)
movl 0x4(%rdx,%r8,4), %r9d
incq %r8
testl %r9d, %r9d
jns 0x92a56
jmp 0x92a85
movl %ecx, %esi
movslq %esi, %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq 0x38(%r14), %r15
testq %r15, %r15
jne 0x92a9f
cmpq $0x0, -0x8(%rbx)
je 0x92b0e
movq -0x18(%r12), %rax
testq %rax, %rax
jne 0x92ac1
movl $0x24, %edi
callq 0xb810
movq %rax, -0x18(%r12)
testq %rax, %rax
je 0x92b6a
movq -0x8(%rbx), %rcx
xorl %edx, %edx
movl $0xffffffff, (%rax,%rdx,4) # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x92adf
movl (%r15,%rdx,4), %esi
cmpl $-0x1, %esi
je 0x92adf
movl %esi, (%rax,%rdx,4)
testq %rcx, %rcx
je 0x92aef
movl (%rcx,%rdx,4), %esi
cmpl $-0x1, %esi
je 0x92aef
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq $0x9, %rdx
jne 0x92ac7
movl (%rbx), %eax
testl %eax, %eax
movq 0x18(%rsp), %r9
movq 0x10(%rsp), %r8
jns 0x92869
jmp 0x92b28
movq -0x18(%r12), %rdi
testq %rdi, %rdi
je 0x92b1d
callq 0xb790
movq $0x0, -0x18(%r12)
jmp 0x92af8
cmpl $0x0, 0x40(%r14)
leaq 0x40(%r14), %r14
jns 0x92855
xorl %eax, %eax
jmp 0x92b6f
xorl %eax, %eax
testl %esi, %esi
js 0x92b6f
leaq 0x40(%r9), %rdx
cmpl $0x0, (%r9)
js 0x92b5d
movq %rdx, %rsi
movslq (%r14), %rdi
incl (%rcx,%rdi,4)
cmpl $0x0, (%rsi)
leaq 0x40(%rsi), %rsi
jns 0x92b4e
cmpl $0x0, 0x40(%r14)
leaq 0x40(%r14), %r14
jns 0x92b45
jmp 0x92b6f
movl $0xc, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x64801(%rip), %rdi     # 0xf7386
leaq 0x644f7(%rip), %rsi     # 0xf7083
leaq 0x64820(%rip), %rcx     # 0xf73b3
movl $0x65f, %edx            # imm = 0x65F
callq 0xb400
leaq 0x6487f(%rip), %rdi     # 0xf7423
leaq 0x644d8(%rip), %rsi     # 0xf7083
leaq 0x64801(%rip), %rcx     # 0xf73b3
movl $0x660, %edx            # imm = 0x660
callq 0xb400