// File: /workspace/github_c_makefile_star2_O0/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 %rbx
subq $0x90, %rsp
movq %rcx, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, %r10
movq 0x28(%rsp), %rsi
movq %rdi, %r11
movq 0x30(%rsp), %rdi
movq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rax
movb 0xc0(%rsp), %al
movb 0xb8(%rsp), %cl
movb 0xb0(%rsp), %dl
movq 0xa8(%rsp), %rbx
movq 0xa0(%rsp), %rbx
movq %r11, 0x88(%rsp)
movq %r10, 0x80(%rsp)
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %r8, 0x68(%rsp)
movq %r9, 0x60(%rsp)
andb $0x1, %dl
movb %dl, 0x5f(%rsp)
andb $0x1, %cl
movb %cl, 0x5e(%rsp)
andb $0x1, %al
movb %al, 0x5d(%rsp)
movq 0x80(%rsp), %rax
cmpq $0x1ffe, (%rax)         # imm = 0x1FFE
jae 0x216172
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x21617e
movl $0x1ffe, %eax           # imm = 0x1FFE
movq %rax, 0x20(%rsp)
jmp 0x21617e
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
cmpq $-0x1, 0x68(%rsp)
jb 0x2161e6
movq 0x425deb(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2ffe54(%rip), %rsi    # 0x516013
leaq 0x35c93e(%rip), %rdx    # 0x572b04
leaq 0x35c94f(%rip), %rcx    # 0x572b1c
leaq 0x35bdc0(%rip), %r8     # 0x571f94
movl $0x86e, %r9d            # imm = 0x86E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2161e8
testb $0x1, 0x5d(%rsp)
je 0x216219
movq 0xc8(%rsp), %rdi
leaq 0x35c943(%rip), %rsi    # 0x572b41
movb $0x0, %al
callq 0x199f0
callq 0x121340
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0x1213f0
movq 0x50(%rsp), %rdi
addq $0x1, %rdi
movl $0x8, %esi
leaq 0x35bd66(%rip), %rdx    # 0x571f94
movl $0x876, %ecx            # imm = 0x876
callq 0xe83c0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rsi
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %r8
movq 0x80(%rsp), %rax
movq (%rax), %r9
movq 0x50(%rsp), %r11
movq 0xa0(%rsp), %r10
movb 0x5f(%rsp), %al
xorl %edx, %edx
movl %edx, %edi
xorl %edx, %edx
andb $0x1, %al
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
callq 0x219080
movq 0x48(%rsp), %rdi
movq 0x80(%rsp), %rax
movq (%rax), %rsi
movq 0x50(%rsp), %rdx
movq 0x68(%rsp), %rcx
movq 0xa8(%rsp), %r8
shlq $0x4, %r8
movb 0x5e(%rsp), %r9b
movq 0x60(%rsp), %rax
andb $0x1, %r9b
movzbl %r9b, %r9d
movq %rax, (%rsp)
callq 0x2194d0
movq %rax, %rcx
movq 0x80(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x88(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rdi
leaq 0x35bc9b(%rip), %rsi    # 0x571f94
movl $0x889, %edx            # imm = 0x889
callq 0xe88c0
testb $0x1, 0x5d(%rsp)
je 0x21632d
movq 0x40(%rsp), %rdi
movq 0xc8(%rsp), %rdx
leaq 0x35c855(%rip), %rsi    # 0x572b73
callq 0x121520
movq 0x40(%rsp), %rdi
callq 0x121f00
movq 0x80(%rsp), %rax
cmpq $0x0, (%rax)
je 0x216350
movq 0x80(%rsp), %rax
cmpq $0x1, (%rax)
jne 0x216395
testb $0x1, 0x5e(%rsp)
je 0x216395
movq 0xd0(%rsp), %rdi
movq 0x88(%rsp), %rax
movq (%rax), %rdx
shrq $0x14, %rdx
addq $0x1, %rdx
leaq 0x35c831(%rip), %rsi    # 0x572ba3
movb $0x0, %al
callq 0xd88c0
movq 0x88(%rsp), %rax
movq $0x0, (%rax)
movl $0xffffffff, 0x3c(%rsp) # imm = 0xFFFFFFFF
jmp 0x216431
testb $0x1, 0x5d(%rsp)
je 0x216406
movq 0x80(%rsp), %rax
cmpq $-0x1, (%rax)
jne 0x2163c2
movq 0xc8(%rsp), %rdi
leaq 0x35c81b(%rip), %rsi    # 0x572bd4
movb $0x0, %al
callq 0x199f0
jmp 0x2163e3
movq 0xc8(%rsp), %rdi
movq 0x80(%rsp), %rax
movq (%rax), %rdx
leaq 0x35c81c(%rip), %rsi    # 0x572bf8
movb $0x0, %al
callq 0x199f0
movq 0xc8(%rsp), %rdi
movq 0x88(%rsp), %rax
movq (%rax), %rdx
leaq 0x35c822(%rip), %rsi    # 0x572c1f
movb $0x0, %al
callq 0x199f0
jmp 0x21642f
movq 0x80(%rsp), %rax
cmpq $0x5, (%rax)
ja 0x21642d
movq 0x80(%rsp), %rax
movq (%rax), %rsi
leaq 0x35c80c(%rip), %rdi    # 0x572c32
movb $0x0, %al
callq 0x1267d0
jmp 0x21642f
jmp 0x216431
movl 0x3c(%rsp), %eax
addq $0x90, %rsp
popq %rbx
retq
nop