// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rax
movl 0x44(%rax), %eax
movq %rax, 0x8(%rsp)
cmpl $0x1, 0x2c(%rsp)
je 0x2ca3af
cmpl $0x3, 0x2c(%rsp)
jne 0x2ca3ef
cmpq $0x0, 0x20(%rsp)
je 0x2ca3ef
movq 0x371be2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24bc4b(%rip), %rsi    # 0x516013
leaq 0x2c0d16(%rip), %rdx    # 0x58b0e5
leaq 0x2c0d3b(%rip), %rcx    # 0x58b111
leaq 0x2c0d4e(%rip), %r8     # 0x58b12b
movl $0x1bf, %r9d            # imm = 0x1BF
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ca3f1
movq 0x10(%rsp), %rdi
callq 0xa9d00
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rcx
cmpq (%rcx), %rax
jb 0x2ca45b
movq 0x371b76(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24bbdf(%rip), %rsi    # 0x516013
leaq 0x2c0d0a(%rip), %rdx    # 0x58b145
leaq 0x2c0ccf(%rip), %rcx    # 0x58b111
leaq 0x2c0ce2(%rip), %r8     # 0x58b12b
movl $0x1c2, %r9d            # imm = 0x1C2
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ca45d
movq 0x30(%rsp), %rax
movq $0x0, 0x50(%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rax
subq 0x20(%rsp), %rax
cmpq 0x8(%rsp), %rax
jae 0x2ca4c2
movq 0x30(%rsp), %rax
movb $0x1, 0x19(%rax)
movq 0x30(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xac3f0
movq 0x30(%rsp), %rax
movq $0x0, 0x28(%rax)
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rdi
callq 0x2ca5b0
movq 0x30(%rsp), %rax
movq $0x0, 0x38(%rax)
jmp 0x2ca5a5
movq 0x30(%rsp), %rax
movb $0x0, 0x19(%rax)
movl 0x2c(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x30(%rax)
movq 0x30(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x10(%rsp), %rsi
movl 0x2c(%rsp), %edx
movq 0x20(%rsp), %rcx
callq 0xabdb0
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rdi
callq 0x2ca610
movq 0x30(%rsp), %rax
movb $0x0, 0x18(%rax)
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
addq 0x8(%rsp), %rcx
cmpq %rcx, %rax
jae 0x2ca5a3
movq 0x30(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xaae30
movb %al, 0x1f(%rsp)
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rdi
xorl %ecx, %ecx
movzbl 0x1f(%rsp), %esi
movl %ecx, %edx
callq 0x2ca640
movb 0x1f(%rsp), %dl
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x30(%rsp), %rcx
movq 0x38(%rcx), %rcx
movl 0x48(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movb %dl, 0x20(%rax,%rcx)
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x2ca518
jmp 0x2ca5a5
addq $0x38, %rsp
retq
nopw (%rax,%rax)