// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
testq %rdi, %rdi
je 0x1499a6
movq %rsi, %r14
movq 0x8(%rdi), %r12
movq 0x18(%rdi), %rax
movq %rax, 0x30(%rsp)
movq %rdi, 0x18(%rsp)
leaq 0x30(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movq %rdx, %r15
movq 0x18(%rsp), %rbx
testq %r15, %r15
je 0x1498e4
movq 0x30(%rsp), %r10
movq 0x20(%r10), %rbp
movq 0x38(%r10), %rax
leaq (%rax,%rbp), %rcx
cmpq %rcx, %r12
jae 0x1498e8
movq %r12, %rsi
subq %rbp, %rsi
jb 0x149945
cmpq $0x0, 0x38(%rbx)
jne 0x14996e
subq %r12, %rbp
addq %rax, %rbp
cmpq %rbp, %r15
cmovbq %r15, %rbp
imulq 0x40(%r10), %rsi
addq 0x48(%r10), %rsi
movq 0x30(%rbx), %rdx
imulq %rbp, %rdx
movq %r14, %rdi
callq 0x17630
movq 0x30(%rbx), %r13
imulq %rbp, %r13
subq %rbp, %r15
addq %rbp, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x149bfb
addq %r13, %r14
jmp 0x14986e
xorl %eax, %eax
jmp 0x149931
movq 0x50(%r10), %rdi
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
leaq 0x107(%rip), %rdx       # 0x149a0f
movq %r10, %rsi
movq %r14, %rcx
movq %r12, %r8
movq %r15, %r9
callq *0x58(%r10)
movq %rax, %rbx
addq %rax, %r12
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x149bfb
movq %rbx, %rax
subq %r15, %rax
addq 0x28(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2ee61c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1fa3ce(%rip), %rsi    # 0x343d24
leaq 0x1fa34d(%rip), %rdx    # 0x343caa
movl $0xe0, %ecx
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2ee5f3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19b694(%rip), %rsi    # 0x2e5013
leaq 0x1fa37b(%rip), %rdx    # 0x343d01
leaq 0x1fa363(%rip), %rcx    # 0x343cf0
leaq 0x1fa316(%rip), %r8     # 0x343caa
movl $0xcd, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2ee5bb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19b65c(%rip), %rsi    # 0x2e5013
leaq 0x1b4887(%rip), %rdx    # 0x2fe245
leaq 0x1fa32b(%rip), %rcx    # 0x343cf0
leaq 0x1fa2de(%rip), %r8     # 0x343caa
movl $0xb2, %r9d
jmp 0x14999a