// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DAMASKER/tandem.c
// Function: Fusion
static void Fusion(Path *path1, int ap, Path *path2, Trace_Buffer *tbuf)
{ int     k, k1, k2;
  int     len, diff;
  uint16 *trace;

  k1 = 2 * ((ap/MR_tspace) - (path1->abpos/MR_tspace));
  k2 = 2 * ((ap/MR_tspace) - (path2->abpos/MR_tspace));

  len = k1+(path2->tlen-k2);

  if (tbuf->top + len >= tbuf->max)
    { tbuf->max = 1.2*(tbuf->top+len) + 1000;
      tbuf->trace = (uint16 *) Realloc(tbuf->trace,sizeof(uint16)*tbuf->max,"Allocating paths");
      if (tbuf->trace == NULL)
        Clean_Exit(1);
    }

  trace = tbuf->trace + tbuf->top;
  tbuf->top += len;

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

  path1->aepos = path2->aepos;
  path1->bepos = path2->bepos;
  path1->diffs = diff;
  path1->trace = (void *) (trace - tbuf->trace);
  path1->tlen  = len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl -0xc(%rbp), %eax
cltd
idivl 0x275ef(%rip)           # 0x2e450
movl %eax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
cltd
idivl 0x275de(%rip)           # 0x2e450
movl %eax, %ecx
movl -0x58(%rbp), %eax
subl %ecx, %eax
shll %eax
movl %eax, -0x28(%rbp)
movl -0xc(%rbp), %eax
cltd
idivl 0x275c8(%rip)           # 0x2e450
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
cltd
idivl 0x275b7(%rip)           # 0x2e450
movl %eax, %ecx
movl -0x54(%rbp), %eax
subl %ecx, %eax
shll %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl -0x2c(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
addq %rcx, %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jb 0x6f8e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, %xmm0
movaps 0x22792(%rip), %xmm1    # 0x29680
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x22796(%rip), %xmm1    # 0x29690
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x220f7(%rip), %xmm1    # 0x29008
mulsd %xmm1, %xmm0
movsd 0x2275b(%rip), %xmm1    # 0x29678
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
movsd 0x22738(%rip), %xmm1    # 0x29670
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
shlq %rsi
leaq 0x2288a(%rip), %rdx     # 0x297f1
callq 0x1d800
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x6f8c
movl $0x1, %edi
callq 0x2420
jmp 0x6f8e
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movslq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x7060
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x705e
movq -0x48(%rbp), %rax
movslq -0x24(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x48(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x6ff0
jmp 0x7060
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x7103
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x7101
movq -0x50(%rbp), %rax
movslq -0x24(%rbp), %rcx
movw (%rax,%rcx,2), %dx
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x50(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x50(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x708f
jmp 0x7103
movq -0x18(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl -0x34(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
subq %rax, %rcx
sarq %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl -0x30(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)