// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_seqstartpos
GtUword gt_encseq_seqstartpos(const GtEncseq *encseq,
                                    GtUword seqnum)
{
  GtUword pos;
  bool wasmirrored = false;
  gt_assert(encseq != NULL && seqnum < encseq->logicalnumofdbsequences);
  if (encseq->hasmirror && seqnum >= encseq->numofdbsequences) {
    seqnum = encseq->logicalnumofdbsequences - 1 - seqnum;
    wasmirrored = true;
  }
  gt_assert(seqnum < encseq->numofdbsequences);
  if (encseq->numofdbsequences == 1UL) {
    gt_assert(seqnum == 0);
    return (wasmirrored ? encseq->totallength + 1 : 0);
  }
  if (encseq->sat != GT_ACCESS_TYPE_EQUALLENGTH) {
    pos = gt_encseq_seqstartpos_viautables(encseq, seqnum);
    if (wasmirrored) {
      if (seqnum == encseq->numofdbsequences - 1) {
        pos = encseq->totallength + 1;
      } else {
        gt_assert(seqnum + 1 < encseq->numofdbsequences);
        pos = encseq->totallength
                + (encseq->totallength
                    - (gt_encseq_seqstartpos_viautables(encseq,
                                                        seqnum + 1) - 2));
      }
    }
  } else {
    pos = gt_encseq_seqstartpos_Viaequallength(encseq, seqnum);
    if (wasmirrored) {
      if (seqnum == encseq->numofdbsequences - 1) {
        pos = encseq->totallength + 1;
      } else {
        gt_assert(seqnum + 1 < encseq->numofdbsequences);
        pos = encseq->totallength
                + (encseq->totallength
                    - (gt_encseq_seqstartpos_Viaequallength(encseq,
                                                            seqnum + 1) - 2));
      }
    }
  }
  return pos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xa6883
movq %rdi, %rbx
movq 0x48(%rdi), %r14
cmpq %rsi, %r14
jbe 0xa6883
movq 0x40(%rbx), %rax
cmpq %rsi, %rax
setbe %bpl
andb 0x3a8(%rbx), %bpl
movq %rsi, %rcx
notq %rcx
addq %rcx, %r14
testb %bpl, %bpl
cmoveq %rsi, %r14
cmpq %rax, %r14
jae 0xa68b1
cmpq $0x1, %rax
jne 0xa67ea
testb %bpl, %bpl
je 0xa6829
movq 0x30(%rbx), %r15
incq %r15
jmp 0xa6875
cmpl $0x2, (%rbx)
jne 0xa682e
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa6b11
testb %bpl, %bpl
je 0xa6872
movq 0x40(%rbx), %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %r14
je 0xa67de
incq %r14
cmpq %rax, %r14
jae 0xa68e9
movq 0x30(%rbx), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa6b11
jmp 0xa6866
xorl %r15d, %r15d
jmp 0xa6875
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa6945
testb %bpl, %bpl
je 0xa6872
movq 0x40(%rbx), %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %r14
je 0xa67de
incq %r14
cmpq %rax, %r14
jae 0xa6917
movq 0x30(%rbx), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa6945
addq %r15, %r15
subq %rax, %r15
addq $0x2, %r15
jmp 0xa6875
movq %rax, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8772e(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x237d2(%rip), %rsi     # 0xca066
leaq 0x45ccf(%rip), %rdx     # 0xec56a
leaq 0x45d03(%rip), %rcx     # 0xec5a5
leaq 0x452f1(%rip), %r8      # 0xebb9a
movl $0xf76, %r9d            # imm = 0xF76
jmp 0xa68dd
movq 0x87700(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x237a4(%rip), %rsi     # 0xca066
leaq 0x45cf2(%rip), %rdx     # 0xec5bb
leaq 0x45cd5(%rip), %rcx     # 0xec5a5
leaq 0x452c3(%rip), %r8      # 0xebb9a
movl $0xf7b, %r9d            # imm = 0xF7B
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x876c8(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x2376c(%rip), %rsi     # 0xca066
leaq 0x45cdc(%rip), %rdx     # 0xec5dd
leaq 0x45c9d(%rip), %rcx     # 0xec5a5
leaq 0x4528b(%rip), %r8      # 0xebb9a
movl $0xf93, %r9d            # imm = 0xF93
jmp 0xa68dd
movq 0x8769a(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x2373e(%rip), %rsi     # 0xca066
leaq 0x45cae(%rip), %rdx     # 0xec5dd
leaq 0x45c6f(%rip), %rcx     # 0xec5a5
leaq 0x4525d(%rip), %r8      # 0xebb9a
movl $0xf86, %r9d            # imm = 0xF86
jmp 0xa68dd