// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/kdtree.c
// Function: vl_kdforest_query_with_array
vl_size
vl_kdforest_query_with_array (VlKDForest * self,
                              vl_uint32 * indexes,
                              vl_size numNeighbors,
                              vl_size numQueries,
                              void * distances,
                              void const * queries)
{
  vl_size numComparisons = 0;
  vl_type dataType = vl_kdforest_get_data_type(self) ;
  vl_size dimension = vl_kdforest_get_data_dimension(self) ;

#ifdef _OPENMP
#pragma omp parallel default(shared) num_threads(vl_get_max_threads())
#endif
  {
    vl_index qi ;
    vl_size thisNumComparisons = 0 ;
    VlKDForestSearcher * searcher ;
    VlKDForestNeighbor * neighbors ;

#ifdef _OPENMP
#pragma omp critical
#endif
    {
      searcher = vl_kdforest_new_searcher(self) ;
      neighbors = vl_calloc (sizeof(VlKDForestNeighbor), numNeighbors) ;
    }

#ifdef _OPENMP
#pragma omp for
#endif
    for(qi = 0 ; qi < (signed)numQueries; ++ qi) {
      switch (dataType) {
        case VL_TYPE_FLOAT: {
          vl_size ni;
          thisNumComparisons += vl_kdforestsearcher_query (searcher, neighbors, numNeighbors,
                                                           (float const *) (queries) + qi * dimension) ;
          for (ni = 0 ; ni < numNeighbors ; ++ni) {
            indexes [qi*numNeighbors + ni] = (vl_uint32) neighbors[ni].index ;
            if (distances){
              *((float*)distances + qi*numNeighbors + ni) = neighbors[ni].distance ;
            }
          }
          break ;
        }
        case VL_TYPE_DOUBLE: {
          vl_size ni;
          thisNumComparisons += vl_kdforestsearcher_query (searcher, neighbors, numNeighbors,
                                                           (double const *) (queries) + qi * dimension) ;
          for (ni = 0 ; ni < numNeighbors ; ++ni) {
            indexes [qi*numNeighbors + ni] = (vl_uint32) neighbors[ni].index ;
            if (distances){
              *((double*)distances + qi*numNeighbors + ni) = neighbors[ni].distance ;
            }
          }
          break ;
        }
        default:
          abort() ;
      }
    }

#ifdef _OPENMP
#pragma omp critical
#endif
    {
      numComparisons += thisNumComparisons ;
      vl_kdforestsearcher_delete (searcher) ;
      vl_free (neighbors) ;
    }
  }
  return numComparisons ;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x80(%rsp), %rdi
callq 0x93c0
movl %eax, 0x4c(%rsp)
movq 0x80(%rsp), %rdi
callq 0x9b50
movq %rax, 0x40(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x80(%rsp), %rdi
callq 0x9130
movq %rax, 0x28(%rsp)
movq 0x70(%rsp), %rsi
movl $0x10, %edi
callq 0x9a70
movq %rax, 0x20(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x68(%rsp), %rcx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x2df28
movl 0x4c(%rsp), %eax
movl %eax, 0xc(%rsp)
subl $0x1, %eax
je 0x2dd63
jmp 0x2dd51
movl 0xc(%rsp), %eax
subl $0x2, %eax
je 0x2de3c
jmp 0x2df0e
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x38(%rsp), %rax
imulq 0x40(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rcx
callq 0x9320
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x70(%rsp), %rax
jae 0x2de37
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %edx
movq 0x78(%rsp), %rax
movq 0x38(%rsp), %rcx
imulq 0x70(%rsp), %rcx
addq 0x18(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
cmpq $0x0, 0x60(%rsp)
je 0x2de22
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x60(%rsp), %rax
movq 0x38(%rsp), %rcx
imulq 0x70(%rsp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq 0x18(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
jmp 0x2de24
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x2dda1
jmp 0x2df13
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x38(%rsp), %rax
imulq 0x40(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rcx
callq 0x9320
addq 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x70(%rsp), %rax
jae 0x2df0c
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %edx
movq 0x78(%rsp), %rax
movq 0x38(%rsp), %rcx
imulq 0x70(%rsp), %rcx
addq 0x10(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
cmpq $0x0, 0x60(%rsp)
je 0x2def7
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movq 0x60(%rsp), %rax
movq 0x38(%rsp), %rcx
imulq 0x70(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq 0x10(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2def9
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x2de7a
jmp 0x2df13
callq 0x90b0
jmp 0x2df15
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x2dd2c
movq 0x30(%rsp), %rax
addq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x28(%rsp), %rdi
callq 0x91f0
movq 0x20(%rsp), %rdi
callq 0x9620
movq 0x50(%rsp), %rax
addq $0x88, %rsp
retq
nopl (%rax,%rax)