// File: /workspace/github_c_makefile_star2_O2/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 0x19eff8
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 0x7055e
movq %rax, (%rbx)
movq %r14, 0x8(%rbx)
subq %r14, %rax
jbe 0x19f026
andq $0x0, 0x50(%rbx)
cmpq %r12, %rax
jae 0x19ef69
movb $0x1, 0x19(%rbx)
movq 0x28(%rbx), %rdi
callq 0x722ae
andq $0x0, 0x28(%rbx)
movq 0x38(%rbx), %rdi
callq 0x19f05e
andq $0x0, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
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 0x71f38
movq 0x38(%rbx), %rax
andl $0x0, 0x50(%rax)
andq $0x0, 0x58(%rax)
andq $0x0, 0x48(%rax)
andl $0x0, 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 %r12, %r14
jae 0x19ef5a
movq 0x28(%rbx), %rdi
callq 0x70f55
movq 0x38(%rbx), %rdi
incl 0x48(%rdi)
movzbl %al, %ebp
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x19f0b3
movq 0x38(%rbx), %rax
movl 0x48(%rax), %ecx
decl %ecx
movb %bpl, 0x20(%rax,%rcx)
movq 0x10(%rbx), %r14
incq %r14
jmp 0x19efba
movq 0x298f69(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x14600a(%rip), %rsi    # 0x2e5013
leaq 0x1b959d(%rip), %rdx    # 0x3585ad
leaq 0x1b95c2(%rip), %rcx    # 0x3585d9
leaq 0x1b95d5(%rip), %r8     # 0x3585f3
movl $0x1bf, %r9d            # imm = 0x1BF
jmp 0x19f052
movq 0x298f3b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x145fdc(%rip), %rsi    # 0x2e5013
leaq 0x1b95cf(%rip), %rdx    # 0x35860d
leaq 0x1b9594(%rip), %rcx    # 0x3585d9
leaq 0x1b95a7(%rip), %r8     # 0x3585f3
movl $0x1c2, %r9d            # imm = 0x1C2
xorl %eax, %eax
callq 0x17a50
callq 0x17390