// File: /workspace/github_c_makefile_star2_O1/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
movq %r9, %rbx
movl %r8d, 0x18(%rsp)
movq %rcx, %r13
movq %rsi, %rbp
movq %rdi, (%rsp)
testq %rcx, %rcx
je 0x928c2
xorl %eax, %eax
cmpl $0x0, (%r13,%rax,4)
js 0x928bb
incq %rax
testq %r13, %r13
jne 0x928ab
movq %rax, 0x20(%rsp)
jmp 0x928cb
movq $0x0, 0x20(%rsp)
movq $-0x40, %r8
cmpl $0x0, 0x40(%rbp,%r8)
leaq 0x40(%r8), %r8
jns 0x928d2
movq %rdx, 0x28(%rsp)
movq %rdx, %rax
addq $0x40, %r8
cmpl $0x0, (%rax)
leaq 0x40(%rax), %rax
jns 0x928e6
movabsq $0x3fffffffc0, %rax     # imm = 0x3FFFFFFFC0
andq %rax, %r8
movq (%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x955ee
movl $0x0, %ecx
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x92c59
movl (%rbp), %eax
testl %eax, %eax
movq 0x10(%rsp), %r8
movl $0x0, %r9d
js 0x92ad3
movq 0x20(%rsp), %rcx
leal 0x1(%rcx), %edx
movq %rdx, 0x38(%rsp)
movl %ecx, %r12d
movq $0x0, 0x8(%rsp)
xorl %r9d, %r9d
movq %r9, %r15
shlq $0x6, %r15
leaq (%r15,%rbp), %r10
movl %eax, (%r8,%r15)
movq 0x4(%rbp,%r15), %rax
movq %rax, 0x4(%r8,%r15)
movl 0x18(%rbp,%r15), %eax
orl 0x18(%rsp), %eax
movl %eax, 0x18(%r8,%r15)
movups 0x20(%rbp,%r15), %xmm0
movups %xmm0, 0x20(%r8,%r15)
movl 0x30(%rbp,%r15), %eax
movl %eax, 0x30(%r8,%r15)
movq 0x10(%rbp,%r15), %rax
movq %r13, %rcx
orq %rax, %rcx
jne 0x929ad
xorl %eax, %eax
jmp 0x92a54
movq %r9, 0x30(%rsp)
testq %rax, %rax
movq %r10, 0x40(%rsp)
je 0x929d0
xorl %r14d, %r14d
cmpl $0x0, (%rax,%r14,4)
js 0x929d3
incq %r14
testq %rax, %rax
jne 0x929bf
jmp 0x929d3
xorl %r14d, %r14d
movq 0x38(%rsp), %rax
leal (%rax,%r14), %r8d
shlq $0x2, %r8
movq (%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x955ee
testq %rax, %rax
je 0x92c59
xorl %ecx, %ecx
movl $0x0, %edx
testl %r14d, %r14d
movq 0x40(%rsp), %r10
je 0x92a22
movq 0x10(%r10), %rsi
movl %r14d, %edi
xorl %edx, %edx
movl (%rsi,%rdx,4), %r8d
movl %r8d, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rdi
jne 0x92a12
cmpl $0x0, 0x20(%rsp)
movq 0x10(%rsp), %r8
movq 0x30(%rsp), %r9
je 0x92a4b
movl %edx, %ecx
leaq (%rax,%rcx,4), %rsi
xorl %ecx, %ecx
movl (%r13,%rcx,4), %edi
movl %edi, (%rsi,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x92a3b
addl %edx, %ecx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
addq %r8, %r15
movq %rax, 0x10(%r15)
movq 0x38(%r10), %rax
testq %rax, %rax
je 0x92a68
movq %rax, 0x38(%r15)
testq %rbx, %rbx
je 0x92abd
cmpq $0x0, 0x38(%r15)
je 0x92ab9
movq %r9, %r14
movl $0x24, %r8d
movq (%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x955ee
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x92c59
xorl %ecx, %ecx
movq 0x10(%rsp), %r8
movq %r14, %r9
movl (%rbx,%rcx,4), %edx
cmpl $-0x1, %edx
je 0x92aae
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq $0x9, %rcx
jne 0x92aa3
jmp 0x92abd
movq %rbx, 0x38(%r15)
incq %r9
movq %r9, %rax
shlq $0x6, %rax
movl (%rbp,%rax), %eax
testl %eax, %eax
jns 0x9295c
movq 0x28(%rsp), %rax
movl (%rax), %eax
testl %eax, %eax
movq %r9, 0x30(%rsp)
js 0x92c3b
movl %r9d, %ecx
shlq $0x6, %rcx
movq %r8, %r12
addq %rcx, %r12
movq 0x28(%rsp), %rcx
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %r14, %r15
shlq $0x6, %r15
leaq (%rcx,%r15), %rdi
movl %eax, (%r12,%r15)
movq 0x4(%rcx,%r15), %rax
movq %rax, 0x4(%r12,%r15)
movl 0x18(%rcx,%r15), %eax
movl %eax, 0x18(%r12,%r15)
movups 0x20(%rcx,%r15), %xmm0
movups %xmm0, 0x20(%r12,%r15)
movl 0x30(%rcx,%r15), %eax
movl %eax, 0x30(%r12,%r15)
movq 0x10(%rcx,%r15), %rax
testq %rax, %rax
je 0x92bb3
movq %rdi, 0x18(%rsp)
movl $0x1, %ebp
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rcx, %r13
decq %rbp
cmpl $0x0, (%rax,%r8)
leaq 0x4(%r8), %r8
leaq 0x1(%rcx), %rcx
jns 0x92b57
movabsq $0x3fffffffc, %rax      # imm = 0x3FFFFFFFC
andq %rax, %r8
movq (%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x955ee
testq %rax, %rax
je 0x92c59
testq %rbp, %rbp
je 0x92bb7
movq 0x18(%rsp), %rdi
movq 0x10(%rdi), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
decq %r13
jne 0x92ba1
movl %edx, %ecx
jmp 0x92bbe
xorl %eax, %eax
jmp 0x92bc5
xorl %ecx, %ecx
movq 0x18(%rsp), %rdi
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
addq %r12, %r15
movq %rax, 0x10(%r15)
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x92bd9
movq %rax, 0x38(%r15)
testq %rbx, %rbx
je 0x92c1f
cmpq $0x0, 0x38(%r15)
je 0x92c1b
movl $0x24, %r8d
movq (%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x955ee
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x92c59
xorl %ecx, %ecx
movl (%rbx,%rcx,4), %edx
cmpl $-0x1, %edx
je 0x92c10
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq $0x9, %rcx
jne 0x92c05
jmp 0x92c1f
movq %rbx, 0x38(%r15)
incq %r14
movq %r14, %rax
shlq $0x6, %rax
movq 0x28(%rsp), %rcx
movl (%rcx,%rax), %eax
testl %eax, %eax
jns 0x92b05
jmp 0x92c3e
xorl %r14d, %r14d
addl 0x30(%rsp), %r14d
shlq $0x6, %r14
movq 0x10(%rsp), %rax
movl $0xffffffff, (%rax,%r14) # imm = 0xFFFFFFFF
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq