// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-mappedstr.c
// Function: gt_kmercodeiterator_reset
void gt_kmercodeiterator_reset(GtKmercodeiterator *kmercodeiterator,
                               GtReadmode readmode,
                               GtUword startpos)
{
  GtUchar charcode;
  const GtEncseq *encseq = kmercodeiterator->encseq;
  GtUword kmersize = (GtUword) kmercodeiterator->spwp->kmersize;

  gt_assert(!GT_ISDIRREVERSE(readmode) || startpos == 0);
  kmercodeiterator->totallength = gt_encseq_total_length(encseq);
  kmercodeiterator->startpos = startpos;
  gt_assert(startpos < kmercodeiterator->totallength);
  kmercodeiterator->fb = NULL;
  if (kmercodeiterator->totallength - startpos < kmersize)
  {
    kmercodeiterator->inputexhausted = true;
    gt_encseq_reader_delete(kmercodeiterator->esr);
    kmercodeiterator->esr = NULL;
    gt_kmerstream_delete(kmercodeiterator->spwp);
    kmercodeiterator->spwp = NULL;
  } else
  {
    kmercodeiterator->inputexhausted = false;
    kmercodeiterator->readmode = readmode;
    gt_encseq_reader_reinit_with_readmode(kmercodeiterator->esr,
                                          encseq,
                                          readmode,
                                          startpos);
    gt_kmerstream_reset(kmercodeiterator->spwp);
    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;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
setne %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
je 0x1ee472
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq 0x20(%rdi), %r15
movq 0x38(%rdi), %rax
movl 0x44(%rax), %r12d
movq %r15, %rdi
callq 0xe7b9c
movq %rax, (%rbx)
movq %r14, 0x8(%rbx)
subq %r14, %rax
jbe 0x1ee477
movq $0x0, 0x50(%rbx)
cmpq %r12, %rax
jae 0x1ee3cf
movb $0x1, 0x19(%rbx)
movq 0x28(%rbx), %rdi
callq 0xe9204
xorl %r14d, %r14d
movq %r14, 0x28(%rbx)
movq 0x38(%rbx), %rdi
callq 0x1ee47c
movq %r14, 0x38(%rbx)
jmp 0x1ee463
xorl %r13d, %r13d
movb %r13b, 0x19(%rbx)
movl %ebp, 0x30(%rbx)
movq 0x28(%rbx), %rdi
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0xe8eed
movq 0x38(%rbx), %rax
movl %r13d, 0x50(%rax)
movq %r13, 0x58(%rax)
movq %r13, 0x48(%rax)
movl %r13d, 0x1c(%rax)
movq (%rax), %rcx
movl 0x18(%rax), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
addq $-0x10, %rcx
movq %rcx, 0x8(%rax)
movq %rcx, 0x10(%rax)
movb %r13b, 0x18(%rbx)
addq %r14, %r12
movq %r14, 0x10(%rbx)
cmpq %r14, %r12
jbe 0x1ee463
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 %r12, %rax
jb 0x1ee427
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x791cf
callq 0x79208