// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x68(%rsp)
movl $0x0, 0x5c(%rsp)
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c340
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xc270
testb $0x1, %al
jne 0x1e700
jmp 0x1e722
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c3e0
movq $0x0, 0x90(%rsp)
jmp 0x1e9c7
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c3e0
movl $0x8, %edi
callq 0x75ab0
movq %rax, 0x50(%rsp)
movl $0x8, %edi
callq 0x75ab0
movq %rax, 0x48(%rsp)
callq 0x1cd80
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl $0x97d330, %ecx         # imm = 0x97D330
cqto
idivq %rcx
movq %rdx, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
callq 0x1cd80
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl $0xc350, %ecx           # imm = 0xC350
cqto
idivq %rcx
movq 0x18(%rsp), %rax
addq %rdx, %rax
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c340
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
leaq 0x195f05(%rip), %rcx    # 0x1b46c4
imull $0x3e8, (%rcx), %ecx    # imm = 0x3E8
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x1e854
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x60(%rsp), %rsi
callq 0x75c80
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
callq 0x259f0
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x93c40
testb $0x1, %al
jne 0x1e82b
jmp 0x1e83f
movq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
jmp 0x1e841
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x1e7b3
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c3e0
movq 0x80(%rsp), %rax
movq (%rax), %rdi
movq 0x50(%rsp), %rsi
movq 0x68(%rsp), %r8
leaq 0x142e2f(%rip), %rdx    # 0x1616b0
leaq 0x70(%rsp), %rcx
callq 0x1d890
movq 0x50(%rsp), %rdi
callq 0x76490
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rdi
callq 0x76490
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
je 0x1e8b9
movl $0xffffffff, 0x5c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x5c(%rsp)
jne 0x1e96a
movq 0x48(%rsp), %rdi
leaq 0x110(%rip), %rsi       # 0x1e9e0
callq 0x76620
movq 0x50(%rsp), %rdi
leaq 0xff(%rip), %rsi        # 0x1e9e0
callq 0x76620
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
callq 0x76490
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0x1e968
cmpl $0x0, 0x5c(%rsp)
je 0x1e919
jmp 0x1e968
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x75c80
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x75c80
movq (%rsp), %rdi
movq (%rax), %rsi
callq 0x231d0
testb $0x1, %al
jne 0x1e956
movl $0xffffffff, 0x5c(%rsp) # imm = 0xFFFFFFFF
jmp 0x1e958
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x1e8ef
jmp 0x1e96a
cmpl $0x0, 0x5c(%rsp)
je 0x1e9a7
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c340
movq 0x80(%rsp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1c3e0
movq 0x50(%rsp), %rdi
callq 0x770a0
movq 0x48(%rsp), %rdi
callq 0x770a0
movq $0x0, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nopw (%rax,%rax)