// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: nn_ratio
double nn_ratio(Datasetptr d, double *estimate)
{
 /* multiclass is handled by one vs one */
 Instance mean, variance;
 Instanceptr temp, traindata, *nearestneighbors;
 int count, cno1, cno2;
 double result = 0;
 double intraclass = 0, interclass = 0, dist;
 int intranum = 0, internum = 0;
 read_from_train_file(d, &traindata);
 mean = find_mean(traindata);
 variance = find_variance(traindata);
 normalize(traindata, mean, variance);
 type_change(d);
 temp = traindata;
 count = 2;
 while(temp)
  {
   nearestneighbors = find_nearest_neighbors(traindata, temp, count);
   dist = distance_between_instances(nearestneighbors[1], temp);
   cno1 = give_classno(nearestneighbors[1]);
   cno2 = give_classno(temp);
   if (cno1 == cno2)
    {
     intraclass += dist;
     intranum++;
    }
   else
    {
     interclass += dist;
     internum++;
    }
   temp = temp->next;
   safe_free(nearestneighbors);
  }
 result = intraclass / interclass;
 *estimate = (double) internum / (internum + intranum); 
 safe_free(mean.values);
 safe_free(variance.values);
 type_restore(d);
 deallocate(traindata);
 traindata = NULL;
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
movl $0x0, -0xbc(%rbp)
movl $0x0, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x85c60
movq -0x80(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x19b30
leaq -0x40(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x80(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x1a0a0
leaq -0x70(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x80(%rbp), %rdi
movups -0x70(%rbp), %xmm0
movups -0x60(%rbp), %xmm1
movups -0x50(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x50(%rax)
movups %xmm1, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups -0x40(%rbp), %xmm0
movups -0x30(%rbp), %xmm1
movups -0x20(%rbp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x16db0
movq -0x8(%rbp), %rdi
callq 0x22930
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
movl $0x2, -0x8c(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x25226
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movl -0x8c(%rbp), %edx
callq 0x467e0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x78(%rbp), %rsi
callq 0x442e0
movsd %xmm0, -0xb8(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x43530
movl %eax, -0x90(%rbp)
movq -0x78(%rbp), %rdi
callq 0x43530
movl %eax, -0x94(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x94(%rbp), %eax
jne 0x251e2
movsd -0xb8(%rbp), %xmm0
addsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x25209
movsd -0xb8(%rbp), %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x88(%rbp), %rdi
callq 0x52e80
jmp 0x25145
movsd -0xa8(%rbp), %xmm0
divsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
cvtsi2sdl -0xc0(%rbp), %xmm0
movl -0xc0(%rbp), %eax
addl -0xbc(%rbp), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x40(%rbp), %rdi
callq 0x52e80
movq -0x70(%rbp), %rdi
callq 0x52e80
movq -0x8(%rbp), %rdi
callq 0x229e0
movq -0x80(%rbp), %rdi
callq 0x44510
movq $0x0, -0x80(%rbp)
movsd -0xa0(%rbp), %xmm0
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nop