// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/eis-sequencemultiread.c
// Function: seqReaderSetRead
static size_t
seqReaderSetRead(void *src, void *dest, size_t len)
{
  struct seqReaderState *state = src;
  struct seqReaderSet *readerSet;
  GtUword pos;
  size_t elemsLeft;
  gt_assert(src);
  readerSet = state->readerSet;
  elemsLeft = len;
  pos = seqReaderSetGetConsumerNextPos(state);
  while (elemsLeft)
  {
    if (pos >= readerSet->backlogStartPos + readerSet->backlogLen)
    {
      /* pos is in block that's governed by generator */
      size_t elemsGenerated =
        readerSet->generator(readerSet->generatorState, readerSet,
                             seqReaderSetMove2Backlog, dest, pos, elemsLeft,
                             state->xltor);
      seqReaderSetSetConsumerNextPos(state, pos += elemsGenerated);
      elemsLeft -= elemsGenerated;
      break;
    }
    else if (pos >= readerSet->backlogStartPos
             /* implicit because of above condition
                && pos < readerSet->backlogStartPos + readerSet->backlogLen */
      )
    {
      /* pos is in backlog */
      GtUword subLen, charsWritten;

      subLen = GT_MIN(elemsLeft, readerSet->backlogStartPos - pos
                              + readerSet->backlogLen);
      gt_assert(state->xltor.translateData == NULL);
      /*
      charsWritten = SDRTranslate(state->xltor, dest,
                                  (char *)readerSet->seqDataBacklog
                                  + (pos - readerSet->backlogStartPos)
                                  * readerSet->backlogElemSize,
                                  subLen);
      */
      memcpy(dest, (char *)readerSet->seqDataBacklog
                   + (pos - readerSet->backlogStartPos)
                   * readerSet->backlogElemSize,
             subLen * state->xltor.state.elemSize);
      charsWritten = subLen * state->xltor.state.elemSize;
      elemsLeft -= subLen;
      seqReaderSetSetConsumerNextPos(state, pos += subLen);
      dest = (char *)dest + charsWritten;
    }
    else
    {
      fprintf(stderr, "fatal error at file %s, line %d\n", __FILE__, __LINE__);
      abort();
    }
  }
  return len - elemsLeft;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
je 0x19e782
testq %rdx, %rdx
je 0x19e719
movq %rsi, %r12
movq %rdi, %r14
movq 0x18(%rdi), %rbx
movq 0x8(%rdi), %r15
leaq 0x30(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rdx, %rbp
movq 0x20(%rbx), %r13
movq 0x38(%rbx), %rax
leaq (%rax,%r13), %rcx
cmpq %rcx, %r15
jae 0x19e71d
movq %r15, %rsi
subq %r13, %rsi
jb 0x19e773
cmpq $0x0, 0x38(%r14)
jne 0x19e77d
subq %r15, %r13
addq %rax, %r13
cmpq %r13, %rbp
cmovbq %rbp, %r13
imulq 0x40(%rbx), %rsi
addq 0x48(%rbx), %rsi
movq 0x30(%r14), %rdx
imulq %r13, %rdx
movq %r12, %rdi
callq 0x17660
addq %r13, %r15
cmpq %r15, 0x8(%r14)
ja 0x19e778
movq 0x30(%r14), %rax
imulq %r13, %rax
addq %rax, %r12
movq %r15, 0x8(%r14)
subq %r13, %rbp
jne 0x19e6a9
movq 0x18(%rsp), %rdx
xorl %eax, %eax
jmp 0x19e761
movq 0x50(%rbx), %rdi
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
leaq 0x8a(%rip), %rdx        # 0x19e7c7
movq %rbx, %rsi
movq %r12, %rcx
movq %r15, %r8
movq %rbp, %r9
callq *0x58(%rbx)
addq %rax, %r15
cmpq %r15, 0x8(%r14)
ja 0x19e787
movq %r15, 0x8(%r14)
subq %rbp, %rax
movq 0x18(%rsp), %rdx
addq %rdx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6054c
callq 0x60515
callq 0x604dc
callq 0x60576
callq 0x604a5