// File: /workspace/github_c_makefile_star2_O3/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 0x1ef3c7
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x1ef1e3
callq 0xfdc54
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x1ef208
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 0x1ef227
movq $0x0, (%rbx)
movb $0x1, 0x58(%rbx)
movq %r12, 0x50(%rbx)
movq %r14, 0x48(%rbx)
xorl %ecx, %ecx
jmp 0x1ef3b5
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 0x11b0a1
leaq 0x1f81ed(%rip), %rcx    # 0x3e7459
cmpb $0x0, 0x70(%rbx)
leaq 0x1f81bb(%rip), %r8     # 0x3e7432
cmovneq %rcx, %r8
movq %r15, %rcx
subq %r14, %rcx
leaq 0x1(%rcx), %r12
movsd 0x15a553(%rip), %xmm0   # 0x3497e0
cmpq %r13, %r12
jae 0x1ef2e0
movq %r12, %xmm1
movq 0x158641(%rip), %xmm2   # 0x3478e0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x158645(%rip), %xmm3   # 0x3478f0
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 0x1c92f3(%rip), %rdi    # 0x3b85da
movq %rax, %rsi
movq %r14, %rdx
movq %r15, %rcx
movb $0x1, %al
callq 0x103d72
cmpq %r14, %r15
jb 0x1ef3cc
movq 0x38(%rbx), %rax
movq 0x10(%rsp), %rcx
imulq %rax, %rcx
cmpq %rcx, %r14
ja 0x1ef3d1
imulq 0x8(%rsp), %rax
cmpq %r15, %rax
ja 0x1ef3d6
movq %r14, %rax
xorl %edx, %edx
divq 0x28(%rbx)
testq %rdx, %rdx
jne 0x1ef3db
movb 0x70(%rbx), %bpl
movq 0x18(%rbx), %rdi
callq 0x11b0a1
leaq 0x1c90d0(%rip), %rcx    # 0x3b841b
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
cmpb $0x1, %bpl
jne 0x1ef367
movl $0x159, %r8d            # imm = 0x159
callq 0xfdc1b
jmp 0x1ef372
movl $0x15f, %r8d            # imm = 0x15F
callq 0xfdbac
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 0x1ef3ae
cmpl $0x1, %edx
je 0x1ef3a8
testl %edx, %edx
jne 0x1ef3e0
shlq $0x3, %rax
jmp 0x1ef3b2
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
callq 0x79807
callq 0x797ce
callq 0x79795
callq 0x7975c
callq 0x796ea
callq 0x79723