// File: /workspace/github_c_makefile_star2_O1/thegenemyers[P]DASCRUBBER/DASrealign.c
// Function: fusion
static void fusion(Path *path1, Path *path2, int wch)
{ static uint16  *paths = NULL;
  static int      pmax  = 0;
  static int      ptop  = 0;

  int     k;
  int     len;
  uint16 *trace;

  if (path1 == NULL)
    { ptop = 0;
      return;
    }

  len = path1->tlen + path2->tlen;

  if (ptop + len >= pmax)
    { pmax = 1.2*(ptop+len) + 1000;
      paths = (uint16 *) Realloc(paths,sizeof(uint16)*pmax,"Allocating paths");
      if (paths == NULL)
        exit (1);
    }
  trace = paths+ptop;
  ptop += len;

  len  = 0;
  if (path1->tlen > 0)
    { uint16 *t = (uint16 *) (path1->trace);
      for (k = 0; k < path1->tlen; k += 2)
        { trace[len++] = t[k];
          trace[len++] = t[k+1];
        }
    }
  if (path2->tlen > 0)
    { uint16 *t = (uint16 *) (path2->trace);
      for (k = 0; k < path2->tlen; k += 2)
        { trace[len++] = t[k];
          trace[len++] = t[k+1];
        }
    }

  if (wch == 1)
    { path1->aepos  = path2->aepos;
      path1->bepos  = path2->bepos;
      path1->diffs += path2->diffs;
      path1->trace  = trace;
      path1->tlen   = len;
    }
  else
    { path2->abpos  = path1->abpos;
      path2->bbpos  = path1->bbpos;
      path2->diffs += path1->diffs;
      path2->trace  = trace;
      path2->tlen   = len;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x44ca
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rsi), %r15d
addl 0x8(%rdi), %r15d
movl 0x1cfab(%rip), %eax     # 0x213d4
addl %r15d, %eax
cmpl 0x1cf9e(%rip), %eax     # 0x213d0
jl 0x447b
cvtsi2sd %eax, %xmm0
mulsd 0x16bc8(%rip), %xmm0    # 0x1b008
addsd 0x16be8(%rip), %xmm0    # 0x1b030
cvttsd2si %xmm0, %eax
movl %eax, 0x1cf7e(%rip)     # 0x213d0
movq 0x1cf6f(%rip), %rdi     # 0x213c8
movslq %eax, %rsi
addq %rsi, %rsi
leaq 0x16e8b(%rip), %rdx     # 0x1b2f1
callq 0x13185
movq %rax, 0x1cf56(%rip)     # 0x213c8
testq %rax, %rax
je 0x456b
movq 0x1cf46(%rip), %rcx     # 0x213c8
movslq 0x1cf4b(%rip), %rdx     # 0x213d4
addl %edx, %r15d
movl %r15d, 0x1cf41(%rip)    # 0x213d4
movslq 0x8(%r14), %rsi
testq %rsi, %rsi
jle 0x44d9
movq (%r14), %rdi
leaq (%rcx,%rdx,2), %r8
addq $0x2, %r8
xorl %eax, %eax
movzwl (%rdi,%rax,2), %r9d
movw %r9w, -0x2(%r8,%rax,2)
movzwl 0x2(%rdi,%rax,2), %r9d
movw %r9w, (%r8,%rax,2)
addq $0x2, %rax
cmpq %rsi, %rax
jb 0x44a9
jmp 0x44db
movl $0x0, 0x1cf00(%rip)     # 0x213d4
jmp 0x4560
xorl %eax, %eax
movslq 0x8(%rbx), %rsi
testq %rsi, %rsi
jle 0x451e
movq (%rbx), %rdi
movl %eax, %eax
leaq (%rax,%rax), %r8
leaq (%r8,%rdx,2), %r8
leaq (%rcx,%r8), %r9
addq $0x2, %r9
xorl %r8d, %r8d
movzwl (%rdi,%r8,2), %r10d
movw %r10w, -0x2(%r9,%r8,2)
movzwl 0x2(%rdi,%r8,2), %r10d
movw %r10w, (%r9,%r8,2)
addq $0x2, %r8
cmpq %rsi, %r8
jb 0x44fc
addl %r8d, %eax
leaq (%rcx,%rdx,2), %rcx
cmpl $0x1, %ebp
jne 0x4545
movl 0x18(%rbx), %edx
movl %edx, 0x18(%r14)
movl 0x1c(%rbx), %edx
movl %edx, 0x1c(%r14)
movl 0xc(%rbx), %edx
addl %edx, 0xc(%r14)
movq %rcx, (%r14)
movl %eax, 0x8(%r14)
jmp 0x4560
movl 0x10(%r14), %edx
movl %edx, 0x10(%rbx)
movl 0x14(%r14), %edx
movl %edx, 0x14(%rbx)
movl 0xc(%r14), %edx
addl %edx, 0xc(%rbx)
movq %rcx, (%rbx)
movl %eax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x1270