// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/region_mapping.c
// Function: gt_region_mapping_get_sequence_length
int gt_region_mapping_get_sequence_length(GtRegionMapping *rm,
                                          GtUword *length, GtStr *seqid,
                                          GtError *err)
{
  GtUword filenum, seqnum;
  int had_err;
  gt_error_check(err);
  GT_UNUSED GtRange range = {0,0};
  gt_assert(rm && seqid);
  if (rm->userawseq) {
    return rm->rawlength;
  }
  had_err = update_seq_col_if_necessary(rm, seqid, err);
  if (!had_err) {
    if (gt_md5_seqid_has_prefix(gt_str_get(seqid))) {
      had_err = gt_seq_col_md5_to_sequence_length(rm->seq_col, length, seqid,
                                                  err);
    }
    else if (rm->usedesc) {
      gt_assert(rm->seqid2seqnum_mapping);
      had_err = gt_seqid2seqnum_mapping_map(rm->seqid2seqnum_mapping,
                                            gt_str_get(seqid), &range, &seqnum,
                                            &filenum, NULL, err);
      if (!had_err)
        *length = gt_seq_col_get_sequence_length(rm->seq_col, filenum, seqnum);
    }
    else if (rm->matchdesc) {
      had_err = gt_seq_col_grep_desc_sequence_length(rm->seq_col, length,
                                                     seqid, err);
    }
    else if (rm->useseqno) {
      GtUword seqno = GT_UNDEF_UWORD;
      gt_assert(rm->encseq);
      if (1 != sscanf(gt_str_get(seqid), "seq"GT_WU"", &seqno)) {
        gt_error_set(err, "seqid '%s' does not have the form 'seqX' "
                          "where X is a sequence number in the encoded "
                          "sequence", gt_str_get(seqid));
        had_err = -1;
      }
      gt_assert(had_err || seqno != GT_UNDEF_UWORD);
      if (!had_err && seqno >= gt_encseq_num_of_sequences(rm->encseq)) {
          gt_error_set(err, "trying to access sequence "GT_WU", but encoded "
                            "sequence contains only "GT_WU" sequences",
                            seqno, gt_encseq_num_of_sequences(rm->encseq));
          had_err = -1;
      }
      if (!had_err) {
        *length = gt_encseq_seqlength(rm->encseq, seqno);
      }
    } else if (rm->mapping) {
      *length = gt_seq_col_get_sequence_length(rm->seq_col, 0, 0);
    } else {
      gt_assert(!rm->usedesc && !rm->matchdesc);
      gt_error_set(err, "no mapping rule given and no MD5 tags "
                        "present in the query seqid \"%s\" -- no mapping can "
                        "be defined", gt_str_get(seqid));
      had_err = -1;
    }
  }
  return had_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r12
testq %rcx, %rcx
je 0x8999a
movq %r14, %rdi
callq 0xc103
testb %al, %al
jne 0x89bca
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
testq %r12, %r12
je 0x89b9c
testq %r13, %r13
je 0x89b9c
cmpb $0x1, 0x1b(%r12)
jne 0x899c3
movl 0x50(%r12), %r15d
jmp 0x899d9
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x89778
pushq $-0x1
popq %r15
testl %eax, %eax
je 0x899ea
movl %r15d, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r13, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x59a50
testb %al, %al
je 0x89a1e
movq 0x38(%r12), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r14, %rcx
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xbfd8d
cmpb $0x1, 0x19(%r12)
jne 0x89a87
movq 0x40(%r12), %r15
testq %r15, %r15
je 0x89c02
movq %r13, %rdi
callq 0x143d2
movq %r14, (%rsp)
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %r15, %rdi
movq %rax, %rsi
xorl %r9d, %r9d
callq 0x8abc8
movl %eax, %r15d
testl %eax, %eax
jne 0x899d9
movq 0x38(%r12), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0xbff73
movq %rax, (%rbx)
xorl %r15d, %r15d
jmp 0x899d9
cmpb $0x1, 0x18(%r12)
jne 0x89aaf
movq 0x38(%r12), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r14, %rcx
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xbfc84
cmpb $0x1, 0x1c(%r12)
jne 0x89b1e
orq $-0x1, 0x10(%rsp)
cmpq $0x0, 0x30(%r12)
je 0x89c30
movq %r13, %rdi
callq 0x143d2
leaq 0x5b325(%rip), %rsi     # 0xe4dfd
leaq 0x10(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0xb680
cmpl $0x1, %eax
jne 0x89b3f
movq 0x10(%rsp), %r13
cmpq $-0x1, %r13
je 0x89c5e
movq 0x30(%r12), %rdi
callq 0xa1f8d
cmpq %rax, %r13
jae 0x89b71
movq 0x30(%r12), %rdi
movq 0x10(%rsp), %rsi
callq 0xa6b5f
jmp 0x89a7c
cmpq $0x0, 0x20(%r12)
je 0x89b50
movq 0x38(%r12), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
xorl %edx, %edx
callq 0xbff73
movq %rax, (%rbx)
jmp 0x899d9
movq %r13, %rdi
callq 0x143d2
leaq 0x5b2b6(%rip), %rsi     # 0xe4e04
jmp 0x89b5f
movq %r13, %rdi
callq 0x143d2
leaq 0x5b432(%rip), %rsi     # 0xe4f91
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xc007
jmp 0x899d9
movq 0x10(%rsp), %rbx
movq 0x30(%r12), %rdi
callq 0xa1f8d
leaq 0x5b2fe(%rip), %rsi     # 0xe4e85
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xc007
jmp 0x899d9
movq 0xa4415(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x404b9(%rip), %rsi     # 0xca066
leaq 0x5b466(%rip), %rdx     # 0xe501a
leaq 0x5b439(%rip), %rcx     # 0xe4ff4
leaq 0x5afec(%rip), %r8      # 0xe4bae
movl $0x169, %r9d            # imm = 0x169
jmp 0x89bf6
movq 0xa43e7(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x4048b(%rip), %rsi     # 0xca066
leaq 0x40a77(%rip), %rdx     # 0xca659
leaq 0x5b40b(%rip), %rcx     # 0xe4ff4
leaq 0x5afbe(%rip), %r8      # 0xe4bae
movl $0x167, %r9d            # imm = 0x167
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0xa43af(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x40453(%rip), %rsi     # 0xca066
leaq 0x5b0ec(%rip), %rdx     # 0xe4d06
leaq 0x5b3d3(%rip), %rcx     # 0xe4ff4
leaq 0x5af86(%rip), %r8      # 0xe4bae
movl $0x174, %r9d            # imm = 0x174
jmp 0x89bf6
movq 0xa4381(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x40425(%rip), %rsi     # 0xca066
leaq 0x5b1aa(%rip), %rdx     # 0xe4df2
leaq 0x5b3a5(%rip), %rcx     # 0xe4ff4
leaq 0x5af58(%rip), %r8      # 0xe4bae
movl $0x181, %r9d            # imm = 0x181
jmp 0x89bf6
movq 0xa4353(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x403f7(%rip), %rsi     # 0xca066
leaq 0x5b1ec(%rip), %rdx     # 0xe4e62
leaq 0x5b377(%rip), %rcx     # 0xe4ff4
leaq 0x5af2a(%rip), %r8      # 0xe4bae
movl $0x188, %r9d            # imm = 0x188
jmp 0x89bf6