// File: /workspace/github_c_makefile_star2_O3/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 0x4493
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %ecx
movl 0x8(%rsi), %r15d
addl %ecx, %r15d
movl 0x1cfe4(%rip), %edx     # 0x213d4
leal (%rdx,%r15), %esi
movq 0x1cfcd(%rip), %rax     # 0x213c8
cmpl 0x1cfcf(%rip), %esi     # 0x213d0
jl 0x4456
cvtsi2sd %esi, %xmm0
mulsd 0x16bf9(%rip), %xmm0    # 0x1b008
addsd 0x16c19(%rip), %xmm0    # 0x1b030
cvttsd2si %xmm0, %ecx
movl %ecx, 0x1cfaf(%rip)     # 0x213d0
movslq %ecx, %rsi
addq %rsi, %rsi
leaq 0x16ec3(%rip), %rdx     # 0x1b2f1
movq %rax, %rdi
callq 0x13171
movq %rax, 0x1cf8b(%rip)     # 0x213c8
testq %rax, %rax
je 0x4525
movl 0x1cf88(%rip), %edx     # 0x213d4
movl 0x8(%r14), %ecx
addl %edx, %r15d
movl %r15d, %esi
movslq %edx, %rdx
movl %esi, 0x1cf75(%rip)     # 0x213d4
testl %ecx, %ecx
jle 0x449f
movq (%r14), %rsi
movl %ecx, %edi
leaq (%rax,%rdx,2), %r8
addq $0x2, %r8
xorl %ecx, %ecx
movzwl (%rsi,%rcx,2), %r9d
movw %r9w, -0x2(%r8,%rcx,2)
movzwl 0x2(%rsi,%rcx,2), %r9d
movw %r9w, (%r8,%rcx,2)
addq $0x2, %rcx
cmpq %rdi, %rcx
jb 0x4472
jmp 0x44a1
movl $0x0, 0x1cf37(%rip)     # 0x213d4
jmp 0x451a
xorl %ecx, %ecx
movslq 0x8(%rbx), %rsi
testq %rsi, %rsi
jle 0x44e4
movq (%rbx), %rdi
movl %ecx, %ecx
leaq (%rcx,%rcx), %r8
leaq (%r8,%rdx,2), %r8
leaq (%rax,%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 0x44c2
addl %r8d, %ecx
leaq (%rax,%rdx,2), %rax
cmpl $0x1, %ebp
jne 0x4505
movq 0x18(%rbx), %rdx
movq %rdx, 0x18(%r14)
movl 0xc(%rbx), %edx
addl %edx, 0xc(%r14)
movq %rax, (%r14)
movl %ecx, 0x8(%r14)
jmp 0x451a
movq 0x10(%r14), %rdx
movq %rdx, 0x10(%rbx)
movl 0xc(%r14), %edx
addl %edx, 0xc(%rbx)
movq %rax, (%rbx)
movl %ecx, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x1270