// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x4989
movl $0x0, 0x27cd8(%rip)     # 0x2c65c
jmp 0x4bca
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
addl 0x8(%rcx), %eax
movl %eax, -0x1c(%rbp)
movl 0x27cbc(%rip), %eax     # 0x2c65c
addl -0x1c(%rbp), %eax
cmpl 0x27caf(%rip), %eax     # 0x2c658
jl 0x4a14
movl 0x27cab(%rip), %eax     # 0x2c65c
addl -0x1c(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x22648(%rip), %xmm1    # 0x27008
mulsd %xmm1, %xmm0
movsd 0x22664(%rip), %xmm1    # 0x27030
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x27c7e(%rip)     # 0x2c658
movq 0x27c6f(%rip), %rdi     # 0x2c650
movslq 0x27c70(%rip), %rsi     # 0x2c658
shlq %rsi
leaq 0x22907(%rip), %rdx     # 0x272f9
callq 0x1b840
movq %rax, 0x27c52(%rip)     # 0x2c650
cmpq $0x0, 0x27c4a(%rip)     # 0x2c650
jne 0x4a12
movl $0x1, %edi
callq 0x2280
jmp 0x4a14
movq 0x27c35(%rip), %rax     # 0x2c650
movslq 0x27c3a(%rip), %rcx     # 0x2c65c
shlq %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl 0x27c27(%rip), %eax     # 0x2c65c
movl %eax, 0x27c21(%rip)     # 0x2c65c
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x4ac0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x4abe
movq -0x30(%rbp), %rax
movslq -0x18(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x30(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x4a5e
jmp 0x4ac0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x4b3e
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x4b3c
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x38(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x4adc
jmp 0x4b3e
cmpl $0x1, -0x14(%rbp)
jne 0x4b88
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x8(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x4bca
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq