// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/chain2dim.c
// Function: gt_chain2dim_evalmatchscore
static void gt_chain2dim_evalmatchscore(const GtChain2Dimmode *chainmode,
                                        GtChain2Dimmatchtable *matchtable,
                                        GtChain2DimMatchstore *matchstore,
                                        bool gapsL1,
                                        GtUword matchpointident,
                                        unsigned int presortdim)
{
  GtUword previous;
  GtChain2Dimpostype startpos2;
  GtChain2DimMatchpoint *qmatch2;
  GtChain2Dimscoretype score;

  startpos2 = GT_CHAIN2DIM_GETSTOREDSTARTPOINT(1-presortdim,matchpointident);
  if (startpos2 == 0)
  {
    qmatch2 = NULL;
  } else
  {
    GtChain2DimMatchpoint keymatch2;

    keymatch2.fpposition = startpos2 - 1;  /* it is a start position */
    keymatch2.fpident = MAKEENDPOINT(matchpointident);
                       /* but considered as endpoint */
    qmatch2 = (GtChain2DimMatchpoint *) gt_rbtree_previous_equal_key(
                                                 matchstore->dictroot,
                                                 &keymatch2,
                                                 gt_chain2dim_cmpendMatchpoint2,
                                                 NULL);
    if (qmatch2 != NULL)
    {
      if (chainmode->maxgapwidth != 0 &&
          !gt_chain2dim_checkmaxgapwidth(matchtable,
                                         chainmode->maxgapwidth,
                                         FRAGIDENT(qmatch2),
                                         matchpointident))
      {
        qmatch2 = NULL;
      }
    }
  }
  if (qmatch2 == NULL)
  {
    score = matchtable->matches[matchpointident].weight;
    if (chainmode->chainkind == GLOBALCHAININGWITHGAPCOST)
    {
      score -= GT_CHAIN2DIM_INITIALGAP(matchpointident);
    }
    previous = GT_CHAIN2DIM_UNDEFPREVIOUS;
  } else
  {
    score = matchtable->matches[FRAGIDENT(qmatch2)].score;
    if (chainmode->chainkind == GLOBALCHAINING)
    {
      score += matchtable->matches[matchpointident].weight;
      previous = FRAGIDENT(qmatch2);
    } else
    {
      GtChain2Dimscoretype tmpgc;

      if (gapsL1)
      {
        tmpgc = gapcostL1(matchtable,FRAGIDENT(qmatch2),matchpointident);
      } else
      {
        tmpgc = gapcostCc(matchtable,FRAGIDENT(qmatch2),matchpointident);
      }
      if (chainmode->chainkind == GLOBALCHAININGWITHGAPCOST || score > tmpgc)
      {
        score += (matchtable->matches[matchpointident].weight - tmpgc);
        previous = FRAGIDENT(qmatch2);
      } else
      {
        score = matchtable->matches[matchpointident].weight;
        previous = GT_CHAIN2DIM_UNDEFPREVIOUS;
      }
    }
  }
  matchtable->matches[matchpointident].score = score;
  matchtable->matches[matchpointident].previousinchain = previous;
  if (previous == GT_CHAIN2DIM_UNDEFPREVIOUS)
  {
    matchtable->matches[matchpointident].firstinchain = matchpointident;
  } else
  {
    matchtable->matches[matchpointident].firstinchain
      = matchtable->matches[previous].firstinchain;
  }
}

// Assembly:
subq $0x68, %rsp
movb %cl, %al
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
andb $0x1, %al
movb %al, 0x4f(%rsp)
movq %r8, 0x40(%rsp)
movl %r9d, 0x3c(%rsp)
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movl $0x1, %ecx
subl 0x3c(%rsp), %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x209e7d
movq $0x0, 0x20(%rsp)
jmp 0x209efc
movq 0x28(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rdi
leaq 0x8(%rsp), %rsi
leaq -0x189(%rip), %rdx      # 0x209d20
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b9ca0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x209efa
movq 0x60(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x209ef8
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rsp), %rax
movq (%rax), %rdx
movq 0x40(%rsp), %rcx
callq 0x209690
testb $0x1, %al
jne 0x209ef8
movq $0x0, 0x20(%rsp)
jmp 0x209efa
jmp 0x209efc
cmpq $0x0, 0x20(%rsp)
jne 0x209f5d
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x209f4a
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq 0x38(%rax), %rcx
movq 0x18(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x20a067
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
imulq $0x50, (%rcx), %rcx
addq %rcx, %rax
movq 0x48(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x209fb5
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
addq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x20a065
testb $0x1, 0x4f(%rsp)
je 0x209fd9
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x40(%rsp), %rdx
callq 0x2094e0
movq %rax, (%rsp)
jmp 0x209ff4
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x40(%rsp), %rdx
callq 0x209550
movq %rax, (%rsp)
movq 0x60(%rsp), %rax
cmpl $0x1, (%rax)
je 0x20a009
movq 0x18(%rsp), %rax
cmpq (%rsp), %rax
jle 0x20a03b
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
subq (%rsp), %rax
addq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x20a063
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x20a065
jmp 0x20a067
movq 0x18(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x48(%rax)
movq 0x30(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x28(%rax)
movq 0x30(%rsp), %rax
movq 0x58(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x20a0c7
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
jmp 0x20a0f1
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x30(%rsp), %rcx
addq %rcx, %rax
movq 0x20(%rax), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)