// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/bsearch.c
// Function: bsearch_generic
static void* bsearch_generic(GtArray *members, const void *key,
                             const void *base, size_t nmemb, size_t size,
                             GtCompareWithData compar, void *data,
                             GtBittab *b)
{
  char *baseptr = (char *)base, *tmp_ptr,
   *ptr; /* the current element we consider */
  int limit, rval;

  gt_assert(key && size && compar);
  gt_assert(!b || gt_bittab_size(b) == nmemb);

  /* the actual binary search */
  for (limit = nmemb; limit != 0; limit >>= 1) {
    ptr = baseptr + (limit >> 1) * size;
    if ((rval = compar(key, ptr, data)) == 0) {
      /* element found */
      if (members)
        gt_array_add(members, ptr);
      else
        return ptr; /* because we got no <members> array */
      if (b) {
        /* mark found element */
        gt_bittab_set_bit(b, (ptr - (char *)base) / size);
      }
      /* looking left for equal elements */
      for (tmp_ptr = ptr - size;
           tmp_ptr >= (char *)base && !compar(key, tmp_ptr, data);
           tmp_ptr -= size) {
        gt_array_add(members, tmp_ptr);
        if (b)
          gt_bittab_set_bit(
            b, (tmp_ptr - (char *)base) / size); /* mark found element */
      }
      /* looking right for equal elements */
      for (tmp_ptr = ptr + size;
           tmp_ptr <(char *) base + nmemb * size && !compar(key, tmp_ptr, data);
           tmp_ptr += size) {
        gt_array_add(members, tmp_ptr);
        if (b)
          gt_bittab_set_bit(
            b, (tmp_ptr - (char *)base) / size); /* mark found element */
      }
      return ptr;
    }
    if (rval > 0) {
      baseptr = ptr + size;
      limit--;
    }
  }
  return NULL;
}

// Assembly:
subq $0x68, %rsp
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rax
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq %r9, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x10ffae
cmpq $0x0, 0x38(%rsp)
je 0x10ffae
cmpq $0x0, 0x30(%rsp)
jne 0x10ffe6
movq 0xa4023(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x4e0a7(%rip), %rsi     # 0x15e066
leaq 0x74dc1(%rip), %rdx     # 0x184d87
leaq 0x74dd0(%rip), %rcx     # 0x184d9d
leaq 0x74b4d(%rip), %r8      # 0x184b21
movl $0x20, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x10ffe8
jmp 0x10ffea
cmpq $0x0, 0x78(%rsp)
je 0x11003b
movq 0x78(%rsp), %rdi
callq 0x79e90
cmpq 0x40(%rsp), %rax
je 0x11003b
movq 0xa3fce(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x4e052(%rip), %rsi     # 0x15e066
leaq 0x74d92(%rip), %rdx     # 0x184dad
leaq 0x74d7b(%rip), %rcx     # 0x184d9d
leaq 0x74af8(%rip), %r8      # 0x184b21
movl $0x21, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x11003d
movq 0x40(%rsp), %rax
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x110288
movq 0x28(%rsp), %rax
movl 0x14(%rsp), %ecx
sarl %ecx
movslq %ecx, %rcx
imulq 0x38(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x50(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq *%rax
movl %eax, 0x10(%rsp)
cmpl $0x0, %eax
jne 0x110256
cmpq $0x0, 0x58(%rsp)
je 0x1100ae
movq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
jmp 0x1100bd
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x110291
cmpq $0x0, 0x78(%rsp)
je 0x1100e8
movq 0x78(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x38(%rsp)
movq %rax, %rsi
callq 0x78fe0
movq 0x18(%rsp), %rax
xorl %ecx, %ecx
subq 0x38(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rcx
xorl %eax, %eax
cmpq 0x48(%rsp), %rcx
movb %al, 0xf(%rsp)
jb 0x110130
movq 0x30(%rsp), %rax
movq 0x50(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq *%rax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x11013a
jmp 0x110197
movq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
cmpq $0x0, 0x78(%rsp)
je 0x110179
movq 0x78(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x38(%rsp)
movq %rax, %rsi
callq 0x78fe0
jmp 0x11017b
movq 0x38(%rsp), %rdx
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
jmp 0x1100fc
movq 0x18(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rcx
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rax
imulq 0x38(%rsp), %rax
addq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0xe(%rsp)
jae 0x1101eb
movq 0x30(%rsp), %rax
movq 0x50(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq *%rax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x1101f5
jmp 0x11024a
movq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
cmpq $0x0, 0x78(%rsp)
je 0x110234
movq 0x78(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x38(%rsp)
movq %rax, %rsi
callq 0x78fe0
jmp 0x110236
movq 0x38(%rsp), %rax
addq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x1101a6
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x110291
cmpl $0x0, 0x10(%rsp)
jle 0x110277
movq 0x18(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movl 0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x110279
movl 0x14(%rsp), %eax
sarl %eax
movl %eax, 0x14(%rsp)
jmp 0x110046
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nopl (%rax,%rax)