// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/sampling.c
// Function: get_pagewise_page
static void get_pagewise_page(GtSampling *sampling,
                              GtUword element_num,
                              GtUword *sampled_element,
                              size_t *position)
{
  GtWord start = (GtWord) -1,
         end, middle;

  gt_assert(sampling->numofsamples != 0);
  /* should not overflow, because this is a small table indexing into a larger
     one. */
  gt_safe_assign(end, sampling->numofsamples);
  middle = GT_DIV2(end);
  while (end - start > (GtWord) 1) {
    if (element_num < sampling->page_sampling[middle]) {
      start = middle;
    }
    else {
      end = middle;
    }
    middle = start + GT_DIV2(end - start);
  }
  if (middle < 0) {
    middle = 0;
  }
  *sampled_element =
    sampling->current_sample_elementnum =
    sampling->page_sampling[middle];

  sampling->current_sample_num = (GtUword) middle;

  *position = sampling->samplingtab[middle];
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq $-0x1, 0x30(%rsp)
movq 0x50(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x1d0675
movq 0x46b95c(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3459c5(%rip), %rsi    # 0x516013
leaq 0x394137(%rip), %rdx    # 0x56478c
leaq 0x3941fc(%rip), %rcx    # 0x564858
leaq 0x393e90(%rip), %r8     # 0x5644f3
movl $0xe1, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1d0677
jmp 0x1d0679
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0x1d06d0
cmpq $0x1, 0x18(%rsp)
setb %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x1, 0x10(%rsp)
setl %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1d06d0
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
jmp 0x1d06db
movl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x1d06db
movl 0x8(%rsp), %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0x1d0718
movq 0x46b8af(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34792a(%rip), %rsi    # 0x518025
leaq 0x393df1(%rip), %rdx    # 0x5644f3
movl $0xe4, %ecx
movb $0x0, %al
callq 0x199f0
movl $0x1, %edi
callq 0x19890
jmp 0x1d071a
movq 0x28(%rsp), %rax
sarq %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
subq 0x30(%rsp), %rax
cmpq $0x1, %rax
jle 0x1d0782
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq 0x20(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
jae 0x1d075c
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x1d0766
movq 0x20(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq 0x28(%rsp), %rcx
subq 0x30(%rsp), %rcx
sarq %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
jmp 0x1d0727
cmpq $0x0, 0x20(%rsp)
jge 0x1d0793
movq $0x0, 0x20(%rsp)
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)