// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/sfx-mappedstr.c
// Function: gt_kmercodeiterator_encseq_new
GtKmercodeiterator *gt_kmercodeiterator_encseq_new(
                                            const GtEncseq *encseq,
                                            GtReadmode readmode,
                                            unsigned int kmersize,
                                            GtUword startpos)
{
  GtKmercodeiterator *kmercodeiterator;
  unsigned int numofchars;
  GtUchar charcode;

  gt_assert(!GT_ISDIRREVERSE(readmode) || startpos == 0);
  kmercodeiterator = gt_malloc(sizeof (*kmercodeiterator));
  kmercodeiterator->totallength = gt_encseq_total_length(encseq);
  gt_assert(kmersize <= kmercodeiterator->totallength);
  kmercodeiterator->startpos = startpos;
  gt_assert(startpos < kmercodeiterator->totallength);
  kmercodeiterator->fb = NULL;
  kmercodeiterator->encseq = encseq;
  if (kmercodeiterator->totallength - startpos < (GtUword) kmersize)
  {
    kmercodeiterator->inputexhausted = true;
    kmercodeiterator->esr = NULL;
    kmercodeiterator->spwp = NULL;
  } else
  {
    kmercodeiterator->inputexhausted = false;
    kmercodeiterator->readmode = readmode;
    kmercodeiterator->esr = gt_encseq_create_reader_with_readmode(encseq,
                                                                  readmode,
                                                                  startpos);
    numofchars = gt_alphabet_num_of_chars(gt_encseq_alphabet(encseq));
    kmercodeiterator->spwp = gt_kmerstream_new(numofchars,kmersize);
    kmercodeiterator->hasprocessedfirst = false;
    for (kmercodeiterator->currentposition = startpos;
         kmercodeiterator->currentposition < startpos+(GtUword) kmersize;
         kmercodeiterator->currentposition++)
    {
      charcode = gt_encseq_reader_next_encoded_char(kmercodeiterator->esr);
      kmercodeiterator->spwp->windowwidth++;
      gt_kmerstream_updatespecialpositions(kmercodeiterator->spwp,charcode,
                                           false,0);
      kmercodeiterator->spwp->cyclicwindow[kmercodeiterator->
                                           spwp->windowwidth-1] = charcode;
    }
  }
  return kmercodeiterator;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %esi, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
setne %al
testq %rcx, %rcx
sete %cl
orb %al, %cl
je 0x1f7ee9
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r15
leaq 0x1c9a1b(%rip), %rsi    # 0x3c1813
movl $0x58, %edi
movl $0x1ee, %edx            # imm = 0x1EE
callq 0x1092b2
movq %rax, %rbx
movq %r15, %rdi
callq 0xec1d8
movq %rax, (%rbx)
movl %ebp, %r13d
cmpq %r13, %rax
jb 0x1f7eee
movq %r14, 0x8(%rbx)
subq %r14, %rax
jbe 0x1f7ef3
movq $0x0, 0x50(%rbx)
movq %r15, 0x20(%rbx)
cmpq %r13, %rax
jae 0x1f7e52
movb $0x1, 0x19(%rbx)
xorl %eax, %eax
movq %rax, 0x28(%rbx)
movq %rax, 0x38(%rbx)
jmp 0x1f7ed7
xorl %eax, %eax
movb %al, 0x19(%rbx)
movl %r12d, 0x30(%rbx)
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0xed76d
movq %rax, 0x28(%rbx)
movq %r15, %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3713
movl %eax, %edi
movl %ebp, %esi
callq 0x1f7ef8
movq %rax, 0x38(%rbx)
xorl %eax, %eax
movb %al, 0x18(%rbx)
addq %r14, %r13
movq %r14, 0x10(%rbx)
cmpq %r14, %r13
jbe 0x1f7ed7
movq 0x28(%rbx), %rdi
callq 0xec7be
movq 0x38(%rbx), %rdi
incl 0x48(%rdi)
movzbl %al, %ebp
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1f7c95
movq 0x38(%rbx), %rax
movl 0x48(%rax), %ecx
decl %ecx
movb %bpl, 0x20(%rax,%rcx)
movq 0x10(%rbx), %rax
incq %rax
movq %rax, 0x10(%rbx)
cmpq %r13, %rax
jb 0x1f7e9b
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7afa0
callq 0x7b012
callq 0x7afd9