// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/hcr.c
// Function: hcr_next_seq_qual
static int hcr_next_seq_qual(GtHcrSeqDecoder *seq_dec, char *seq, char *qual,
                             GtError *err)
{
  enum state {
    HCR_ERROR = -1,
    END,
    SUCCESS
  };
  unsigned char base;
  GtUword i,
                nearestsample,
                *symbol;
  size_t startofnearestsample = 0;
  enum state status = END;
  FastqFileInfo cur_read;
  FastqFileInfo *fileinfo = NULL;

  if (seq_dec->cur_read <= seq_dec->num_of_reads) {
    GtSampling *sampling = seq_dec->sampling;
    status = SUCCESS;
    if (seq_dec->symbols == NULL)
      seq_dec->symbols = gt_array_new(sizeof (GtUword));
    else
      gt_array_reset(seq_dec->symbols);

    cur_read.readnum = seq_dec->cur_read;
    fileinfo = (FastqFileInfo *)gt_rbtree_next_key(seq_dec->file_info_rbt,
                                                   &cur_read,
                                                   hcr_cmp_FastqFileInfo,
                                                   NULL);
    gt_assert(fileinfo);

    /* reset huffman_decoder if next read is sampled */
    if (sampling != NULL &&
        gt_sampling_get_next_elementnum(sampling) == seq_dec->cur_read) {
      gt_log_log("reset because sampled read is next");
      (void) gt_sampling_get_next_sample(sampling,
                                         &nearestsample,
                                         &startofnearestsample);
      reset_data_iterator_to_pos(seq_dec->data_iter, startofnearestsample);
      (void) gt_huffman_decoder_get_new_mem_chunk(seq_dec->huff_dec, err);
      if (gt_error_is_set(err))
        status = HCR_ERROR;
    }
    if (status != HCR_ERROR) {
      int ret;
      ret =  gt_huffman_decoder_next(seq_dec->huff_dec, seq_dec->symbols,
                                     fileinfo->readlength, err);
      if (ret != 1)
        status = HCR_ERROR;
      if (ret == 0)
        gt_error_set(err, "reached end of file");
    }
    if (qual || seq) {
      for (i = 0; i < gt_array_size(seq_dec->symbols); i++) {
        symbol = (GtUword*) gt_array_get(seq_dec->symbols, i);
        if (qual != NULL)
          qual[i] = get_qual_from_symbol(seq_dec, *symbol);
        if (seq != NULL) {
          base = get_base_from_symbol(seq_dec, *symbol);
          seq[i] = (char)toupper(gt_alphabet_decode(seq_dec->alpha,
                                                    (GtUchar) base));
        }
      }
      if (qual != NULL)
        qual[gt_array_size(seq_dec->symbols)] = '\0';
      if (seq != NULL)
        seq[gt_array_size(seq_dec->symbols)] = '\0';
    }
    seq_dec->cur_read++;
  }
  return (int) status;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movq $0x0, 0x50(%rsp)
movl $0x0, 0x4c(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rax
movq 0x90(%rsp), %rcx
cmpq 0x60(%rcx), %rax
ja 0x186b3a
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x28(%rsp)
movl $0x1, 0x4c(%rsp)
movq 0x90(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x18683f
movl $0x8, %edi
callq 0x80990
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0x186850
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x814a0
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x90(%rsp), %rax
movq 0x30(%rax), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x2d07(%rip), %rdx      # 0x189580
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b9e40
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x1868c7
movq 0x4b570a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38f773(%rip), %rsi    # 0x516013
leaq 0x405667(%rip), %rdx    # 0x58bf0e
leaq 0x3cea0f(%rip), %rcx    # 0x5552bd
leaq 0x3ce436(%rip), %r8     # 0x554ceb
movl $0x38d, %r9d            # imm = 0x38D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1868c9
cmpq $0x0, 0x28(%rsp)
je 0x186955
movq 0x28(%rsp), %rdi
callq 0x1d0800
movq 0x90(%rsp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x186955
leaq 0x3ce9db(%rip), %rdi    # 0x5552cf
movb $0x0, %al
callq 0xe7740
movq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x1d0990
movq 0x90(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x50(%rsp), %rsi
callq 0x186b50
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x78(%rsp), %rsi
callq 0x192880
movq 0x78(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x18694b
jmp 0x186953
movl $0xffffffff, 0x4c(%rsp) # imm = 0xFFFFFFFF
jmp 0x186955
cmpl $-0x1, 0x4c(%rsp)
je 0x1869b5
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x30(%rsp), %rax
movq (%rax), %rdx
movq 0x78(%rsp), %rcx
callq 0x1929b0
movl %eax, 0x24(%rsp)
cmpl $0x1, 0x24(%rsp)
je 0x186999
movl $0xffffffff, 0x4c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x24(%rsp)
jne 0x1869b3
movq 0x78(%rsp), %rdi
leaq 0x3ce946(%rip), %rsi    # 0x5552f2
movb $0x0, %al
callq 0xd88c0
jmp 0x1869b5
cmpq $0x0, 0x80(%rsp)
jne 0x1869cf
cmpq $0x0, 0x88(%rsp)
je 0x186b26
movq $0x0, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x81370
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x186aba
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x80b60
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x186a51
movq 0x90(%rsp), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rsi
callq 0x189640
movb %al, %dl
movq 0x80(%rsp), %rax
movq 0x68(%rsp), %rcx
movb %dl, (%rax,%rcx)
cmpq $0x0, 0x88(%rsp)
je 0x186aa5
movq 0x90(%rsp), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rsi
callq 0x189670
movb %al, 0x77(%rsp)
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rdi
movzbl 0x77(%rsp), %esi
callq 0x7f7b0
movsbl %al, %edi
callq 0x19dd0
movb %al, %dl
movq 0x88(%rsp), %rax
movq 0x68(%rsp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x186aa7
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x1869d8
cmpq $0x0, 0x80(%rsp)
je 0x186aef
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x81370
movq %rax, %rcx
movq 0x10(%rsp), %rax
movb $0x0, (%rax,%rcx)
cmpq $0x0, 0x88(%rsp)
je 0x186b24
movq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x81370
movq %rax, %rcx
movq 0x8(%rsp), %rax
movb $0x0, (%rax,%rcx)
jmp 0x186b26
movq 0x90(%rsp), %rax
movq 0x58(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x58(%rax)
movl 0x4c(%rsp), %eax
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)