// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/rcr.c
// Function: rcr_decode_insert_var
static int rcr_decode_insert_var(GtRcrDecoder *rcr_dec,
                                 GtBitInStream *bitstream,
                                 RcrDecodeInfo *info,
                                 char type,
                                 GtError *err)
{
  int had_err = 0;
  GtUword symbol = 0, i;
  GtUchar base;

  info->inserted_bases = 0;

  had_err = rcr_huff_read(info->base_hbwd, bitstream, &symbol, err);
  while (!had_err && symbol != info->alpha_size) {
    if (symbol == (info->alpha_size - 1)) {
      base = (GtUchar) GT_WILDCARD;
    }
    else
      base = (GtUchar) symbol;

    gt_str_append_char(info->base_string,
                       toupper(gt_alphabet_decode(info->alphabet, base)));
    info->inserted_bases++;
    had_err = rcr_huff_read(info->base_hbwd, bitstream, &symbol, err);
  }

  if (!had_err) {
    for (i = 0; i < info->inserted_bases; i++)
      gt_str_append_char(info->cigar_string, type);

    if (rcr_dec->store_var_qual) {
      had_err = rcr_huff_read_string(info->qual_hbwd, bitstream,
                                     info->inserted_bases, info->qual_string,
                                     err);
    }
    else {
      if (!rcr_dec->store_all_qual) {
        for (i = 0; i < info->inserted_bases; i++)
          gt_str_append_char(info->qual_string, DEFAULTQUAL);
      }
    }
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
movq %rsp, %rdx
movq %rax, (%rdx)
movq %rax, 0x58(%rbx)
movq 0x18(%rbx), %rdi
movq %r8, %rcx
callq 0x16b86d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x16bba5
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq (%rsp), %r13
movq 0x48(%rbx), %rax
cmpq %rax, %r13
je 0x16bb28
decq %rax
cmpq %rax, %r13
movl $0xfe, %eax
cmovel %eax, %r13d
movq %r14, %r15
movl %ebp, %r14d
movq 0x30(%rbx), %rbp
callq 0x170d0
movq (%rax), %r12
movq (%rbx), %rdi
movzbl %r13b, %esi
callq 0xd187b
movsbq %al, %rax
movsbl (%r12,%rax,4), %esi
movq %rbp, %rdi
movl %r14d, %ebp
movq %r15, %r14
movq 0x10(%rsp), %r15
callq 0x11af23
incq 0x58(%rbx)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movq %rsp, %rdx
movq %r14, %rcx
callq 0x16b86d
testl %eax, %eax
je 0x16bab0
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x16bba5
cmpq $0x0, 0x58(%rbx)
je 0x16bb4f
xorl %r12d, %r12d
movsbl %bpl, %ebp
movq 0x40(%rbx), %rdi
movl %ebp, %esi
callq 0x11af23
incq %r12
movq 0x58(%rbx), %rdx
cmpq %rdx, %r12
jb 0x16bb36
jmp 0x16bb51
xorl %edx, %edx
movq 0x8(%rsp), %rax
cmpb $0x1, 0xe2(%rax)
jne 0x16bb77
movq 0x20(%rbx), %rdi
movq 0x38(%rbx), %rcx
movq %r15, %rsi
movq %r14, %r8
callq 0x16b986
movl %eax, %r13d
jmp 0x16bba5
xorl %r13d, %r13d
testq %rdx, %rdx
je 0x16bba5
cmpb $0x0, 0xe1(%rax)
jne 0x16bba5
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x38(%rbx), %rdi
movl $0x2d, %esi
callq 0x11af23
incq %r14
cmpq 0x58(%rbx), %r14
jb 0x16bb8e
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq