// File: /workspace/github_c_makefile_star2_O3/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 0x1ee72d
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r15
leaq 0x1c9b57(%rip), %rsi    # 0x3b8193
movl $0x58, %edi
movl $0x1ee, %edx            # imm = 0x1EE
callq 0x104226
movq %rax, %rbx
movq %r15, %rdi
callq 0xe7b9c
movq %rax, (%rbx)
movl %ebp, %r13d
cmpq %r13, %rax
jb 0x1ee732
movq %r14, 0x8(%rbx)
subq %r14, %rax
jbe 0x1ee737
movq $0x0, 0x50(%rbx)
movq %r15, 0x20(%rbx)
cmpq %r13, %rax
jae 0x1ee696
movb $0x1, 0x19(%rbx)
xorl %eax, %eax
movq %rax, 0x28(%rbx)
movq %rax, 0x38(%rbx)
jmp 0x1ee71b
xorl %eax, %eax
movb %al, 0x19(%rbx)
movl %r12d, 0x30(%rbx)
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0xe91b2
movq %rax, 0x28(%rbx)
movq %r15, %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0xd11be
movl %eax, %edi
movl %ebp, %esi
callq 0x1ee73c
movq %rax, 0x38(%rbx)
xorl %eax, %eax
movb %al, 0x18(%rbx)
addq %r14, %r13
movq %r14, 0x10(%rbx)
cmpq %r14, %r13
jbe 0x1ee71b
movq 0x28(%rbx), %rdi
callq 0xe8186
movq 0x38(%rbx), %rdi
incl 0x48(%rdi)
movzbl %al, %ebp
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1ee4d1
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 0x1ee6df
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7927a
callq 0x792ec
callq 0x792b3