// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/feature_index.c
// Function: gt_feature_index_unit_test_query
static void* gt_feature_index_unit_test_query(void *data)
{
  GtFeatureIndexTestShared *shm = (GtFeatureIndexTestShared*) data;
  GtRange rng;
  GtError *err = shm->err;
  GtUword i;
  int had_err = 0;
  GtArray *arr, *arr_ref;

  gt_mutex_lock(shm->mutex);
  if (gt_error_is_set(shm->err)) {
    gt_mutex_unlock(shm->mutex);
    return NULL;
  }
  gt_mutex_unlock(shm->mutex);

  arr = gt_array_new(sizeof (GtFeatureNode*));
  arr_ref = gt_array_new(sizeof (GtFeatureNode*));
  rng.start = random() % (GT_FI_TEST_END - GT_FI_TEST_QUERY_WIDTH);
  rng.end = rng.start + random() % (GT_FI_TEST_QUERY_WIDTH);

  /* get reference set by linear search */
  gt_mutex_lock(shm->mutex);
  for (i=0; i<GT_FI_TEST_FEATURES_PER_THREAD * gt_jobs; i++) {
    GtRange rng2;
    GtFeatureNode *fn;
    fn = *(GtFeatureNode**) gt_array_get(shm->nodes, i);
    rng2 = gt_genome_node_get_range((GtGenomeNode*) fn);
    if (gt_range_overlap(&rng, &rng2)) {
      gt_array_add(arr_ref, fn);
    }
  }
  gt_mutex_unlock(shm->mutex);

  /* query feature index */
  gt_feature_index_get_features_for_range(shm->fi, arr, GT_FI_TEST_SEQID, &rng,
                                          err);

  /* result size must be equal */
  if (gt_array_size(arr) != gt_array_size(arr_ref))
    had_err = -1;

  /* nodes must be the same (note that we should not rely on ptr equality) */
  if (!had_err) {
    gt_array_sort(arr_ref, cmp_range_start);
    gt_array_sort(arr    , cmp_range_start);

    for (i=0;i<gt_array_size(arr);i++) {
      if (had_err)
        break;
      if (!gt_feature_node_is_similar(*(GtFeatureNode**) gt_array_get(arr, i),
                                      *(GtFeatureNode**)
                                      gt_array_get(arr_ref, i))) {
        had_err = -1;
      }
    }
  }

  if (had_err) {
    gt_mutex_lock(shm->mutex);
    shm->error_count++;
    gt_mutex_unlock(shm->mutex);
  }

  gt_array_delete(arr);
  gt_array_delete(arr_ref);
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq 0x18(%rdi), %rdi
callq 0x3d9b7
movq 0x8(%rbx), %rdi
callq 0x3566a
movl %eax, %ebp
movq 0x18(%rbx), %rdi
callq 0x3d9d2
testb %bpl, %bpl
jne 0x3ee10
movq %r14, 0x8(%rsp)
movl $0x8, %edi
callq 0x6e93c
movq %rax, %r14
movl $0x8, %edi
callq 0x6e93c
movq %rax, (%rsp)
callq 0x3dd98
movl %eax, %r12d
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andl %ebp, %r12d
imulq $0x6be9eb99, %r12, %rax # imm = 0x6BE9EB99
shrq $0x36, %rax
imull $0x97d330, %eax, %eax   # imm = 0x97D330
subl %eax, %r12d
movq %r12, 0x18(%rsp)
callq 0x3dd98
andl %ebp, %eax
imulq $0x14f8b589, %rax, %rcx # imm = 0x14F8B589
shrq $0x2c, %rcx
imull $0xc350, %ecx, %ecx     # imm = 0xC350
subl %ecx, %eax
addl %r12d, %eax
movq %rax, 0x20(%rsp)
movq 0x18(%rbx), %rdi
callq 0x3d9b7
leaq 0x112a1b(%rip), %r15    # 0x1516e4
imull $0x3e8, (%r15), %eax    # imm = 0x3E8
testl %eax, %eax
je 0x3ed35
xorl %r13d, %r13d
leaq 0x18(%rsp), %rbp
leaq 0x28(%rsp), %r12
movq 0x10(%rbx), %rdi
movq %r13, %rsi
callq 0x6e9fa
movq (%rax), %rdi
movq %rdi, 0x10(%rsp)
callq 0x41f83
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7e06e
testb %al, %al
je 0x3ed26
movl $0x8, %edx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6ec0e
incq %r13
imull $0x3e8, (%r15), %eax    # imm = 0x3E8
cmpq %rax, %r13
jb 0x3ece1
movq 0x18(%rbx), %rdi
callq 0x3d9d2
movq (%rbx), %rdi
leaq 0xa5918(%rip), %rdx     # 0xe4660
leaq 0x18(%rsp), %rcx
movq %r14, %rsi
movq 0x8(%rsp), %r8
callq 0x3e39c
movq %r14, %rdi
callq 0x6ecda
movq %rax, %r12
movq (%rsp), %rdi
callq 0x6ecda
cmpq %rax, %r12
jne 0x3ede9
leaq 0xa7(%rip), %r12        # 0x3ee21
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x6ed27
movq %r14, %rdi
movq %r12, %rsi
callq 0x6ed27
movq %r14, %rdi
callq 0x6ecda
testq %rax, %rax
je 0x3edff
movl $0x1, %r15d
leaq -0x1(%r15), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x6e9fa
movq (%rax), %r13
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x6e9fa
movq (%rax), %rsi
movq %r13, %rdi
callq 0x40ee4
movl %eax, %ebp
movq %r14, %rdi
callq 0x6ecda
cmpq %rax, %r15
jae 0x3ede4
incq %r15
testb %bpl, %bpl
jne 0x3eda4
testb %bpl, %bpl
jne 0x3edff
movq 0x18(%rbx), %rdi
callq 0x3d9b7
incq 0x28(%rbx)
movq 0x18(%rbx), %rdi
callq 0x3d9d2
movq %r14, %rdi
callq 0x6f134
movq (%rsp), %rdi
callq 0x6f134
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq