// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/tre/lib/tre-compile.c
// Function: tre_set_union
static tre_pos_and_tags_t *
tre_set_union(tre_mem_t mem, tre_pos_and_tags_t *set1, tre_pos_and_tags_t *set2,
	      int *tags, int assertions, int *params)
{
  int s1, s2, i, j;
  tre_pos_and_tags_t *new_set;
  int *new_tags;
  int num_tags;

  for (num_tags = 0; tags != NULL && tags[num_tags] >= 0; num_tags++);
  for (s1 = 0; set1[s1].position >= 0; s1++);
  for (s2 = 0; set2[s2].position >= 0; s2++);
  new_set = tre_mem_calloc(mem, sizeof(*new_set) * (s1 + s2 + 1));
  if (!new_set )
    return NULL;

  for (s1 = 0; set1[s1].position >= 0; s1++)
    {
      new_set[s1].position = set1[s1].position;
      new_set[s1].code_min = set1[s1].code_min;
      new_set[s1].code_max = set1[s1].code_max;
      new_set[s1].assertions = set1[s1].assertions | assertions;
      new_set[s1].class = set1[s1].class;
      new_set[s1].neg_classes = set1[s1].neg_classes;
      new_set[s1].backref = set1[s1].backref;
      if (set1[s1].tags == NULL && tags == NULL)
	new_set[s1].tags = NULL;
      else
	{
	  for (i = 0; set1[s1].tags != NULL && set1[s1].tags[i] >= 0; i++);
	  new_tags = tre_mem_alloc(mem, (sizeof(*new_tags)
					 * (i + num_tags + 1)));
	  if (new_tags == NULL)
	    return NULL;
	  for (j = 0; j < i; j++)
	    new_tags[j] = set1[s1].tags[j];
	  for (i = 0; i < num_tags; i++)
	    new_tags[j + i] = tags[i];
	  new_tags[j + i] = -1;
	  new_set[s1].tags = new_tags;
	}
      if (set1[s1].params)
	new_set[s1].params = set1[s1].params;
      if (params)
	{
	  if (!new_set[s1].params)
	    new_set[s1].params = params;
	  else
	    {
	      new_set[s1].params = tre_mem_alloc(mem, sizeof(*params) *
						 TRE_PARAM_LAST);
	      if (!new_set[s1].params)
		return NULL;
	      for (i = 0; i < TRE_PARAM_LAST; i++)
		if (params[i] != TRE_PARAM_UNSET)
		  new_set[s1].params[i] = params[i];
	    }
	}
    }

  for (s2 = 0; set2[s2].position >= 0; s2++)
    {
      new_set[s1 + s2].position = set2[s2].position;
      new_set[s1 + s2].code_min = set2[s2].code_min;
      new_set[s1 + s2].code_max = set2[s2].code_max;
      /* XXX - why not | assertions here as well? */
      new_set[s1 + s2].assertions = set2[s2].assertions;
      new_set[s1 + s2].class = set2[s2].class;
      new_set[s1 + s2].neg_classes = set2[s2].neg_classes;
      new_set[s1 + s2].backref = set2[s2].backref;
      if (set2[s2].tags == NULL)
	new_set[s1 + s2].tags = NULL;
      else
	{
	  for (i = 0; set2[s2].tags[i] >= 0; i++);
	  new_tags = tre_mem_alloc(mem, sizeof(*new_tags) * (i + 1));
	  if (new_tags == NULL)
	    return NULL;
	  for (j = 0; j < i; j++)
	    new_tags[j] = set2[s2].tags[j];
	  new_tags[j] = -1;
	  new_set[s1 + s2].tags = new_tags;
	}
      if (set2[s2].params)
	new_set[s1 + s2].params = set2[s2].params;
      if (params)
	{
	  if (!new_set[s1 + s2].params)
	    new_set[s1 + s2].params = params;
	  else
	    {
	      new_set[s1 + s2].params = tre_mem_alloc(mem, sizeof(*params) *
						      TRE_PARAM_LAST);
	      if (!new_set[s1 + s2].params)
		return NULL;
	      for (i = 0; i < TRE_PARAM_LAST; i++)
		if (params[i] != TRE_PARAM_UNSET)
		  new_set[s1 + s2].params[i] = params[i];
	    }
	}
    }
  new_set[s1 + s2].position = -1;
  return new_set;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, 0x2c(%rsp)
movq %rcx, %r13
movq %rdi, 0x8(%rsp)
pushq $-0x4
popq %rax
xorl %r15d, %r15d
testq %r13, %r13
je 0x733dd
cmpl $0x0, (%r13,%r15,4)
js 0x733dd
incq %r15
addq $-0x4, %rax
jmp 0x733c7
negq %rax
movq %rax, 0x38(%rsp)
pushq $-0x40
popq %r8
cmpl $0x0, 0x40(%rsi,%r8)
leaq 0x40(%r8), %r8
jns 0x733e9
movq %rsi, 0x20(%rsp)
movq %r9, (%rsp)
movq %rdx, 0x40(%rsp)
movq %rdx, %rax
addq $0x40, %r8
cmpl $0x0, (%rax)
leaq 0x40(%rax), %rax
jns 0x73406
movabsq $0x3fffffffc0, %rax     # imm = 0x3FFFFFFFC0
andq %rax, %r8
movq $0x0, 0x10(%rsp)
pushq $0x1
popq %rcx
movq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x75ecf
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x73712
movq $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rcx, %rbp
shlq $0x6, %rbp
movl (%rsi,%rbp), %eax
testl %eax, %eax
movq %rcx, 0x30(%rsp)
js 0x735c3
leaq (%rsi,%rbp), %r12
movq 0x18(%rsp), %rcx
movl %eax, (%rcx,%rbp)
movq 0x4(%r12), %rax
movq %rax, 0x4(%rcx,%rbp)
movl 0x18(%r12), %eax
orl 0x2c(%rsp), %eax
movl %eax, 0x18(%rcx,%rbp)
movups 0x20(%r12), %xmm0
movups %xmm0, 0x20(%rcx,%rbp)
movl 0x30(%r12), %eax
movl %eax, 0x30(%rcx,%rbp)
movq 0x10(%r12), %rax
movq %r13, %rcx
orq %rax, %rcx
jne 0x734be
xorl %eax, %eax
jmp 0x7354d
movq 0x38(%rsp), %r8
xorl %ebx, %ebx
xorl %r14d, %r14d
testq %rax, %rax
je 0x734e0
cmpl $0x0, (%rax,%rbx)
js 0x734e0
decq %r14
addq $0x4, %rbx
addq $0x4, %r8
jmp 0x734c8
movabsq $0x3fffffffc, %rax      # imm = 0x3FFFFFFFC
andq %rax, %r8
movq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x75ecf
testq %rax, %rax
je 0x73712
xorl %ecx, %ecx
movq %r14, %rdx
addq %rcx, %rdx
je 0x73520
movq 0x10(%r12), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
jmp 0x73508
movq %rax, %rcx
addq %rbx, %rcx
xorl %edx, %edx
movq (%rsp), %rdi
cmpq %rdx, %r15
je 0x7353e
movl (%r13,%rdx,4), %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
jmp 0x7352c
movl %r15d, %ecx
subl %r14d, %ecx
orl $-0x1, (%rax,%rcx,4)
movq 0x20(%rsp), %rsi
addq 0x18(%rsp), %rbp
movq %rax, 0x10(%rbp)
movq 0x38(%r12), %rax
testq %rax, %rax
je 0x73564
movq %rax, 0x38(%rbp)
testq %rdi, %rdi
je 0x735b6
cmpq $0x0, 0x38(%rbp)
je 0x735b2
movq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
pushq $0x24
popq %r8
callq 0x75ecf
movq %rax, 0x38(%rbp)
testq %rax, %rax
je 0x73712
xorl %ecx, %ecx
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
cmpq $0x9, %rcx
je 0x735b6
movl (%rdi,%rcx,4), %edx
cmpl $-0x1, %edx
je 0x735ad
movl %edx, (%rax,%rcx,4)
incq %rcx
jmp 0x7359c
movq %rdi, 0x38(%rbp)
movq 0x30(%rsp), %rcx
incq %rcx
jmp 0x7345c
movl %ecx, %eax
shlq $0x6, %rax
movq 0x18(%rsp), %r13
addq %rax, %r13
movq $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movq %r15, %r12
shlq $0x6, %r12
movq 0x40(%rsp), %rcx
movl (%rcx,%r12), %eax
testl %eax, %eax
js 0x736fa
leaq (%rcx,%r12), %rbp
movl %eax, (%r13,%r12)
movq 0x4(%rbp), %rax
movq %rax, 0x4(%r13,%r12)
movl 0x18(%rbp), %eax
movl %eax, 0x18(%r13,%r12)
movups 0x20(%rbp), %xmm0
movups %xmm0, 0x20(%r13,%r12)
movl 0x30(%rbp), %eax
movl %eax, 0x30(%r13,%r12)
movq 0x10(%rbp), %rax
testq %rax, %rax
je 0x7368e
xorl %ecx, %ecx
xorl %r14d, %r14d
movq %rcx, %rbx
cmpl $0x0, (%rax,%r14)
leaq 0x4(%r14), %r14
leaq 0x1(%rcx), %rcx
jns 0x7362f
movq %r14, %r8
movabsq $0x3fffffffc, %rax      # imm = 0x3FFFFFFFC
andq %rax, %r8
movq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x75ecf
testq %rax, %rax
je 0x73712
xorl %ecx, %ecx
movq (%rsp), %rdi
subq $0x1, %rbx
jb 0x73686
movq 0x10(%rbp), %rdx
movl (%rdx,%rcx), %edx
movl %edx, (%rax,%rcx)
addq $0x4, %rcx
jmp 0x73670
orl $-0x1, -0x4(%rax,%r14)
jmp 0x73690
xorl %eax, %eax
addq %r13, %r12
movq %rax, 0x10(%r12)
movq 0x38(%rbp), %rax
testq %rax, %rax
je 0x736a6
movq %rax, 0x38(%r12)
testq %rdi, %rdi
je 0x736f2
cmpq $0x0, 0x38(%r12)
je 0x736ed
movq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
pushq $0x24
popq %r8
callq 0x75ecf
movq %rax, 0x38(%r12)
testq %rax, %rax
je 0x73712
xorl %ecx, %ecx
movq (%rsp), %rdi
cmpq $0x9, %rcx
je 0x736f2
movl (%rdi,%rcx,4), %edx
cmpl $-0x1, %edx
je 0x736e8
movl %edx, (%rax,%rcx,4)
incq %rcx
jmp 0x736d7
movq %rdi, 0x38(%r12)
incq %r15
jmp 0x735dd
addl 0x30(%rsp), %r15d
shlq $0x6, %r15
movq 0x18(%rsp), %rax
orl $-0x1, (%rax,%r15)
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq