// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/chain2dim.c
// Function: gt_chain2dim_ndbfchainscores
static void gt_chain2dim_ndbfchainscores(GtChain2Dimmatchtable *matchtable)
{
  if (matchtable->nextfree > 1UL)
  {
    GtUword rightmatch;

    matchtable->matches[0].firstinchain = 0;
    matchtable->matches[0].previousinchain = GT_CHAIN2DIM_UNDEFPREVIOUS;
    matchtable->matches[0].score = matchtable->matches[0].weight;
    matchtable->previouscount
      = gt_malloc(sizeof (*matchtable->previouscount) * matchtable->nextfree);
    matchtable->previousbound
      = gt_malloc(sizeof (*matchtable->previousbound) * matchtable->nextfree);
    matchtable->previouscount[0] = 0;
    for (rightmatch=1Ul; rightmatch<matchtable->nextfree; rightmatch++)
    {
      const GtChain2Dimscoretype weightright
        = matchtable->matches[rightmatch].weight;
      GtUword leftmatch;
      GtChain2DimMaxmatchvalue localmaxmatch;
      GtUword previouswithbestscore;

      localmaxmatch.defined = false;
      localmaxmatch.maxscore = 0;
      localmaxmatch.maxmatchnum = 0;
      previouswithbestscore = 0;
      for (leftmatch=0; leftmatch<rightmatch; leftmatch++)
      {
        if (gt_chain2dim_colinear(matchtable,0,leftmatch,rightmatch) &&
            gt_chain2dim_colinear(matchtable,1,leftmatch,rightmatch))
        {
          GtChain2Dimscoretype score = matchtable->matches[leftmatch].score;
          GtUword previous;

          if (score > 0)
          {
            score += weightright;
            previous = leftmatch;
          } else
          {
            score = weightright;
            previous = GT_CHAIN2DIM_UNDEFPREVIOUS;
          }
          if (!localmaxmatch.defined)
          {
            localmaxmatch.maxscore = score;
            localmaxmatch.maxmatchnum = previous;
            localmaxmatch.defined = true;
            previouswithbestscore = 1UL;
          } else
          {
            if (localmaxmatch.maxscore < score)
            {
              localmaxmatch.maxscore = score;
              localmaxmatch.maxmatchnum = previous;
              previouswithbestscore = 1UL;
            } else
            {
              if (localmaxmatch.maxscore == score)
              {
                previouswithbestscore++;
              }
            }
          }
        }
      }
      if (localmaxmatch.defined)
      {
        gt_assert(previouswithbestscore > 0);
        matchtable->matches[rightmatch].previousinchain
          = localmaxmatch.maxmatchnum;
        matchtable->matches[rightmatch].score = localmaxmatch.maxscore;
        matchtable->previouscount[rightmatch] = previouswithbestscore;
      } else
      {
        matchtable->matches[rightmatch].previousinchain
          = GT_CHAIN2DIM_UNDEFPREVIOUS;
        matchtable->matches[rightmatch].score = weightright;
        matchtable->previouscount[rightmatch] = 0;
      }
    }
    matchtable->previousbound[0] = matchtable->previouscount[0];
    for (rightmatch=1UL; rightmatch<matchtable->nextfree; rightmatch++)
    {
      matchtable->previousbound[rightmatch]
        = matchtable->previousbound[rightmatch-1] +
          matchtable->previouscount[rightmatch];
    }
    matchtable->allprevious = matchtable->previousbound[matchtable->nextfree-1];
    matchtable->previoustab
      = gt_malloc(sizeof (*matchtable->previoustab) * matchtable->allprevious);
    for (rightmatch=1Ul; rightmatch<matchtable->nextfree; rightmatch++)
    {
      const GtChain2Dimscoretype weightright
        = matchtable->matches[rightmatch].weight;
      GtUword leftmatch;

      if (matchtable->previouscount[rightmatch] == 0)
      {
        continue;
      }
      for (leftmatch=0; leftmatch<rightmatch; leftmatch++)
      {
        if (gt_chain2dim_colinear(matchtable,0,leftmatch,rightmatch) &&
            gt_chain2dim_colinear(matchtable,1,leftmatch,rightmatch))
        {
          GtChain2Dimscoretype score = matchtable->matches[leftmatch].score;
          GtUword previous;

          if (score > 0)
          {
            score += weightright;
            previous = leftmatch;
          } else
          {
            score = weightright;
            previous = GT_CHAIN2DIM_UNDEFPREVIOUS;
          }
          if (score == matchtable->matches[rightmatch].score)
          {
            gt_assert(matchtable->previousbound[rightmatch] > 0);
            matchtable->previoustab[--matchtable->previousbound[rightmatch]]
              = previous;
          }
        }
      }
    }
  }
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq 0x70(%rsp), %rax
cmpq $0x1, 0x18(%rax)
jbe 0x208621
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq $0x0, 0x20(%rax)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rcx
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x48(%rax)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdi
shlq $0x3, %rdi
leaq 0x36945e(%rip), %rsi    # 0x571508
movl $0x29f, %edx            # imm = 0x29F
callq 0xe80f0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdi
shlq $0x3, %rdi
leaq 0x369434(%rip), %rsi    # 0x571508
movl $0x2a1, %edx            # imm = 0x2A1
callq 0xe80f0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq $0x0, (%rax)
movq $0x1, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x20838a
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x68(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq %rax, 0x60(%rsp)
movb $0x0, 0x50(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x20828b
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rdx
movq 0x68(%rsp), %rcx
xorl %esi, %esi
callq 0x209930
testb $0x1, %al
jne 0x208189
jmp 0x208276
movq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0x1, %esi
callq 0x209930
testb $0x1, %al
jne 0x2081ab
jmp 0x208276
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x58(%rsp), %rcx
addq %rcx, %rax
movq 0x48(%rax), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jle 0x2081e8
movq 0x60(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x208200
movq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x28(%rsp)
testb $0x1, 0x50(%rsp)
jne 0x20822b
movq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x48(%rsp)
movb $0x1, 0x50(%rsp)
movq $0x1, 0x38(%rsp)
jmp 0x208274
movq 0x40(%rsp), %rax
cmpq 0x30(%rsp), %rax
jge 0x208256
movq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x48(%rsp)
movq $0x1, 0x38(%rsp)
jmp 0x208272
movq 0x40(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x208270
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x208272
jmp 0x208274
jmp 0x208276
jmp 0x208278
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x20815a
testb $0x1, 0x50(%rsp)
je 0x208327
jmp 0x208298
cmpq $0x0, 0x38(%rsp)
ja 0x2082d8
movq 0x433cf9(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x30dd62(%rip), %rsi    # 0x516013
leaq 0x36956b(%rip), %rdx    # 0x571823
leaq 0x36957e(%rip), %rcx    # 0x57183d
leaq 0x369242(%rip), %r8     # 0x571508
movl $0x2d9, %r9d            # imm = 0x2D9
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2082da
movq 0x48(%rsp), %rcx
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x68(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x28(%rax)
movq 0x40(%rsp), %rcx
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x68(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x48(%rax)
movq 0x38(%rsp), %rdx
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x68(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x208375
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x68(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x28(%rax)
movq 0x60(%rsp), %rcx
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x68(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x48(%rax)
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x68(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x208377
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x208103
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq (%rax), %rcx
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq %rcx, (%rax)
movq $0x1, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x208405
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x68(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x68(%rsp), %rcx
addq (%rax,%rcx,8), %rdx
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x68(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x2083ab
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x70(%rsp), %rcx
movq 0x18(%rcx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x70(%rsp), %rax
movq 0x28(%rax), %rdi
shlq $0x3, %rdi
leaq 0x3690cc(%rip), %rsi    # 0x571508
movl $0x2ef, %edx            # imm = 0x2EF
callq 0xe80f0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x40(%rax)
movq $0x1, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x20861f
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x68(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x68(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x2084a3
jmp 0x20860c
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x20860a
movq 0x70(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq 0x68(%rsp), %rcx
xorl %esi, %esi
callq 0x209930
testb $0x1, %al
jne 0x2084db
jmp 0x2085f5
movq 0x70(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0x1, %esi
callq 0x209930
testb $0x1, %al
jne 0x2084fd
jmp 0x2085f5
movq 0x70(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x18(%rsp), %rcx
addq %rcx, %rax
movq 0x48(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jle 0x20853a
movq 0x20(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x208552
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq 0x70(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x50, 0x68(%rsp), %rdx
addq %rdx, %rcx
cmpq 0x48(%rcx), %rax
jne 0x2085f3
jmp 0x208574
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x68(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
ja 0x2085c1
movq 0x433a10(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x30da79(%rip), %rsi    # 0x516013
leaq 0x3692b9(%rip), %rdx    # 0x57185a
leaq 0x369295(%rip), %rcx    # 0x57183d
leaq 0x368f59(%rip), %r8     # 0x571508
movl $0x30d, %r9d            # imm = 0x30D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2085c3
movq 0x8(%rsp), %rdx
movq 0x70(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x70(%rsp), %rcx
movq 0x38(%rcx), %rsi
movq 0x68(%rsp), %rdi
movq (%rsi,%rdi,8), %rcx
movq %rcx, %r8
addq $-0x1, %r8
movq %r8, (%rsi,%rdi,8)
movq %rdx, -0x8(%rax,%rcx,8)
jmp 0x2085f5
jmp 0x2085f7
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x2084ac
jmp 0x20860c
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x20845b
jmp 0x208621
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)