// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/diagbandseed.c
// Function: gt_diagbandseed_get_mlistlen_maxfreq
static int gt_diagbandseed_get_mlistlen_maxfreq(GtUword *mlistlen,
                                            GtUword *maxfreq,
                                            GtDiagbandseedKmerIterator *aiter,
                                            GtDiagbandseedKmerIterator *biter,
                                            GtUword memlimit,
                                            size_t sizeofunit,
                                            const GtRange *seedpairdistance,
                                            GtUword len_used,
                                            bool selfcomp,
                                            bool alist_blist_id,
                                            bool verbose,
                                            FILE *stream,
                                            GtError *err)
{
  const GtUword maxgram = GT_MIN(*maxfreq, 8190) + 1; /* Cap on k-mer count */
  GtUword *histogram = NULL;
  GtTimer *timer = NULL;
  int had_err = 0;

  gt_assert(memlimit < GT_UWORD_MAX);
  if (verbose) {
    fprintf(stream, "# start calculating k-mer frequency histogram...\n");
    timer = gt_timer_new();
    gt_timer_start(timer);
  }

  /* build histogram; histogram[maxgram] := estimation for mlistlen */
  histogram = gt_calloc(maxgram + 1, sizeof *histogram);
  gt_diagbandseed_merge(NULL, /* mlist not needed: just count */
                        histogram,
                        false,
                        aiter,
                        biter,
                        *maxfreq,
                        maxgram,
                        seedpairdistance,
                        selfcomp);
  *maxfreq = gt_diagbandseed_processhistogram(histogram,
                                              *maxfreq,
                                              maxgram,
                                              memlimit,
                                              len_used *
                                                sizeof (GtDiagbandseedKmerPos),
                                              alist_blist_id,
                                              sizeofunit);
  *mlistlen = histogram[maxgram];
  gt_free(histogram);

  if (verbose) {
    gt_timer_show_formatted(timer,"# ... finished histogram "
                            GT_DIAGBANDSEED_FMT,stream);
    gt_timer_delete(timer);
  }

  /* check maxfreq value */
  if (*maxfreq == 0 || (*maxfreq == 1 && alist_blist_id)) {
    gt_error_set(err,
                 "option -memlimit too strict: need at least " GT_WU "MB",
                 (*mlistlen >> 20) + 1);
    *mlistlen = 0;
    had_err = -1;
  } else if (verbose) {
    if (*maxfreq == GT_UWORD_MAX) {
      fprintf(stream, "# disable k-mer maximum frequency, ");
    } else {
      fprintf(stream, "# set k-mer maximum frequency to " GT_WU ", ", *maxfreq);
    }
    fprintf(stream, "expect " GT_WU " seeds.\n", *mlistlen);
  } else if (*maxfreq <= 5) {
    gt_warning("only k-mers occurring <= " GT_WU " times will be considered, "
               "due to small memlimit.", *maxfreq);
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x8(%rsp)
movq %rcx, %rbp
movq %rdx, %r14
movq %rdi, 0x18(%rsp)
movq 0x88(%rsp), %rcx
movb 0x70(%rsp), %bl
movq %rsi, %r12
movq (%rsi), %rdx
leaq 0x1(%rdx), %rax
cmpq $0x1ffe, %rdx           # imm = 0x1FFE
movl $0x1fff, %r15d          # imm = 0x1FFF
cmovbq %rax, %r15
cmpb $0x0, 0x80(%rsp)
movq %rdx, 0x10(%rsp)
movq %r8, 0x20(%rsp)
je 0x13e5b9
leaq 0x20232c(%rip), %rdi    # 0x3408c7
pushq $0x31
popq %rsi
pushq $0x1
popq %rdx
callq 0x17f00
callq 0xaf478
movq %rax, (%rsp)
movq %rax, %rdi
callq 0xaf4d6
jmp 0x13e5c1
movq $0x0, (%rsp)
leaq 0x1(%r15), %rdi
leaq 0x2018f0(%rip), %rdx    # 0x33febc
pushq $0x8
popq %rsi
movl $0x876, %ecx            # imm = 0x876
callq 0x9334a
movq %rax, %r13
movq (%r12), %r9
subq $0x8, %rsp
movzbl %bl, %eax
xorl %edi, %edi
movq %r13, %rsi
xorl %edx, %edx
movq %r14, %rcx
movq %rbp, %r8
pushq %rax
pushq 0x70(%rsp)
pushq %r15
callq 0x140c11
addq $0x20, %rsp
movsd 0x20(%rsp), %xmm0
unpcklps 0x1a92cf(%rip), %xmm0   # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1a92d7(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x2017e3(%rip), %xmm1   # 0x33fe10
movq 0x68(%rsp), %r11
shlq $0x4, %r11
cvttsd2si %xmm1, %rax
movq %rax, %rdx
subsd 0x1a96da(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rcx
sarq $0x3f, %rdx
andq %rdx, %rcx
orq %rax, %rcx
subq %r11, %rcx
jbe 0x13e698
movb 0x78(%rsp), %r9b
movq (%r12), %rsi
xorl %edi, %edi
movq %rcx, %rax
xorl %edx, %edx
movq 0x8(%rsp), %r10
divq %r10
cmpq %r10, %rcx
jb 0x13e719
pushq $-0x1
popq %rcx
xorl %edi, %edi
leaq 0x2(%rcx), %rdx
cmpq %r15, %rdx
ja 0x13e6ac
cmpq %rax, %rdi
jae 0x13e6ac
addq 0x8(%r13,%rcx,8), %rdi
incq %rcx
jmp 0x13e680
cmpb $0x0, 0x78(%rsp)
movq 0x8(%rsp), %r10
je 0x13e783
xorl %esi, %esi
jmp 0x13e725
movl $0x1ffe, %r8d           # imm = 0x1FFE
movq 0x10(%rsp), %rbx
cmpq %r8, %rbx
cmovbq %rbx, %r8
cmpq %rax, %rdi
jbe 0x13e705
cmpq $0x1, %rdx
jbe 0x13e8f3
subq (%r13,%rcx,8), %rdi
jae 0x13e712
movq 0x2f988d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a692e(%rip), %rsi    # 0x2e5013
leaq 0x2027df(%rip), %rdx    # 0x340ecb
leaq 0x2027b7(%rip), %rcx    # 0x340eaa
leaq 0x2017c2(%rip), %r8     # 0x33febc
movl $0x4cf, %r9d            # imm = 0x4CF
jmp 0x13e91f
cmpq %rcx, %r8
pushq $-0x1
popq %rax
cmoveq %rax, %rdx
movq %rdx, %rcx
cmpq %rcx, %rsi
cmovaeq %rcx, %rsi
cmpq $0x2, %rsi
setb %al
testb %r9b, %al
je 0x13e77e
movq 0x8(%r13), %rax
addq (%r13), %rax
imulq %r10, %rax
addq %r11, %rax
movq %rax, %xmm0
punpckldq 0x1a919f(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1a91a7(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x2016b3(%rip), %xmm1   # 0x33fe10
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x1a95af(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rdi
andq %rcx, %rdi
orq %rax, %rdi
jmp 0x13e7d5
testq %rsi, %rsi
jne 0x13e7d5
imulq (%r13), %r10
addq %r11, %r10
movq %r10, %xmm0
punpckldq 0x1a9148(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1a9150(%rip), %xmm0   # 0x2e78f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x20165c(%rip), %xmm1   # 0x33fe10
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0x1a955c(%rip), %xmm1   # 0x2e7d20
cvttsd2si %xmm1, %rdi
sarq $0x3f, %rcx
andq %rcx, %rdi
orq %rax, %rdi
xorl %esi, %esi
movq %rdi, (%r13,%r15,8)
movq %r12, %rbx
movq %rsi, (%r12)
movq (%r13,%r15,8), %rax
movq 0x18(%rsp), %r12
movq %rax, (%r12)
leaq 0x2016c6(%rip), %rsi    # 0x33febc
movq %r13, %rdi
movl $0x889, %edx            # imm = 0x889
callq 0x936f9
movb 0x80(%rsp), %bpl
testb %bpl, %bpl
movq 0x88(%rsp), %r14
je 0x13e836
leaq 0x2020da(%rip), %rsi    # 0x3408f9
movq (%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0xaf5b6
movq %r15, %rdi
callq 0xafc5b
movq (%rbx), %rdx
testq %rdx, %rdx
je 0x13e84b
cmpq $0x1, %rdx
jne 0x13e876
cmpb $0x0, 0x78(%rsp)
je 0x13e898
movq 0x90(%rsp), %rdi
movq (%r12), %rdx
shrq $0x14, %rdx
incq %rdx
leaq 0x2020c4(%rip), %rsi    # 0x340929
xorl %eax, %eax
callq 0x89dbb
andq $0x0, (%r12)
pushq $-0x1
popq %rbx
jmp 0x13e8e2
testb %bpl, %bpl
je 0x13e8c7
cmpq $-0x1, %rdx
jne 0x13e89d
leaq 0x2020d2(%rip), %rdi    # 0x34095a
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x17f00
jmp 0x13e8ae
testb %bpl, %bpl
je 0x13e8cf
leaq 0x2020da(%rip), %rsi    # 0x34097e
movq %r14, %rdi
xorl %eax, %eax
callq 0x17a50
movq (%r12), %rdx
leaq 0x2020ec(%rip), %rsi    # 0x3409a5
xorl %ebx, %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x17a50
jmp 0x13e8e2
xorl %ebx, %ebx
cmpq $0x5, %rdx
ja 0x13e8e2
leaq 0x2020e2(%rip), %rdi    # 0x3409b8
xorl %ebx, %ebx
movq %rdx, %rsi
xorl %eax, %eax
callq 0xb2cd0
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2f966e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1a670f(%rip), %rsi    # 0x2e5013
leaq 0x202590(%rip), %rdx    # 0x340e9b
leaq 0x202598(%rip), %rcx    # 0x340eaa
leaq 0x2015a3(%rip), %r8     # 0x33febc
movl $0x4cd, %r9d            # imm = 0x4CD
xorl %eax, %eax
callq 0x17a50
callq 0x17390