// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/sfx-maprange.c
// Function: gt_Sfxmappedrange_map
void *gt_Sfxmappedrange_map(GtSfxmappedrange *sfxmappedrange,
                            GtUword minindex,
                            GtUword maxindex)
{
  gt_assert(sfxmappedrange != NULL);
  if (sfxmappedrange->ptr != NULL)
  {
    gt_fa_xmunmap(sfxmappedrange->ptr);
  }
  if (sfxmappedrange->transformfunc != NULL)
  {
    sfxmappedrange->transformfunc(&minindex,&maxindex,
                                  sfxmappedrange->transformfunc_data);
  }
  if (minindex <= maxindex)
  {
    GtMappedrange lbrange;
    GtUword unitoffset;
    size_t sizeoftable;

    gt_Sfxmapped_offset_end(&lbrange,
                            sfxmappedrange->sizeofunit,
                            sfxmappedrange->pagesize,
                            minindex,
                            maxindex);
    sizeoftable = gt_Sfxmappedrange_size_entire(sfxmappedrange);
    gt_log_log("mapped %s["GT_WU".."GT_WU"] for %s (%.1f%% of all)",
               gt_str_get(sfxmappedrange->tablename),
               lbrange.mapoffset,
               lbrange.mapend,
               sfxmappedrange->writable ? "writing" : "reading",
               (lbrange.mapend - lbrange.mapoffset + 1
                 >= (GtUword) sizeoftable)
                    ? 100.0
                    : 100.0 * (lbrange.mapend - lbrange.mapoffset + 1)/
                               sizeoftable);
    gt_assert(lbrange.mapoffset <= lbrange.mapend);
    gt_assert(lbrange.mapoffset <= minindex * sfxmappedrange->sizeofunit);
    gt_assert(maxindex * sfxmappedrange->sizeofunit <= lbrange.mapend);
    gt_assert(lbrange.mapoffset % sfxmappedrange->pagesize == 0);
    if (sfxmappedrange->writable)
    {
      sfxmappedrange->ptr
        = gt_fa_xmmap_write_range(gt_str_get(sfxmappedrange->filename),
                                  (size_t) (lbrange.mapend-lbrange.mapoffset+1),
                                  (size_t) lbrange.mapoffset);
    } else
    {
      sfxmappedrange->ptr
        = gt_fa_xmmap_read_range (gt_str_get(sfxmappedrange->filename),
                                  (size_t) (lbrange.mapend-lbrange.mapoffset+1),
                                  (size_t) lbrange.mapoffset);
    }
    sfxmappedrange->indexrange_defined = true;
    sfxmappedrange->currentmaxindex = maxindex;
    sfxmappedrange->currentminindex = minindex;
    unitoffset = lbrange.mapoffset / sfxmappedrange->sizeofunit;
    switch (sfxmappedrange->type)
    {
      case GtSfxGtBitsequence:
        return ((GtBitsequence *) sfxmappedrange->ptr) - unitoffset;
      case GtSfxuint32_t:
        return ((uint32_t *) sfxmappedrange->ptr) - unitoffset;
      case GtSfxunsignedlong:
        return ((GtUword *) sfxmappedrange->ptr) - unitoffset;
      default:
        gt_assert(false);
        break;
    }
    gt_assert(false);
  }
  sfxmappedrange->ptr = NULL;
  sfxmappedrange->indexrange_defined = true;
  sfxmappedrange->currentmaxindex = maxindex;
  sfxmappedrange->currentminindex = minindex;
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0x1a0328
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x1a0143
callq 0x8b9fa
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x1a0168
movq 0x68(%rbx), %rdx
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq *%rax
movq (%r14), %r14
movq (%r15), %r12
cmpq %r12, %r14
jbe 0x1a0184
andq $0x0, (%rbx)
movb $0x1, 0x58(%rbx)
movq %r12, 0x50(%rbx)
movq %r14, 0x48(%rbx)
xorl %ecx, %ecx
jmp 0x1a0316
movq 0x38(%rbx), %r13
movq 0x20(%rbx), %rdi
movq 0x28(%rbx), %r15
imulq %r13, %r14
movq %r14, %rax
xorl %edx, %edx
divq %r15
subq %rdx, %r14
imulq %r13, %r12
movq %r12, %rax
xorl %edx, %edx
divq %r15
addq %r12, %r15
subq %rdx, %r15
testq %rdx, %rdx
cmoveq %r12, %r15
imulq 0x30(%rbx), %r13
callq 0xad1fa
leaq 0x1e7580(%rip), %rcx    # 0x387749
cmpb $0x0, 0x70(%rbx)
leaq 0x1e754e(%rip), %r8     # 0x387722
cmovneq %rcx, %r8
movq %r15, %rcx
subq %r14, %rcx
leaq 0x1(%rcx), %r12
movsd 0x1495f6(%rip), %xmm0   # 0x2e97e0
cmpq %r13, %r12
jae 0x1a023d
movq %r12, %xmm1
movq 0x1476e4(%rip), %xmm2   # 0x2e78e0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1476e8(%rip), %xmm3   # 0x2e78f0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm4
unpckhpd %xmm1, %xmm4            # xmm4 = xmm4[1],xmm1[1]
addsd %xmm1, %xmm4
mulsd %xmm0, %xmm4
movq %r13, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm4
movapd %xmm4, %xmm0
leaq 0x1b87f6(%rip), %rdi    # 0x358a3a
movq %rax, %rsi
movq %r14, %rdx
movq %r15, %rcx
movb $0x1, %al
callq 0x92a82
cmpq %r14, %r15
jb 0x1a0359
movq 0x38(%rbx), %rax
movq 0x10(%rsp), %rcx
imulq %rax, %rcx
cmpq %rcx, %r14
ja 0x1a038a
imulq 0x8(%rsp), %rax
cmpq %r15, %rax
ja 0x1a03bb
movq %r14, %rax
xorl %edx, %edx
divq 0x28(%rbx)
testq %rdx, %rdx
jne 0x1a03e9
movb 0x70(%rbx), %bpl
movq 0x18(%rbx), %rdi
callq 0xad1fa
leaq 0x1b85d3(%rip), %rcx    # 0x35887b
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
cmpb $0x1, %bpl
jne 0x1a02c4
movl $0x159, %r8d            # imm = 0x159
callq 0x8b96c
jmp 0x1a02cf
movl $0x15f, %r8d            # imm = 0x15F
callq 0x8b849
movq %rax, %rcx
movq %rax, (%rbx)
movb $0x1, 0x58(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x50(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x48(%rbx)
movq %r14, %rax
xorl %edx, %edx
divq 0x38(%rbx)
movl 0x40(%rbx), %edx
cmpl $0x2, %edx
je 0x1a030f
cmpl $0x1, %edx
je 0x1a0309
testl %edx, %edx
jne 0x1a0417
shlq $0x3, %rax
jmp 0x1a0313
shlq $0x2, %rax
subq %rax, %rcx
movq %rcx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x297c39(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144cda(%rip), %rsi    # 0x2e5013
leaq 0x1b8506(%rip), %rdx    # 0x358846
leaq 0x1b86dd(%rip), %rcx    # 0x358a24
leaq 0x1b852d(%rip), %r8     # 0x35887b
movl $0x130, %r9d            # imm = 0x130
jmp 0x1a0443
movq 0x297c08(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144ca9(%rip), %rsi    # 0x2e5013
leaq 0x1b86f4(%rip), %rdx    # 0x358a65
leaq 0x1b86ac(%rip), %rcx    # 0x358a24
leaq 0x1b84fc(%rip), %r8     # 0x35887b
movl $0x150, %r9d            # imm = 0x150
jmp 0x1a0443
movq 0x297bd7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144c78(%rip), %rsi    # 0x2e5013
leaq 0x1b86e7(%rip), %rdx    # 0x358a89
leaq 0x1b867b(%rip), %rcx    # 0x358a24
leaq 0x1b84cb(%rip), %r8     # 0x35887b
movl $0x151, %r9d            # imm = 0x151
jmp 0x1a0443
movq 0x297ba6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144c47(%rip), %rsi    # 0x2e5013
leaq 0x1b86f1(%rip), %rdx    # 0x358ac4
leaq 0x1b864a(%rip), %rcx    # 0x358a24
leaq 0x1b849a(%rip), %r8     # 0x35887b
movl $0x152, %r9d            # imm = 0x152
jmp 0x1a0443
movq 0x297b78(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144c19(%rip), %rsi    # 0x2e5013
leaq 0x1b86fb(%rip), %rdx    # 0x358afc
leaq 0x1b861c(%rip), %rcx    # 0x358a24
leaq 0x1b846c(%rip), %r8     # 0x35887b
movl $0x153, %r9d            # imm = 0x153
jmp 0x1a0443
movq 0x297b4a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144beb(%rip), %rsi    # 0x2e5013
leaq 0x1865bd(%rip), %rdx    # 0x3269ec
leaq 0x1b85ee(%rip), %rcx    # 0x358a24
leaq 0x1b843e(%rip), %r8     # 0x35887b
movl $0x16e, %r9d            # imm = 0x16E
xorl %eax, %eax
callq 0x17a50
callq 0x17390