// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
testq %rcx, %rcx
je 0xa9183
movq %r15, %rdi
callq 0x3566a
testb %al, %al
jne 0xa93b3
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
testq %r14, %r14
je 0xa93ae
testq %r12, %r12
je 0xa93ae
cmpb $0x1, 0x1b(%r14)
jne 0xa91aa
movl 0x50(%r14), %r13d
jmp 0xa91c2
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xa8fbb
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
je 0xa91d4
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x3c40b
movq %rax, %rdi
callq 0x7a678
testb %al, %al
je 0xa9208
movq 0x38(%r14), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd7ba5
cmpb $0x1, 0x19(%r14)
jne 0xa926e
movq 0x40(%r14), %r13
testq %r13, %r13
je 0xa93b8
movq %r12, %rdi
callq 0x3c40b
movq %r15, (%rsp)
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %r13, %rdi
movq %rax, %rsi
xorl %r9d, %r9d
callq 0xa9f05
movl %eax, %r13d
testl %eax, %eax
jne 0xa91c2
movq 0x38(%r14), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0xd7c59
movq %rax, (%rbx)
xorl %r13d, %r13d
jmp 0xa91c2
cmpb $0x1, 0x18(%r14)
jne 0xa9295
movq 0x38(%r14), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd7b33
cmpb $0x1, 0x1c(%r14)
jne 0xa9317
movq $-0x1, 0x10(%rsp)
cmpq $0x0, 0x30(%r14)
je 0xa93bd
movq %r12, %rdi
callq 0x3c40b
leaq 0x528be(%rip), %rsi     # 0xfbb7d
leaq 0x10(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0xb680
movl %eax, %ebp
cmpl $0x1, %eax
je 0xa92f1
movq %r12, %rdi
callq 0x3c40b
leaq 0x528a0(%rip), %rsi     # 0xfbb84
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3559f
cmpl $0x1, %ebp
setne %al
movq 0x10(%rsp), %r12
cmpq $-0x1, %r12
setne %cl
orb %al, %cl
je 0xa93c2
xorl %r13d, %r13d
cmpl $0x1, %ebp
je 0xa9330
xorl %ebp, %ebp
jmp 0xa9368
cmpq $0x0, 0x20(%r14)
je 0xa938d
movq 0x38(%r14), %rdi
xorl %r13d, %r13d
xorl %esi, %esi
xorl %edx, %edx
callq 0xd7c59
jmp 0xa9385
movq 0x30(%r14), %rdi
callq 0xbef6c
movb $0x1, %bpl
cmpq %rax, %r12
jb 0xa936e
movq 0x10(%rsp), %r12
movq 0x30(%r14), %rdi
callq 0xbef6c
leaq 0x528af(%rip), %rsi     # 0xfbc05
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3559f
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testb %bpl, %bpl
je 0xa91c2
movq 0x30(%r14), %rdi
movq 0x10(%rsp), %rsi
callq 0xc2d57
movq %rax, (%rbx)
jmp 0xa91c2
movq %r12, %rdi
callq 0x3c40b
leaq 0x52975(%rip), %rsi     # 0xfbd11
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3559f
jmp 0xa91c2
callq 0x2403d
callq 0x24004
callq 0x240e8
callq 0x240af
callq 0x24076