// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/dimreduction.c
// Function: dimension_reduction_isomap
Instanceptr dimension_reduction_isomap(Datasetptr d, Instanceptr traindata, void* parameters, Datasetptr* new_dataset, char* new_dataset_name)
{
 /*!Last Changed 18.01.2008*/
 int howmany;
 matrix eigenvectors, distancematrix, b;
 double *eigenvalues;
 Isomap_parameterptr pisomap = (Isomap_parameterptr) parameters;
 Instanceptr newlist;
 switch (pisomap->neighborhood_type)
  {
   case NEIGHBORHOOD_TYPE_EPSILON:distancematrix = distance_matrix_with_threshold(traindata, pisomap->epsilon);
                                  break;
   case       NEIGHBORHOOD_TYPE_K:distancematrix = distance_matrix_with_k(traindata, pisomap->k);
                                  break;
  } 
 floyds_all_pairs_shortest_path_algorithm(&distancematrix);
 if (!graph_connected(distancematrix))
  {
   printf(m1393);
   matrix_free(distancematrix);
   return NULL;
  }
 b = multi_dimensional_scaling(distancematrix);
 matrix_free(distancematrix);
 switch (pisomap->ppca.reduction_type)
  {
   case REDUCTION_TYPE_FEATURE :eigenvalues = find_eigenvalues_eigenvectors_symmetric(&eigenvectors, b);
                                howmany = pisomap->ppca.featurecount;
                                break;
   case REDUCTION_TYPE_VARIANCE:eigenvalues = find_eigenvalues_eigenvectors(&eigenvectors, b, &howmany, pisomap->ppca.variance_explained);
                                break;
  }
 matrix_free(b);
 newlist = reduce_dimension_of_instancelist_mds(traindata, howmany, eigenvectors, eigenvalues);
 *new_dataset = dimension_reduced_dataset(d, howmany + 1, newlist, new_dataset_name);
 return newlist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbp
movl 0x24(%rdx), %eax
cmpl $0x1, %eax
je 0x1eac0
testl %eax, %eax
jne 0x1ead6
movsd 0x18(%r13), %xmm0
movq %r12, %rdi
callq 0x10b75
jmp 0x1eacc
movl 0x20(%r13), %esi
movq %r12, %rdi
callq 0x10c1b
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1b2fa
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x1b1a4
testl %eax, %eax
je 0x1eb4b
movq %rbp, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1f636
movq %rax, %rbp
movq %rdx, %rbx
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3ed51
movl 0x10(%r13), %eax
cmpl $0x1, %eax
je 0x1eb6a
testl %eax, %eax
jne 0x1eb88
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x428e9
movq %rax, %r14
movl (%r13), %eax
movl %eax, 0x4(%rsp)
jmp 0x1eb88
leaq 0x88ec2(%rip), %rdi     # 0xa7a14
callq 0x4090
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3ed51
xorl %ebx, %ebx
jmp 0x1ebcd
movsd 0x8(%r13), %xmm0
leaq 0x28(%rsp), %rdi
leaq 0x4(%rsp), %rcx
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x42921
movq %rax, %r14
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3ed51
movl 0x4(%rsp), %esi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %r12, %rdi
movq %r14, %r8
callq 0x1f4ca
movq %rax, %rbx
movl 0x4(%rsp), %esi
incl %esi
movq 0x18(%rsp), %rdi
movq %rax, %rdx
movq %r15, %rcx
callq 0x153ec
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq