// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xbf9b0
jmp 0xbf345
movq 0x48(%rsp), %rax
cmpl $0x0, (%rax)
jl 0xbf9ae
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq 0x40(%rsp), %rax
cmpl $0x0, (%rax)
jl 0xbf99b
movq 0x40(%rsp), %rax
movl (%rax), %eax
cmpl (%rsp), %eax
jne 0xbf38e
movq 0x40(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x40(%rsp)
jmp 0xbf364
movq 0x40(%rsp), %rax
movl (%rax), %eax
movl %eax, (%rsp)
movq 0x38(%rsp), %rax
movq 0x28(%rsp), %rcx
movq 0x48(%rsp), %rdx
movslq (%rdx), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0xbf3d6
movq 0x18(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x18(%rsp)
jmp 0xbf3ba
movq 0x18(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xbf3ef
movq 0x18(%rsp), %rax
movq $0x0, 0x48(%rax)
movq 0x48(%rsp), %rax
movl 0x4(%rax), %eax
movw %ax, %cx
movq 0x18(%rsp), %rax
movw %cx, (%rax)
movq 0x48(%rsp), %rax
movl 0x8(%rax), %eax
movw %ax, %cx
movq 0x18(%rsp), %rax
movw %cx, 0x2(%rax)
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rax
movq 0x40(%rsp), %rdx
movslq (%rdx), %rdx
movslq (%rax,%rdx,4), %rax
shlq $0x6, %rax
addq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x40(%rsp), %rax
movl (%rax), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x48(%rsp), %rax
movl 0x18(%rax), %ecx
movq 0x40(%rsp), %rax
orl 0x18(%rax), %ecx
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rsi
xorl %eax, %eax
movl $0x4, %edx
cmpq $0x0, %rsi
cmovnel %edx, %eax
orl %eax, %ecx
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rsi
xorl %eax, %eax
movl $0x8, %edx
cmpq $0x0, %rsi
cmovnel %edx, %eax
orl %eax, %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x28(%rax)
movq 0x48(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jl 0xbf524
movq 0x18(%rsp), %rax
movl 0x28(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0xbf4b6
jmp 0xbf4d5
leaq 0xb6084(%rip), %rdi     # 0x175541
leaq 0xb5d47(%rip), %rsi     # 0x17520b
movl $0x65f, %edx            # imm = 0x65F
leaq 0xb609e(%rip), %rcx     # 0x17556e
callq 0xb3e0
movq 0x40(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jge 0xbf4e2
jmp 0xbf501
leaq 0xb60f5(%rip), %rdi     # 0x1755de
leaq 0xb5d1b(%rip), %rsi     # 0x17520b
movl $0x660, %edx            # imm = 0x660
leaq 0xb6072(%rip), %rcx     # 0x17556e
callq 0xb3e0
movq 0x48(%rsp), %rax
movl 0x30(%rax), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x30(%rax)
movq 0x18(%rsp), %rax
movl 0x28(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x28(%rax)
jmp 0xbf536
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x48(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0xbf610
movl $0x0, 0x14(%rsp)
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movslq 0x14(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xbf572
jmp 0xbf565
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xbf54e
movl 0x14(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0xbcb8
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jne 0xbf5aa
movl $0xc, 0x54(%rsp)
jmp 0xbfa10
movl $0x0, 0x14(%rsp)
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movslq 0x14(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xbf5f8
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x14(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xbf5b2
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x14(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0xbf61d
movq 0x18(%rsp), %rax
movq $0x0, 0x38(%rax)
movl $0x0, 0x14(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0xbf656
jmp 0xbf633
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x14(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0xbf654
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xbf633
jmp 0xbf656
movl $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0xbf68f
jmp 0xbf66c
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x10(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0xbf68d
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0xbf66c
jmp 0xbf68f
movq 0x18(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0xbf6a9
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0xb760
movq 0x18(%rsp), %rax
movq $0x0, 0x18(%rax)
movl 0x14(%rsp), %eax
addl 0x10(%rsp), %eax
cmpl $0x0, %eax
jle 0xbf84a
movl 0x14(%rsp), %eax
addl 0x10(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0xbcb8
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0xbf703
movl $0xc, 0x54(%rsp)
jmp 0xbfa10
movl $0x0, 0x14(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0xbf75e
jmp 0xbf719
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x14(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0xbf75c
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x14(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x14(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xbf719
jmp 0xbf75e
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0xbf835
jmp 0xbf780
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x10(%rsp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0xbf833
movl $0x0, 0x4(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0xbf7ef
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0xc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rcx
movslq 0x10(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xbf7e0
movl $0x1, 0x4(%rsp)
jmp 0xbf7ef
jmp 0xbf7e2
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xbf7a8
cmpl $0x0, 0x4(%rsp)
jne 0xbf823
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x10(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x8(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x8(%rsp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0xbf780
jmp 0xbf835
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x8(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq 0x48(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jne 0xbf866
movq 0x40(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xbf961
movq 0x18(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xbf888
movl $0x24, %edi
callq 0xbcb8
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xbf8a1
movl $0xc, 0x54(%rsp)
jmp 0xbfa10
movl $0x0, 0x14(%rsp)
cmpl $0x9, 0x14(%rsp)
jge 0xbf95f
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x14(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq 0x48(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xbf90b
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x14(%rsp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0xbf90b
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x14(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x14(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x40(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xbf94d
movq 0x40(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x14(%rsp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0xbf94d
movq 0x40(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x14(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x14(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xbf94f
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xbf8a9
jmp 0xbf988
movq 0x18(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0xbf97b
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xb760
movq 0x18(%rsp), %rax
movq $0x0, 0x20(%rax)
movq 0x40(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x40(%rsp)
jmp 0xbf364
movq 0x48(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x48(%rsp)
jmp 0xbf345
jmp 0xbfa08
jmp 0xbf9b2
movq 0x48(%rsp), %rax
cmpl $0x0, (%rax)
jl 0xbfa06
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
cmpl $0x0, (%rax)
jl 0xbf9f6
movq 0x30(%rsp), %rax
movq 0x48(%rsp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x40(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x40(%rsp)
jmp 0xbf9c6
movq 0x48(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x48(%rsp)
jmp 0xbf9b2
jmp 0xbfa08
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)