// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dimreduction.c
// Function: dimension_reduction_pca
Instanceptr dimension_reduction_pca(Datasetptr d, Instanceptr traindata, void* parameters, Datasetptr* new_dataset, char* new_dataset_name)
{
 /*!Last Changed 16.01.2008*/
 int howmany = 0;
 matrix eigenvectors, cov;
 double *eigenvalues;
 Instance mean;
 Pca_parameterptr ppca = (Pca_parameterptr) parameters;
 Instanceptr newlist;
 mean = find_mean(traindata);
 cov = covariance(traindata, mean);
 safe_free(mean.values);
 switch (ppca->reduction_type)
  {
   case REDUCTION_TYPE_FEATURE :eigenvalues = find_eigenvalues_eigenvectors_symmetric(&eigenvectors, cov);
                                if (ppca->featurecount <= d->multifeaturecount - 1)
                                  howmany = ppca->featurecount;
                                break;
   case REDUCTION_TYPE_VARIANCE:eigenvalues = find_eigenvalues_eigenvectors(&eigenvectors, cov, &howmany, ppca->variance_explained);
                                break;
  }
 safe_free(eigenvalues);
 newlist = reduce_dimension_of_instancelist(traindata, howmany, eigenvectors);
 *new_dataset = dimension_reduced_dataset(d, howmany + 1, newlist, new_dataset_name);
 matrix_free(eigenvectors);
 matrix_free(cov);
 return newlist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x19b30
movups -0xd0(%rbp), %xmm0
movups -0xc0(%rbp), %xmm1
movups -0xb0(%rbp), %xmm2
movaps %xmm2, -0x70(%rbp)
movaps %xmm1, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movq -0x10(%rbp), %rdi
movaps -0x90(%rbp), %xmm0
movaps -0x80(%rbp), %xmm1
movaps -0x70(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x18040
movq %rax, -0xe0(%rbp)
movq %rdx, -0xd8(%rbp)
movups -0xe0(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x90(%rbp), %rdi
callq 0x52e80
movq -0x98(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xe4(%rbp)
testl %eax, %eax
je 0x2b7b3
jmp 0x2b7a6
movl -0xe4(%rbp), %eax
subl $0x1, %eax
je 0x2b7f0
jmp 0x2b815
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x5fb50
movq %rax, -0x58(%rbp)
movq -0x98(%rbp), %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x2b7ee
movq -0x98(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
jmp 0x2b815
movq -0x98(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rdi
leaq -0x2c(%rbp), %rcx
callq 0x5fba0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x2c810
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
addl $0x1, %esi
movq -0xa0(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x1e1d0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x59ea0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x59ea0
movq -0xa0(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw (%rax,%rax)