// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/diagbandseed.c
// Function: gt_diagbandseed_merge
static void gt_diagbandseed_merge(GtSeedpairlist *seedpairlist,
                                  GtUword *histogram,
                                  bool knowthesize,
                                  GtDiagbandseedKmerIterator *aiter,
                                  GtDiagbandseedKmerIterator *biter,
                                  GtUword maxfreq,
                                  GtUword maxgram,
                                  const GtRange *seedpairdistance,
                                  bool selfcomp)
{
  const GtKmerPosList *alist, *blist;
  const bool count_cartesian = (histogram != NULL && !selfcomp) ? true : false;

  gt_assert(aiter != NULL && biter != NULL &&
            ((histogram == NULL && seedpairlist != NULL) ||
            (histogram != NULL && seedpairlist == NULL)));
  alist = gt_diagbandseed_kmer_iter_next(aiter);
  blist = gt_diagbandseed_kmer_iter_next(biter);
  while (alist != NULL && blist != NULL)
  {
    const GtDiagbandseedKmerPos *asegment = alist->spaceGtDiagbandseedKmerPos,
                                *bsegment = blist->spaceGtDiagbandseedKmerPos;
    GtUword alen = alist->nextfree,
            blen = blist->nextfree;
    if (asegment->code < bsegment->code)
    {
      alist = gt_diagbandseed_kmer_iter_next(aiter);
    } else
    {
      if (asegment->code > bsegment->code)
      {
        blist = gt_diagbandseed_kmer_iter_next(biter);
      } else
      {
        GtUword frequency = GT_MAX(alen, blen);

        if (frequency <= maxfreq)
        {
          /* add all equal k-mers */
          frequency = GT_MIN(maxgram, frequency);
          gt_assert(frequency > 0);
          if (count_cartesian)
          {
            histogram[frequency - 1] += alen * blen;
          } else
          {
            const GtDiagbandseedKmerPos *aptr, *bptr;
            for (aptr = asegment; aptr < asegment + alen; aptr++)
            {
              for (bptr = bsegment; bptr < bsegment + blen; bptr++)
              {
                if (!selfcomp || aptr->seqnum < bptr->seqnum ||
                    (aptr->seqnum == bptr->seqnum &&
                     aptr->endpos + seedpairdistance->start <= bptr->endpos &&
                     aptr->endpos + seedpairdistance->end >= bptr->endpos))
                {
                  /* no duplicates from the same dataset */
                  if (histogram == NULL)
                  {
                    /* save SeedPair in seedpairlist */
                    gt_seedpairlist_add(seedpairlist,
                                        knowthesize,
                                        aptr->seqnum,
                                        bptr->seqnum,
                                        bptr->endpos,
                                        aptr->endpos);
                  } else
                  {
                    /* count seed frequency in histogram */
                    histogram[frequency - 1]++;
                  }
                }
              }
            }
          }
        } /* else: ignore all equal elements */
        alist = gt_diagbandseed_kmer_iter_next(aiter);
        blist = gt_diagbandseed_kmer_iter_next(biter);
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x40(%rsp)
movq %r8, 0x8(%rsp)
movl %edx, 0x4(%rsp)
testq %rsi, %rsi
sete %dl
testq %rcx, %rcx
je 0x14143b
cmpq $0x0, 0x8(%rsp)
je 0x14143b
movq %rcx, %r15
movq %rdi, %r13
testq %rsi, %rsi
sete %al
testq %rdi, %rdi
sete %cl
xorb %al, %cl
je 0x14143b
movq %rsi, 0x10(%rsp)
orb 0xa0(%rsp), %dl
movb %dl, 0x3(%rsp)
movq %r15, %rdi
callq 0x14149d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x14149d
movq %rax, %r14
testq %rbx, %rbx
je 0x141224
testq %r14, %r14
je 0x141224
movq (%rbx), %r9
movq (%r14), %rcx
movq (%rcx), %rax
cmpq %rax, (%r9)
jae 0x140cb7
movq %r15, %rdi
callq 0x14149d
movq %rax, %rbx
jmp 0x140c8a
ja 0x140c7d
movq %rcx, 0x30(%rsp)
movq 0x18(%rbx), %rax
movq 0x18(%r14), %rdi
cmpq %rdi, %rax
movq %rdi, %r10
cmovaq %rax, %r10
cmpq 0x40(%rsp), %r10
movq 0x10(%rsp), %r11
movb 0xa0(%rsp), %r8b
ja 0x140c72
movq %rax, %rcx
movq 0x90(%rsp), %rax
cmpq %rax, %r10
cmovaeq %rax, %r10
testq %r10, %r10
je 0x14146c
cmpb $0x0, 0x3(%rsp)
je 0x141216
shlq $0x4, %rcx
addq %r9, %rcx
movq %rcx, 0x50(%rsp)
shlq $0x4, %rdi
addq 0x30(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movq %r10, 0x18(%rsp)
movq %r15, 0x48(%rsp)
cmpq 0x50(%rsp), %r9
jae 0x140c72
movq 0x30(%rsp), %r15
movq %r9, 0x28(%rsp)
cmpq %rdi, %r15
jae 0x141208
testb %r8b, %r8b
je 0x140d5f
movl 0x8(%r15), %eax
cmpl %eax, 0x8(%r9)
jae 0x140e30
testq %r11, %r11
je 0x140d6e
incq -0x8(%r11,%r10,8)
jmp 0x1411ff
testq %r13, %r13
je 0x14126b
movl 0x8(%r9), %r12d
movq 0x48(%r13), %rax
movq %r12, %rdx
subq %rax, %rdx
jb 0x141233
cmpq %r12, 0x58(%r13)
jb 0x141233
movl 0x8(%r15), %ebp
movq %rbp, %rsi
subq 0x50(%r13), %rsi
jb 0x141233
cmpq %rbp, 0x60(%r13)
jb 0x141233
movl 0xc(%r9), %ebx
cmpq %rbx, 0x68(%r13)
jbe 0x141233
movl 0xc(%r15), %r14d
cmpq %r14, 0x70(%r13)
jbe 0x141233
movq %r11, %r8
cmpb $0x1, 0xb0(%r13)
jne 0x140de3
subl %ebx, %r14d
addl 0xb8(%r13), %r14d
movl 0x18(%r13), %ecx
movl %r14d, %r11d
movq %r11, 0x38(%rsp)
cmpl $0x1, %ecx
je 0x140e6f
testl %ecx, %ecx
jne 0x140ed8
movq (%r13), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rax
cmpb $0x0, 0x4(%rsp)
je 0x140f07
cmpq %rdx, %rax
jae 0x1413d9
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rcx)
shlq $0x4, %rax
addq (%rcx), %rax
jmp 0x140fe7
jne 0x1411ff
movl 0xc(%r9), %eax
movq 0x98(%rsp), %rcx
movq (%rcx), %rdx
addq %rax, %rdx
movl 0xc(%r15), %ecx
cmpq %rcx, %rdx
ja 0x1411ff
movq 0x98(%rsp), %rdx
addq 0x8(%rdx), %rax
cmpq %rcx, %rax
jae 0x140d5f
jmp 0x1411ff
movb 0x98(%r13), %cl
shlq %cl, %rdx
movb 0x9c(%r13), %cl
shlq %cl, %rsi
movb 0xa0(%r13), %cl
movq 0x38(%rsp), %rax
shlq %cl, %rax
movb 0xa4(%r13), %cl
shlq %cl, %rbx
orq %rdx, %rsi
orq %rax, %rbx
orq %rsi, %rbx
movq 0x8(%r13), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rdx
cmpb $0x0, 0x4(%rsp)
je 0x140f14
cmpq %rax, %rdx
jae 0x141346
movq %r8, %r11
movq (%rcx), %rax
leaq 0x1(%rdx), %rsi
movq %rsi, 0x10(%rcx)
movq %rbx, (%rax,%rdx,8)
jmp 0x140ff7
movq 0x10(%r13), %rcx
movq 0x90(%r13), %rdi
movq 0x8(%rcx), %rsi
movq 0x10(%rcx), %rdx
leaq (%rdi,%rdx), %r8
cmpb $0x0, 0x4(%rsp)
je 0x140f30
cmpq %rsi, %r8
ja 0x141315
movq (%rcx), %r14
jmp 0x14114d
cmpq %rdx, %rax
jae 0x140f41
movq (%rcx), %rax
jmp 0x140fcb
cmpq %rax, %rdx
jae 0x141004
movq %r8, %r11
movq (%rcx), %rax
movb 0xa0(%rsp), %r8b
jmp 0x141096
cmpq %rsi, %r8
jae 0x1410b4
movq (%rcx), %r14
jmp 0x141132
movq %rdx, %xmm0
punpckldq 0x1a6992(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1a699a(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1feeae(%rip), %xmm1   # 0x33fe18
addsd 0x1fee96(%rip), %xmm1   # 0x33fe08
cvttsd2si %xmm1, %rax
movq %rax, %rdi
sarq $0x3f, %rdi
subsd 0x1a6d9a(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rsi
andq %rdi, %rsi
orq %rax, %rsi
addq %rdx, %rsi
movq %rsi, 0x8(%rcx)
movq (%rcx), %rdi
shlq $0x4, %rsi
leaq 0x1fef16(%rip), %rdx    # 0x33febc
movl $0x694, %ecx            # imm = 0x694
callq 0x93472
movq 0x18(%rsp), %r10
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %r9
movq 0x10(%rsp), %r8
movq (%r13), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x1413a8
movq 0x10(%rcx), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x10(%rcx)
shlq $0x4, %rdx
addq %rdx, %rax
movl %r12d, 0x4(%rax)
movl %ebp, (%rax)
movl %r14d, 0xc(%rax)
movl %ebx, 0x8(%rax)
movq %r8, %r11
movb 0xa0(%rsp), %r8b
jmp 0x1411ff
movq %rax, %xmm0
punpckldq 0x1a68cf(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1a68d7(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1fedeb(%rip), %xmm1   # 0x33fe18
addsd 0x1fedd3(%rip), %xmm1   # 0x33fe08
cvttsd2si %xmm1, %rdx
movq %rdx, %rdi
sarq $0x3f, %rdi
subsd 0x1a6cd7(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rsi
andq %rdi, %rsi
orq %rdx, %rsi
addq %rax, %rsi
movq %rsi, 0x8(%rcx)
movq (%rcx), %rdi
shlq $0x3, %rsi
leaq 0x1fee53(%rip), %rdx    # 0x33febc
movl $0x6ae, %ecx            # imm = 0x6AE
callq 0x93472
movq 0x18(%rsp), %r10
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %r9
movb 0xa0(%rsp), %r8b
movq 0x10(%rsp), %r11
movq 0x8(%r13), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x141377
movq 0x10(%rcx), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x10(%rcx)
movq %rbx, (%rax,%rdx,8)
jmp 0x1411ff
movq %rsi, %xmm0
punpckldq 0x1a681f(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1a6827(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1fed3b(%rip), %xmm1   # 0x33fe18
addsd 0x1fed23(%rip), %xmm1   # 0x33fe08
cvttsd2si %xmm1, %rdx
movq %rdx, %r8
subsd 0x1a6c2b(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rax
sarq $0x3f, %r8
andq %r8, %rax
orq %rdx, %rax
cmpq %rax, %rdi
ja 0x14140a
addq %rax, %rsi
movq %rsi, 0x8(%rcx)
movq (%rcx), %rdi
leaq 0x1fed9e(%rip), %rdx    # 0x33febc
movl $0x6c0, %ecx            # imm = 0x6C0
callq 0x93472
movq %rax, %r14
movq 0x10(%r13), %rcx
movq %rax, (%rcx)
testq %r14, %r14
je 0x1412f8
movq 0x10(%rcx), %rdx
movq 0x48(%r13), %rax
movq 0x90(%r13), %r8
addq %rdx, %r8
movq %r8, 0x10(%rcx)
cmpq %r12, %rax
ja 0x141299
movq 0x50(%r13), %rcx
cmpq %rbp, %rcx
ja 0x1412c7
subl %eax, %r12d
subl %ecx, %ebp
movb 0x86(%r13), %cl
shlq %cl, %r12
movb 0x88(%r13), %cl
shlq %cl, %rbp
addq %rdx, %r14
movb 0x82(%r13), %al
movb 0x8a(%r13), %cl
movq 0x38(%rsp), %rdx
shlq %cl, %rdx
movb 0x8c(%r13), %cl
shlq %cl, %rbx
orq %r12, %rbp
orq %rdx, %rbx
movq %rbx, %rdx
movl %eax, %ecx
shrq %cl, %rdx
orq %rbp, %rdx
movq %r14, %rdi
pushq $0x8
popq %rsi
callq 0x1417e0
movb 0x88(%r13), %cl
shlq %cl, %rbx
addq $0x8, %r14
movq 0x90(%r13), %rsi
addq $-0x8, %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1417e0
movq 0x10(%rsp), %r11
movb 0xa0(%rsp), %r8b
movq 0x28(%rsp), %r9
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r10
addq $0x10, %r15
jmp 0x140d43
addq $0x10, %r9
movq 0x48(%rsp), %r15
jmp 0x140d2e
imulq %rcx, %rdi
addq %rdi, -0x8(%r11,%r10,8)
jmp 0x140c72
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2f6d2e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3dcf(%rip), %rsi    # 0x2e5013
leaq 0x1ff8cf(%rip), %rdx    # 0x340b1a
leaq 0x1ff8b4(%rip), %rcx    # 0x340b06
leaq 0x1fec63(%rip), %r8     # 0x33febc
movl $0x67f, %r9d            # imm = 0x67F
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2f6cf6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3d97(%rip), %rsi    # 0x2e5013
leaq 0x1ff3c6(%rip), %rdx    # 0x340649
leaq 0x1ff87c(%rip), %rcx    # 0x340b06
leaq 0x1fec2b(%rip), %r8     # 0x33febc
movl $0x679, %r9d            # imm = 0x679
jmp 0x14125f
movq 0x2f6cc8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3d69(%rip), %rsi    # 0x2e5013
leaq 0x1ffb98(%rip), %rdx    # 0x340e49
leaq 0x1ff84e(%rip), %rcx    # 0x340b06
leaq 0x1febfd(%rip), %r8     # 0x33febc
movl $0x6c6, %r9d            # imm = 0x6C6
jmp 0x14125f
movq 0x2f6c9a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3d3b(%rip), %rsi    # 0x2e5013
leaq 0x1ffb93(%rip), %rdx    # 0x340e72
leaq 0x1ff820(%rip), %rcx    # 0x340b06
leaq 0x1febcf(%rip), %r8     # 0x33febc
movl $0x6c7, %r9d            # imm = 0x6C7
jmp 0x14125f
movq 0x2f6c69(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3d0a(%rip), %rsi    # 0x2e5013
leaq 0x1ffb02(%rip), %rdx    # 0x340e12
jmp 0x141422
movq 0x2f6c4c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3ced(%rip), %rsi    # 0x2e5013
leaq 0x1ffa36(%rip), %rdx    # 0x340d63
leaq 0x1ff7d2(%rip), %rcx    # 0x340b06
leaq 0x1feb81(%rip), %r8     # 0x33febc
movl $0x6b8, %r9d            # imm = 0x6B8
jmp 0x14125f
movq 0x2f6c1b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3cbc(%rip), %rsi    # 0x2e5013
leaq 0x1ff97a(%rip), %rdx    # 0x340cd8
leaq 0x1ff7a1(%rip), %rcx    # 0x340b06
leaq 0x1feb50(%rip), %r8     # 0x33febc
movl $0x6a6, %r9d            # imm = 0x6A6
jmp 0x14125f
movq 0x2f6bea(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3c8b(%rip), %rsi    # 0x2e5013
leaq 0x1ff9a2(%rip), %rdx    # 0x340d31
leaq 0x1ff770(%rip), %rcx    # 0x340b06
leaq 0x1feb1f(%rip), %r8     # 0x33febc
movl $0x6ae, %r9d            # imm = 0x6AE
jmp 0x14125f
movq 0x2f6bb9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3c5a(%rip), %rsi    # 0x2e5013
leaq 0x1ff8d6(%rip), %rdx    # 0x340c96
leaq 0x1ff73f(%rip), %rcx    # 0x340b06
leaq 0x1feaee(%rip), %r8     # 0x33febc
movl $0x694, %r9d            # imm = 0x694
jmp 0x14125f
movq 0x2f6b88(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3c29(%rip), %rsi    # 0x2e5013
leaq 0x1ff82c(%rip), %rdx    # 0x340c1d
leaq 0x1ff70e(%rip), %rcx    # 0x340b06
leaq 0x1feabd(%rip), %r8     # 0x33febc
movl $0x68a, %r9d            # imm = 0x68A
jmp 0x14125f
movq 0x2f6b57(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3bf8(%rip), %rsi    # 0x2e5013
leaq 0x1ff9c4(%rip), %rdx    # 0x340de6
leaq 0x1ff6dd(%rip), %rcx    # 0x340b06
leaq 0x1fea8c(%rip), %r8     # 0x33febc
movl $0x6c0, %r9d            # imm = 0x6C0
jmp 0x14125f
movq 0x2f6b26(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3bc7(%rip), %rsi    # 0x2e5013
leaq 0x1ff5b3(%rip), %rdx    # 0x340a06
leaq 0x1ff62b(%rip), %rcx    # 0x340a85
leaq 0x1fea5b(%rip), %r8     # 0x33febc
movl $0x7b8, %r9d            # imm = 0x7B8
jmp 0x14125f
movq 0x2f6af5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a3b96(%rip), %rsi    # 0x2e5013
leaq 0x1ff617(%rip), %rdx    # 0x340a9b
leaq 0x1ff5fa(%rip), %rcx    # 0x340a85
leaq 0x1fea2a(%rip), %r8     # 0x33febc
movl $0x7d1, %r9d            # imm = 0x7D1
jmp 0x14125f