// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dimreduction.c
// Function: determine_neighborhood_k
matrix determine_neighborhood_k(Instanceptr data, int k)
{
 /*!Last Changed 08.04.2008*/
 /*!Last Changed 19.01.2008*/
 int i, j, size;
 double threshold;
 Instanceptr temp1, temp2;
 matrix result;
 size = data_size(data);
 result = matrix_alloc(size, size);
 for (i = 0, temp1 = data; i < size; i++, temp1 = temp1->next)
  {
   threshold = find_k_nearest_neighbor_distance(data, temp1, k);  
   for (j = 0, temp2 = data; j < size; j++, temp2 = temp2->next)
     if (i != j && distance_between_instances(temp1, temp2) < threshold + DBL_DELTA)
       result.values[i][j] = 1;
     else
       result.values[i][j] = 0;
  }
 for (i = 0; i < size; i++)
   for (j = i + 1; j < size; j++)
     if (result.values[i][j] != result.values[j][i])
       result.values[i][j] = result.values[j][i] = 1;
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x449f0
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %edi
movl -0x28(%rbp), %esi
callq 0x57fc0
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x2c42f
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x46cf0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x2c413
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x2c3df
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x442e0
movaps %xmm0, %xmm1
movsd 0xb66bb(%rip), %xmm0    # 0xe2a70
addsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2c3df
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd 0xb5c40(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2c3f7
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2c3f9
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x2c38d
jmp 0x2c415
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x2c35d
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x2c4da
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x2c4ca
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jne 0x2c483
jp 0x2c483
jmp 0x2c4bd
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd 0xb5b7d(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd 0xb5b60(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2c4bf
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2c44b
jmp 0x2c4cc
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c436
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)