// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/condenseq.c
// Function: gt_condenseq_extract_encoded_range
const GtUchar *gt_condenseq_extract_encoded_range(GtCondenseq *condenseq,
                                                  GtRange range)
{
  GtUchar *buf;
  GtUword nextsep,
          linkid = 0,
          uniqueid,
          buffoffset = 0,
          length;
  GtCondenseqLink *link = NULL;
  GtCondenseqUnique *unique = NULL;

  gt_assert(condenseq && condenseq->uds_nelems != 0);
  gt_assert(condenseq->uniques[0].orig_startpos == 0);
  gt_assert(range.start <= range.end);
  gt_assert(range.end < condenseq->orig_len);

  nextsep = condenseq_next_sep(condenseq, range.start);
  uniqueid = gt_condenseq_uniques_position_binsearch(condenseq,
                                                     range.start);

  length = range.end - range.start + 1;

  /* TODO DW check if there is another way than using this buffer, so we could
     use const for condenseq here. */
  if (condenseq->ubuffer == NULL || condenseq->ubuffsize < length) {
    condenseq->ubuffer = gt_realloc(condenseq->ubuffer,
                                    sizeof (*condenseq->ubuffer) * length);
    condenseq->ubuffsize = length;
  }

  buf = condenseq->ubuffer;

  unique = &condenseq->uniques[uniqueid];

  if (unique->orig_startpos + unique->len <= range.start) {
    uniqueid++;
    if (uniqueid == condenseq->uds_nelems)
      unique = NULL;
    else {
      unique = &condenseq->uniques[uniqueid];
      gt_assert(unique->orig_startpos + unique->len > range.start);
    }
  }

  if (condenseq->lds_nelems != 0) {
      linkid = condenseq_links_position_binsearch(condenseq, range.start);
    if (linkid == condenseq->lds_nelems)
      linkid = 0;
    link = &condenseq->links[linkid];
  }
  if (link != NULL &&
      link->orig_startpos + link->len <= range.start) {
    linkid++;
    if (linkid == condenseq->lds_nelems)
      link = NULL;
    else {
      link = &condenseq->links[linkid];
      gt_assert(link->orig_startpos + link->len > range.start);
    }
  }

  while (buffoffset < length) {
    gt_assert(nextsep == range.start + buffoffset ||
              unique != NULL ||
              link != NULL);
    if (nextsep != 0 && nextsep == range.start + buffoffset) {
      buf[buffoffset++] = GT_SEPARATOR;
      nextsep = condenseq_next_sep(condenseq, range.start + buffoffset);
    }
    else if (unique != NULL &&
             (link == NULL || unique->orig_startpos < link->orig_startpos)) {
      buffoffset += condenseq_unique_extract_encoded(condenseq, uniqueid,
                                                     buf + buffoffset,
                                                     range.start + buffoffset,
                                                     range.end);
      if (++uniqueid == condenseq->uds_nelems)
        unique = NULL;
      else {
        unique = &condenseq->uniques[uniqueid];
        gt_assert(unique->orig_startpos + unique->len > range.start);
      }
    }
    else {
      gt_assert(link != NULL);
      buffoffset += condenseq_link_extract_encoded(condenseq, linkid,
                                                   buf + buffoffset,
                                                   range.start + buffoffset,
                                                   range.end);
      if (++linkid == condenseq->lds_nelems)
        link = NULL;
      else {
        link = &condenseq->links[linkid];
        gt_assert(link->orig_startpos + link->len > range.start);
      }
    }
  }
  gt_assert(buffoffset == length);
  return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
testq %rdi, %rdi
je 0xc2a8e
movq %rdi, %r14
cmpq $0x0, 0x98(%rdi)
je 0xc2a8e
movq 0x10(%r14), %rax
cmpq $0x0, 0x18(%rax)
jne 0xc2abc
movq %rsi, %rbx
movq %rdx, %r15
subq %rsi, %r15
jb 0xc2aea
cmpq %rdx, 0x78(%r14)
jbe 0xc2b1b
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc2d62
movq %rax, %r13
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc2483
movq %rax, %rbp
leaq 0x1(%r15), %rsi
movq 0x30(%r14), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
movq %rsi, 0x28(%rsp)
je 0xc25dc
cmpq %rsi, 0x88(%r14)
jae 0xc2607
leaq 0x256991(%rip), %rdx    # 0x318f74
movq 0x18(%rsp), %rdi
movl $0x2f4, %ecx            # imm = 0x2F4
callq 0x93472
movq 0x28(%rsp), %rsi
movq %rax, 0x18(%rsp)
movq %rax, 0x30(%r14)
movq %rsi, 0x88(%r14)
movq 0x10(%r14), %r10
imulq $0x28, %rbp, %rax
movl 0x20(%r10,%rax), %ecx
addq 0x18(%r10,%rax), %rcx
cmpq %rbx, %rcx
ja 0xc2646
incq %rbp
cmpq 0x98(%r14), %rbp
jne 0xc262f
xorl %r10d, %r10d
jmp 0xc2649
imulq $0x28, %rbp, %rax
movl 0x20(%r10,%rax), %ecx
addq 0x18(%r10,%rax), %rcx
cmpq %rbx, %rcx
jbe 0xc2c3c
addq %rax, %r10
movq 0x70(%r14), %rax
testq %rax, %rax
je 0xc26b6
jle 0xc2bdf
leaq -0x1(%rax), %rdx
pushq $-0x1
popq %r9
movq %rax, %rcx
sarq %rdx
movq %rcx, %rdi
subq %r9, %rdi
cmpq $0x2, %rdi
jl 0xc2694
movq 0x8(%r14), %rdi
movq %rdx, %r8
shlq $0x5, %r8
cmpq %rbx, 0x8(%rdi,%r8)
ja 0xc2689
movq %rdx, %r9
jmp 0xc268f
movq %rdx, %rcx
movq %r9, %rdx
addq %rcx, %rdx
jmp 0xc2663
movq 0x8(%r14), %rcx
testq %r9, %r9
js 0xc26c4
movq %rdx, %rdi
shlq $0x5, %rdi
cmpq %rbx, 0x8(%rcx,%rdi)
jbe 0xc26da
movq $0x0, 0x8(%rsp)
jmp 0xc26e8
movq $0x0, 0x8(%rsp)
xorl %r8d, %r8d
jmp 0xc273d
movq $0x0, 0x8(%rsp)
movl $0x0, %r8d
testq %rcx, %rcx
jne 0xc26e8
jmp 0xc273d
xorl %edi, %edi
cmpq %rax, %rdx
cmovneq %rdx, %rdi
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %r8
movq %r8, %rdx
shlq $0x5, %rdx
movl 0x10(%rcx,%rdx), %edi
addq 0x8(%rcx,%rdx), %rdi
cmpq %rbx, %rdi
jbe 0xc2707
addq %rdx, %rcx
jmp 0xc273a
incq %r8
cmpq %rax, %r8
jne 0xc2719
xorl %r8d, %r8d
movq %rax, 0x8(%rsp)
jmp 0xc273d
movq %r8, %rax
movq %r8, 0x8(%rsp)
shlq $0x5, %rax
movl 0x10(%rcx,%rax), %edx
addq 0x8(%rcx,%rax), %rdx
cmpq %rbx, %rdx
jbe 0xc2c6d
addq %rax, %rcx
movq %rcx, %r8
movq %r10, 0x10(%rsp)
movq %rbp, 0x20(%rsp)
movq %r15, 0x48(%rsp)
movq %rbx, %rax
negq %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
movq %r14, %r12
movq %rax, %rbp
movq %r8, %r14
cmpq %rsi, %rbp
jae 0xc2a3c
leaq (%rbx,%rbp), %r15
cmpq %r13, %r15
je 0xc2785
cmpq $0x0, 0x10(%rsp)
jne 0xc2785
testq %r8, %r8
je 0xc2a56
testq %r13, %r13
je 0xc27bb
cmpq %r13, %r15
jne 0xc27bb
leaq 0x1(%rbp), %r15
movq 0x18(%rsp), %rax
movb $-0x1, (%rax,%rbp)
leaq (%rbx,%rbp), %rsi
incq %rsi
movq %r12, %rdi
callq 0xc2d62
movq %r14, %r8
movq 0x28(%rsp), %rsi
movq %rax, %r13
movq %r15, %rbp
jmp 0xc2762
cmpq $0x0, 0x10(%rsp)
je 0xc28fd
testq %r8, %r8
movq 0x8(%rsp), %rcx
je 0xc27e4
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0x8(%r8), %rax
jae 0xc290b
movq 0x10(%r12), %rax
imulq $0x28, 0x20(%rsp), %rcx
movq 0x18(%rax,%rcx), %rdx
cmpq %r15, %rdx
ja 0xc2b7d
addq %rcx, %rax
movl 0x20(%rax), %ecx
movq %rbx, %rax
movq %rdx, 0x10(%rsp)
subq %rdx, %rax
addq %rbp, %rax
movq %rcx, 0x38(%rsp)
cmpq %rcx, %rax
jae 0xc2bae
movq 0x18(%rsp), %rax
addq %rbp, %rax
movq %rax, 0x30(%rsp)
movq %r12, 0x50(%rsp)
movq 0x18(%r12), %rdi
movq 0x20(%rsp), %rsi
callq 0x74d9c
movq 0x38(%rsp), %rsi
leaq (%rsi,%rax), %rcx
decq %rcx
movq 0x10(%rsp), %rdx
subq %rdx, %rax
addq %rax, %r15
addq %rsi, %rdx
addq 0x40(%rsp), %rdx
subq %rbp, %rdx
movq 0x48(%rsp), %rax
subq %rbp, %rax
leaq (%r15,%rax), %rsi
incq %rax
cmpq %rax, %rdx
cmovaeq %rsi, %rcx
movq %rcx, 0x10(%rsp)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x30(%rsp), %rsi
movq %r15, %rdx
callq 0x721ca
subq %r15, %rbp
movq 0x10(%rsp), %rax
addq %rax, %rbp
incq %rbp
movq 0x20(%rsp), %rcx
incq %rcx
movl $0x0, %eax
movq %rax, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x98(%rax), %rcx
movq 0x28(%rsp), %rsi
movq %r14, %r8
je 0xc2762
movq 0x10(%r12), %rax
imulq $0x28, 0x20(%rsp), %rcx
leaq (%rax,%rcx), %rdx
movq %rdx, 0x10(%rsp)
movl 0x20(%rax,%rcx), %edx
addq 0x18(%rax,%rcx), %rdx
cmpq %rbx, %rdx
ja 0xc2762
jmp 0xc2c0b
testq %r8, %r8
movq 0x8(%rsp), %rcx
je 0xc2d31
movq %r12, %r14
movq 0x8(%r12), %rax
shlq $0x5, %rcx
movq 0x8(%rax,%rcx), %r12
cmpq %r15, %r12
ja 0xc2c9e
leaq (%rax,%rcx), %rdx
movq (%rax,%rcx), %rsi
movq %rsi, 0x38(%rsp)
movl 0x10(%rax,%rcx), %r15d
movl 0x18(%rax,%rcx), %eax
movq %rax, 0x30(%rsp)
movl 0x14(%rdx), %esi
movq 0x18(%r14), %rdi
callq 0x74d9c
movq %rbx, %r8
subq %r12, %r8
addq %rbp, %r8
cmpq %r15, %r8
jae 0xc2ccf
movq 0x18(%rsp), %rcx
addq %rbp, %rcx
movq %r15, %rdx
addq %r12, %rdx
addq 0x40(%rsp), %rdx
subq %rbp, %rdx
movq 0x48(%rsp), %rsi
subq %rbp, %rsi
decl %r15d
leaq (%r8,%rsi), %rdi
incq %rsi
cmpq %rsi, %rdx
cmovaeq %rdi, %r15
movq 0x18(%r14), %rsi
addq 0x30(%rsp), %rax
movq %rcx, (%rsp)
movq 0x38(%rsp), %rdi
movq %rax, %rdx
xorl %ecx, %ecx
movq %r15, %r9
callq 0xcf543
addq %r12, %r15
subq %rax, %r15
movq 0x40(%rsp), %rcx
addq %r15, %rcx
incq %rcx
cmpq %rbp, %rcx
jne 0xc2d00
addq %rbp, %rax
movq 0x8(%rsp), %rdx
incq %rdx
movl $0x0, %r8d
movq %rdx, 0x8(%rsp)
cmpq 0x70(%r14), %rdx
movq 0x28(%rsp), %rsi
je 0xc2759
movq 0x8(%r14), %rcx
movq 0x8(%rsp), %rdx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %r8
movl 0x10(%rcx,%rdx), %edi
addq 0x8(%rcx,%rdx), %rdi
cmpq %rbx, %rdi
ja 0xc2759
movq 0x375553(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2225f4(%rip), %rsi    # 0x2e5013
leaq 0x256ad5(%rip), %rdx    # 0x3194fb
leaq 0x256a30(%rip), %rcx    # 0x31945d
leaq 0x256540(%rip), %r8     # 0x318f74
movl $0x336, %r9d            # imm = 0x336
jmp 0xc2a82
jne 0xc2b4c
movq 0x18(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x37550b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2225ac(%rip), %rsi    # 0x2e5013
leaq 0x256abb(%rip), %rdx    # 0x319529
leaq 0x2569e8(%rip), %rcx    # 0x31945d
leaq 0x2564f8(%rip), %r8     # 0x318f74
movl $0x31a, %r9d            # imm = 0x31A
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x3754d3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222574(%rip), %rsi    # 0x2e5013
leaq 0x25698f(%rip), %rdx    # 0x319435
leaq 0x2569b0(%rip), %rcx    # 0x31945d
leaq 0x2564c0(%rip), %r8     # 0x318f74
movl $0x2e5, %r9d            # imm = 0x2E5
jmp 0xc2a82
movq 0x3754a5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222546(%rip), %rsi    # 0x2e5013
leaq 0x2569ac(%rip), %rdx    # 0x319480
leaq 0x256982(%rip), %rcx    # 0x31945d
leaq 0x256492(%rip), %r8     # 0x318f74
movl $0x2e6, %r9d            # imm = 0x2E6
jmp 0xc2a82
movq 0x375477(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222518(%rip), %rsi    # 0x2e5013
leaq 0x25252a(%rip), %rdx    # 0x31502c
leaq 0x256954(%rip), %rcx    # 0x31945d
leaq 0x256464(%rip), %r8     # 0x318f74
movl $0x2e7, %r9d            # imm = 0x2E7
jmp 0xc2a82
movq 0x375446(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2224e7(%rip), %rsi    # 0x2e5013
leaq 0x256976(%rip), %rdx    # 0x3194a9
leaq 0x256923(%rip), %rcx    # 0x31945d
leaq 0x256433(%rip), %r8     # 0x318f74
movl $0x2e8, %r9d            # imm = 0x2E8
jmp 0xc2a82
movq 0x375415(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2224b6(%rip), %rsi    # 0x2e5013
leaq 0x256a0b(%rip), %rdx    # 0x31956f
leaq 0x2568f2(%rip), %rcx    # 0x31945d
leaq 0x256402(%rip), %r8     # 0x318f74
movl $0x33a, %r9d            # imm = 0x33A
jmp 0xc2a82
movq 0x3753e4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222485(%rip), %rsi    # 0x2e5013
leaq 0x256d6d(%rip), %rdx    # 0x319902
leaq 0x256d86(%rip), %rcx    # 0x319922
leaq 0x2563d1(%rip), %r8     # 0x318f74
movl $0x2a9, %r9d            # imm = 0x2A9
jmp 0xc2a82
movq 0x3753b3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222454(%rip), %rsi    # 0x2e5013
leaq 0x256d7d(%rip), %rdx    # 0x319943
leaq 0x256d55(%rip), %rcx    # 0x319922
leaq 0x2563a0(%rip), %r8     # 0x318f74
movl $0x2ab, %r9d            # imm = 0x2AB
jmp 0xc2a82
movq 0x375382(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2261c7(%rip), %rsi    # 0x2e8db7
leaq 0x25637d(%rip), %rdx    # 0x318f74
movl $0x277, %ecx            # imm = 0x277
xorl %eax, %eax
callq 0x17a50
pushq $0x1
popq %rdi
callq 0x178f0
movq 0x375356(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2223f7(%rip), %rsi    # 0x2e5013
leaq 0x2568a6(%rip), %rdx    # 0x3194c9
leaq 0x256833(%rip), %rcx    # 0x31945d
leaq 0x256343(%rip), %r8     # 0x318f74
movl $0x329, %r9d            # imm = 0x329
jmp 0xc2a82
movq 0x375325(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2223c6(%rip), %rsi    # 0x2e5013
leaq 0x256875(%rip), %rdx    # 0x3194c9
leaq 0x256802(%rip), %rcx    # 0x31945d
leaq 0x256312(%rip), %r8     # 0x318f74
movl $0x302, %r9d            # imm = 0x302
jmp 0xc2a82
movq 0x3752f4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222395(%rip), %rsi    # 0x2e5013
leaq 0x256876(%rip), %rdx    # 0x3194fb
leaq 0x2567d1(%rip), %rcx    # 0x31945d
leaq 0x2562e1(%rip), %r8     # 0x318f74
movl $0x313, %r9d            # imm = 0x313
jmp 0xc2a82
movq 0x3752c3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222364(%rip), %rsi    # 0x2e5013
leaq 0x256ca6(%rip), %rdx    # 0x31995c
leaq 0x256cbd(%rip), %rcx    # 0x31997a
leaq 0x2562b0(%rip), %r8     # 0x318f74
movl $0x2c6, %r9d            # imm = 0x2C6
jmp 0xc2a82
movq 0x375292(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222333(%rip), %rsi    # 0x2e5013
leaq 0x256cb2(%rip), %rdx    # 0x319999
leaq 0x256c8c(%rip), %rcx    # 0x31997a
leaq 0x25627f(%rip), %r8     # 0x318f74
movl $0x2c9, %r9d            # imm = 0x2C9
jmp 0xc2a82
movq 0x375261(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x222302(%rip), %rsi    # 0x2e5013
leaq 0x256c98(%rip), %rdx    # 0x3199b0
leaq 0x256c5b(%rip), %rcx    # 0x31997a
leaq 0x25624e(%rip), %r8     # 0x318f74
movl $0x2d5, %r9d            # imm = 0x2D5
jmp 0xc2a82
movq 0x375230(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2222d1(%rip), %rsi    # 0x2e5013
leaq 0x256819(%rip), %rdx    # 0x319562
leaq 0x25670d(%rip), %rcx    # 0x31945d
leaq 0x25621d(%rip), %r8     # 0x318f74
movl $0x32d, %r9d            # imm = 0x32D
jmp 0xc2a82