// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/chain2dim.c
// Function: gt_chain2dim_findmaximalscores
static unsigned int gt_chain2dim_findmaximalscores(
                                            const GtChain2Dimmode *chainmode,
                                            GtChain2Dim *chain,
                                            GtChain2Dimmatchtable *matchtable,
                                            GtChain2DimMatchstore *matchstore,
                                            GtChain2Dimprocessor chainprocessor,
                                            bool withequivclasses,
                                            void *cpinfo,
                                            GtLogger *logger)
{
  GtUword matchnum;
  GtChain2Dimscoretype minscore = 0;
  GtChain2DimMatchpoint *maxpoint;
  GtChain2DimBestofclass *chainequivalenceclasses;
  unsigned int retval;
  bool minscoredefined = false;

  if (withequivclasses && !chain2dim_chainkind_global(chainmode->chainkind))
  {
    chainequivalenceclasses = gt_malloc(sizeof (*chainequivalenceclasses) *
                                        matchtable->nextfree);
    gt_chain2dim_local_determineequivreps(chainequivalenceclasses, matchtable);
  } else
  {
    chainequivalenceclasses = NULL;
  }
  switch (chainmode->chainkind)
  {
    case GLOBALCHAINING:
      maxpoint = gt_rbtree_maximum_key(matchstore->dictroot);
      gt_assert(maxpoint != NULL);
      matchnum = FRAGIDENT(maxpoint);
      minscore = matchtable->matches[matchnum].score;
      minscoredefined = true;
      break;
    case GLOBALCHAININGWITHGAPCOST:
    case GLOBALCHAININGWITHOVERLAPS:
    case GLOBALCHAININGALLCHAINS:
    case LOCALCHAININGMAX:
      minscoredefined
        = gt_chain2dim_retrievemaximalscore(&minscore,chainmode,matchtable);
      break;
    case LOCALCHAININGTHRESHOLD:
      minscore = chainmode->minimumscore;
      minscoredefined = true;
      break;
    case LOCALCHAININGBEST:
      retrieve_local_chainbestscores(&minscoredefined,
                                     &minscore,
                                     matchtable,
                                     chainmode->howmanybest);
      break;
    case LOCALCHAININGPERCENTAWAY:
      minscoredefined
        = gt_chain2dim_retrievemaximalscore(&minscore,chainmode,matchtable);
      if (minscoredefined)
      {
        minscore = (GtChain2Dimscoretype)
                   ((double) minscore *
                    (1.0 - (double) chainmode->percentawayfrombest/100.0));
      }
      break;
    default:
      fprintf(stderr,"chainkind = %d not valid\n",
               (int) chainmode->chainkind);
      exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  if (minscoredefined)
  {
    gt_logger_log(logger,
                  "compute %soptimal %s chains with score >= "GT_WD"",
                  chainmode->chainkind == GLOBALCHAININGALLCHAINS ? "all " : "",
                  chain2dim_chainkind_global(chainmode->chainkind) ? "global"
                                                                   : "local",
                  minscore);
    gt_chain2dim_retrievechainthreshold(chainmode,
                                        matchtable,
                                        chain,
                                        minscore,
                                        chainequivalenceclasses,
                                        chainprocessor,
                                        cpinfo);
    retval = 0;
  } else
  {
    retval = 1U;
  }
  if (chainequivalenceclasses != NULL)
  {
    gt_free(chainequivalenceclasses);
  }
  return retval;
}

// Assembly:
subq $0x78, %rsp
movb %r9b, %al
movq 0x88(%rsp), %r9
movq 0x80(%rsp), %r9
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq %r8, 0x50(%rsp)
andb $0x1, %al
movb %al, 0x4f(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x23(%rsp)
testb $0x1, 0x4f(%rsp)
je 0x20876f
movq 0x70(%rsp), %rax
movl (%rax), %edi
callq 0x20a4e0
testb $0x1, %al
jne 0x20876f
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
shlq $0x4, %rdi
leaq 0x368db9(%rip), %rsi    # 0x571508
movl $0x526, %edx            # imm = 0x526
callq 0xe80f0
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x20a540
jmp 0x208778
movq $0x0, 0x28(%rsp)
movq 0x70(%rsp), %rax
movl (%rax), %eax
movq %rax, 0x18(%rsp)
subq $0x7, %rax
ja 0x2088fd
movq 0x18(%rsp), %rax
leaq 0x368d4e(%rip), %rcx    # 0x5714e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x58(%rsp), %rax
movq (%rax), %rdi
callq 0x1b9990
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x2087f5
movq 0x4337dc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x30d845(%rip), %rsi    # 0x516013
leaq 0x369146(%rip), %rdx    # 0x57191b
leaq 0x369150(%rip), %rcx    # 0x57192c
leaq 0x368d25(%rip), %r8     # 0x571508
movl $0x530, %r9d            # imm = 0x530
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2087f7
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %rax
imulq $0x50, 0x40(%rsp), %rcx
addq %rcx, %rax
movq 0x48(%rax), %rax
movq %rax, 0x38(%rsp)
movb $0x1, 0x23(%rsp)
jmp 0x208926
movq 0x70(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x38(%rsp), %rdi
callq 0x20a650
andb $0x1, %al
movb %al, 0x23(%rsp)
jmp 0x208926
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
movb $0x1, 0x23(%rsp)
jmp 0x208926
movq 0x60(%rsp), %rdx
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rcx
leaq 0x23(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x20a750
jmp 0x208926
movq 0x70(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x38(%rsp), %rdi
callq 0x20a650
andb $0x1, %al
movb %al, 0x23(%rsp)
testb $0x1, 0x23(%rsp)
je 0x2088fb
cvtsi2sdq 0x38(%rsp), %xmm0
movq 0x70(%rsp), %rax
movq 0x20(%rax), %xmm2
movaps 0x310076(%rip), %xmm1   # 0x518930
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movapd 0x31007a(%rip), %xmm1   # 0x518940
subpd %xmm1, %xmm2
movaps %xmm2, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm1, %xmm2
movsd 0x311f5b(%rip), %xmm1   # 0x51a838
divsd %xmm1, %xmm2
movsd 0x30e957(%rip), %xmm1   # 0x517240
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x38(%rsp)
jmp 0x208926
movq 0x43369c(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x70(%rsp), %rax
movl (%rax), %edx
leaq 0x369036(%rip), %rsi    # 0x57194b
movb $0x0, %al
callq 0x199f0
movl $0x2, %edi
callq 0x19890
testb $0x1, 0x23(%rsp)
je 0x2089da
movq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rax
movl (%rax), %edx
leaq 0x394cdc(%rip), %rax    # 0x59d628
leaq 0x323d73(%rip), %rcx    # 0x52c6c6
cmpl $0x3, %edx
cmoveq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movl (%rax), %edi
callq 0x20a4e0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
movb %al, %sil
leaq 0x35e6f4(%rip), %rcx    # 0x567073
leaq 0x30e9ae(%rip), %rax    # 0x517334
testb $0x1, %sil
cmovneq %rax, %rcx
movq 0x38(%rsp), %r8
leaq 0x368fcb(%rip), %rsi    # 0x571965
movb $0x0, %al
callq 0xe7cd0
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x50(%rsp), %r9
movq 0x80(%rsp), %rax
movq %rax, (%rsp)
callq 0x20a8e0
movl $0x0, 0x24(%rsp)
jmp 0x2089e2
movl $0x1, 0x24(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x208a00
movq 0x28(%rsp), %rdi
leaq 0x368b12(%rip), %rsi    # 0x571508
movl $0x56b, %edx            # imm = 0x56B
callq 0xe88c0
movl 0x24(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax)