// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/chain2dim.c
// Function: gt_chain2dim_bruteforcechainingscores
static void gt_chain2dim_bruteforcechainingscores(
                               const GtChain2Dimmode *chainmode,
                               GtChain2Dimmatchtable *matchtable,
                               GtChain2Dimgapcostfunction chaingapcostfunction)
{
  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;
    if (chainmode->chainkind == GLOBALCHAININGWITHGAPCOST)
    {
      matchtable->matches[0].score -= (GT_CHAIN2DIM_INITIALGAP(0)
                                         + GT_CHAIN2DIM_TERMINALGAP(0));
    }
    for (rightmatch=1Ul; rightmatch<matchtable->nextfree; rightmatch++)
    {
      const GtChain2Dimscoretype weightright
        = matchtable->matches[rightmatch].weight;
      GtUword leftmatch;
      GtChain2DimMaxmatchvalue localmaxmatch;

      localmaxmatch.defined = false;
      localmaxmatch.maxscore = 0;
      localmaxmatch.maxmatchnum = 0;
      for (leftmatch=0; leftmatch<rightmatch; leftmatch++)
      {
        bool combinable;

        if (chainmode->maxgapwidth != 0 &&
            !gt_chain2dim_checkmaxgapwidth(matchtable,chainmode->maxgapwidth,
                                           leftmatch,rightmatch))
        {
          combinable = false;
        } else
        {
          if (chainmode->chainkind == GLOBALCHAININGWITHOVERLAPS)
          {
            combinable = gt_chain2dim_ovl_colinear(matchtable,leftmatch,
                                                   rightmatch);
          } else
          {
            if (gt_chain2dim_overlapping(matchtable,leftmatch,rightmatch))
            {
              combinable = false;
            } else
            {
              combinable = true;
            }
          }
        }
        if (combinable)
        {
          GtChain2Dimscoretype score = matchtable->matches[leftmatch].score;
          GtUword previous;

          if (chainmode->chainkind == GLOBALCHAINING)
          {
            /* process chainkinds without gap costs */
            score += weightright;
            previous = leftmatch;
          } else
          {
            score -= chaingapcostfunction(matchtable,leftmatch,rightmatch);
            if (chainmode->chainkind == GLOBALCHAININGWITHGAPCOST)
            {
              score += (weightright + GT_CHAIN2DIM_TERMINALGAP(leftmatch)
                                    - GT_CHAIN2DIM_TERMINALGAP(rightmatch));
              previous = leftmatch;
            } else
            {
              if (score > 0)
              {
                score += weightright;
                previous = leftmatch;
              } else
              {
                score = weightright;
                previous = GT_CHAIN2DIM_UNDEFPREVIOUS;
              }
            }
          }
          if (!localmaxmatch.defined || localmaxmatch.maxscore < score)
          {
            localmaxmatch.maxscore = score;
            localmaxmatch.maxmatchnum = previous;
            localmaxmatch.defined = true;
          }
        }
      }
      if (localmaxmatch.defined)
      {
        matchtable->matches[rightmatch].previousinchain
          = localmaxmatch.maxmatchnum;
        if (localmaxmatch.maxmatchnum == GT_CHAIN2DIM_UNDEFPREVIOUS)
        {
          matchtable->matches[rightmatch].firstinchain = rightmatch;
        } else
        {
          matchtable->matches[rightmatch].firstinchain
            = matchtable->matches[localmaxmatch.maxmatchnum].firstinchain;
        }
        matchtable->matches[rightmatch].score = localmaxmatch.maxscore;
      } else
      {
        matchtable->matches[rightmatch].previousinchain
          = GT_CHAIN2DIM_UNDEFPREVIOUS;
        matchtable->matches[rightmatch].firstinchain = rightmatch;
        matchtable->matches[rightmatch].score = weightright;
        if (chainmode->chainkind == GLOBALCHAININGWITHGAPCOST)
        {
          matchtable->matches[rightmatch].score
            -= (GT_CHAIN2DIM_INITIALGAP(rightmatch)
                  + GT_CHAIN2DIM_TERMINALGAP(rightmatch));
        }
      }
    }
  }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x58(%rsp), %rax
cmpq $0x1, 0x18(%rax)
jbe 0x208039
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq $0x0, 0x20(%rax)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x48(%rax)
movq 0x60(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x207cb5
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x38(%rax), %rdx
movq 0x58(%rsp), %rax
movq (%rax), %rax
addq 0x40(%rax), %rdx
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x48(%rax)
movq $0x1, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x58(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x208037
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq %rax, 0x40(%rsp)
movb $0x0, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x207ee4
movq 0x60(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x207d50
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x38(%rsp), %rdx
movq 0x48(%rsp), %rcx
callq 0x209690
testb $0x1, %al
jne 0x207d50
movb $0x0, 0x1f(%rsp)
jmp 0x207da0
movq 0x60(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x207d76
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x2097a0
andb $0x1, %al
movb %al, 0x1f(%rsp)
jmp 0x207d9e
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x2098a0
testb $0x1, %al
jne 0x207d90
jmp 0x207d97
movb $0x0, 0x1f(%rsp)
jmp 0x207d9c
movb $0x1, 0x1f(%rsp)
jmp 0x207d9e
jmp 0x207da0
testb $0x1, 0x1f(%rsp)
je 0x207ecf
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x38(%rsp), %rcx
addq %rcx, %rax
movq 0x48(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x207ded
movq 0x40(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x207ea1
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq *%rax
movq %rax, %rcx
movq 0x10(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x207e62
movq 0x40(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x50, 0x38(%rsp), %rdx
addq %rdx, %rcx
addq 0x40(%rcx), %rax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rcx
subq 0x40(%rcx), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x207e9f
cmpq $0x0, 0x10(%rsp)
jle 0x207e85
movq 0x40(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x207e9d
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x207e9f
jmp 0x207ea1
testb $0x1, 0x30(%rsp)
je 0x207eb4
movq 0x20(%rsp), %rax
cmpq 0x10(%rsp), %rax
jge 0x207ecd
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movb $0x1, 0x30(%rsp)
jmp 0x207ecf
jmp 0x207ed1
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x207d0c
testb $0x1, 0x30(%rsp)
je 0x207f7e
movq 0x28(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x28(%rax)
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x207f35
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
jmp 0x207f5f
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x28(%rsp), %rcx
addq %rcx, %rax
movq 0x20(%rax), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movq 0x20(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x48(%rax)
jmp 0x208022
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x28(%rax)
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x48(%rax)
movq 0x60(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x208020
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rcx
addq %rcx, %rax
movq 0x38(%rax), %rdx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rcx
addq %rcx, %rax
addq 0x40(%rax), %rdx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x48(%rsp), %rcx
addq %rcx, %rax
movq 0x48(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x48(%rax)
jmp 0x208022
jmp 0x208024
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x207cbe
jmp 0x208039
addq $0x68, %rsp
retq
nop