// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/sfx-suffixer.c
// Function: gt_getencseqkmers_twobitencoding_slice
void gt_getencseqkmers_twobitencoding_slice(const GtEncseq *encseq,
                                         GtReadmode readmode,
                                         unsigned int kmersize,
                                         unsigned int upperkmersize,
                                         bool onlyfirst,
                                         void(*processkmercode)(void *,
                                                                bool,
                                                                GtUword,
                                                                GtCodetype),
                                         void *processkmercodeinfo,
                                         void(*processkmerspecial)(void *,
                                                                   unsigned int,
                                                                   unsigned int,
                                                                   GtUword),
                                         void *processkmerspecialinfo,
                                         GtUword slice_startpos,
                                         GtUword slice_endpos)
{
  GtUword laststart = slice_startpos,
          lastend = slice_endpos;
  gt_assert(laststart <= lastend);

  if (gt_encseq_has_specialranges(encseq))
  {
    GtSpecialrangeiterator *sri;
    GtRange range;

    if (GT_ISDIRREVERSE(readmode))
    {
      sri = gt_specialrangeiterator_new(encseq,false);
      while (gt_specialrangeiterator_next(sri,&range))
      {
        if (range.end <= lastend) {
          getencseqkmers_rangetwobitencoding(encseq,
                                             readmode,
                                             kmersize,
                                             upperkmersize,
                                             onlyfirst,
                                             processkmercode,
                                             processkmercodeinfo,
                                             processkmerspecial,
                                             processkmerspecialinfo,
                                             range.end,
                                             lastend);
          lastend = range.start;
        }
        if (laststart > range.start) {
          break;
        }
      }
    } else
    {
      sri = gt_specialrangeiterator_new(encseq,true);
      while (gt_specialrangeiterator_next(sri,&range))
      {
        if (range.start >= laststart) {
          getencseqkmers_rangetwobitencoding(encseq,
                                             readmode,
                                             kmersize,
                                             upperkmersize,
                                             onlyfirst,
                                             processkmercode,
                                             processkmercodeinfo,
                                             processkmerspecial,
                                             processkmerspecialinfo,
                                             laststart,
                                             range.start);
          laststart = range.end;
        }
        if (lastend < range.end) {
          break;
        }
      }
    }
    gt_assert(gt_encseq_total_length(encseq) >= laststart);
    gt_specialrangeiterator_delete(sri);
  }

  if (laststart <= slice_endpos && slice_startpos <= lastend) {
    GtUword startpos = GT_ISDIRREVERSE(readmode) ? slice_startpos : laststart;
    GtUword endpos = GT_ISDIRREVERSE(readmode) ? lastend : slice_endpos;

    getencseqkmers_rangetwobitencoding(encseq,
                                       readmode,
                                       kmersize,
                                       upperkmersize,
                                       onlyfirst,
                                       processkmercode,
                                       processkmercodeinfo,
                                       processkmerspecial,
                                       processkmerspecialinfo,
                                       startpos,
                                       endpos);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x18(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movq 0x90(%rsp), %rbx
movq 0x88(%rsp), %r15
cmpq %rbx, %r15
ja 0x20059e
movl %r8d, %ebp
movq %rdi, %r13
callq 0xef27f
movq %rbx, %r14
movq %r15, %r12
testb %al, %al
je 0x200538
movl 0xc(%rsp), %eax
andl $-0x3, %eax
cmpl $0x1, %eax
movl %ebp, 0x34(%rsp)
movq %r13, %rdi
jne 0x200495
xorl %esi, %esi
callq 0xef3d9
movq %rax, %r15
leaq 0x20(%rsp), %r12
movzbl %bpl, %ebp
movq %rbx, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0xef451
testb %al, %al
je 0x200488
movq 0x28(%rsp), %rax
cmpq %r14, %rax
ja 0x200479
subq $0x8, %rsp
movq %r13, %rdi
movl 0x14(%rsp), %esi
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
movl %ebp, %r8d
movq 0x20(%rsp), %r9
pushq %r14
pushq %rax
pushq 0x98(%rsp)
pushq 0x98(%rsp)
pushq 0x98(%rsp)
callq 0x2005a8
addq $0x30, %rsp
movq 0x20(%rsp), %r14
movq 0x88(%rsp), %rax
cmpq %rax, 0x20(%rsp)
jae 0x20041f
movq 0x88(%rsp), %r12
jmp 0x200517
movl $0x1, %esi
callq 0xef3d9
movq %rax, %r15
leaq 0x20(%rsp), %r14
movzbl %bpl, %ebp
movq 0x88(%rsp), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0xef451
testb %al, %al
je 0x200514
movq 0x20(%rsp), %rax
cmpq %r12, %rax
jb 0x20050d
subq $0x8, %rsp
movq %r13, %rdi
movl 0x14(%rsp), %esi
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
movl %ebp, %r8d
movq 0x20(%rsp), %r9
pushq %rax
pushq %r12
pushq 0x98(%rsp)
pushq 0x98(%rsp)
pushq 0x98(%rsp)
callq 0x2005a8
addq $0x30, %rsp
movq 0x28(%rsp), %r12
cmpq %rbx, 0x28(%rsp)
jbe 0x2004b3
movq %rbx, %r14
movq %r13, %rdi
callq 0xec1d8
cmpq %r12, %rax
movl 0x34(%rsp), %ebp
jb 0x2005a3
movq %r15, %rdi
callq 0xefa48
movq 0x88(%rsp), %r15
cmpq %rbx, %r12
ja 0x20058f
cmpq %r15, %r14
jb 0x20058f
movl 0xc(%rsp), %esi
movl %esi, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
cmoveq %r15, %r12
cmoveq %r14, %rbx
subq $0x8, %rsp
movzbl %bpl, %r8d
movq %r13, %rdi
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
movq 0x20(%rsp), %r9
pushq %rbx
pushq %r12
pushq 0x98(%rsp)
pushq 0x98(%rsp)
pushq 0x98(%rsp)
callq 0x2005a8
addq $0x30, %rsp
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7de72
callq 0x7de39