// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: find_opposite_class_ratio_in_mst
double find_opposite_class_ratio_in_mst(Datasetptr d)
{
 /* usedp=>how many points already used 
    p->array of structures, consisting x,y,& used/not used
    this problem is to get the MST of graph with n vertices
    where weight of an edge is the distance between 2 points */
 int usedp, smallp = -1, opposite_class = 0, i, j, ci, cj;
 matrix lengths;
 int *classes, *used;
 Instanceptr traindata;
 double small, length, minLength=0, result;
 Instance mean, variance;
 read_from_train_file(d, &traindata);
 mean = find_mean(traindata);
 variance = find_variance(traindata);
 normalize(traindata, mean, variance);
 type_change(d);
 classes = find_classes(traindata);
 lengths = distance_matrix(traindata);
 used = safecalloc(d->datacount, sizeof(int), "find_opposite_class_ratio_in_mst", 21);
 used[0] = 1;  /* select arbitrary point as starting point */
 usedp = 1;
 while (usedp < d->datacount) 
  {
   small = -1.0;   
   for (i = 0; i < d->datacount; i++)
    {
     if (used[i])
      {
       for (j = 0; j < d->datacount; j++)
        {
         if (!used[j]) 
          {
           length = lengths.values[i][j];
           if (small == -1.0 || length < small) 
            {
             small = length;
             smallp = j;
             ci = classes[i];
             cj = classes[j];
            }
          }    
        }
      }
    }
   minLength += small;
   used[smallp] = 1;
   usedp++;
   if (ci != cj)
     opposite_class++;
  }
 matrix_free(lengths);
 safe_free(used);
 safe_free(classes);
 safe_free(mean.values);
 safe_free(variance.values);
 result = (double) opposite_class / d->datacount;
 type_restore(d);
 deallocate(traindata);
 traindata = NULL;
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x14(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x85c60
movq -0x50(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x19b30
leaq -0xa0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x50(%rbp), %rsi
leaq -0x130(%rbp), %rdi
callq 0x1a0a0
leaq -0xd0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x50(%rbp), %rdi
movups -0xd0(%rbp), %xmm0
movups -0xc0(%rbp), %xmm1
movups -0xb0(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x50(%rax)
movups %xmm1, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups -0xa0(%rbp), %xmm0
movups -0x90(%rbp), %xmm1
movups -0x80(%rbp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x16db0
movq -0x8(%rbp), %rdi
callq 0x22930
movq -0x50(%rbp), %rdi
callq 0x18500
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rdi
callq 0x172a0
movq %rax, -0x140(%rbp)
movq %rdx, -0x138(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq 0x1407120(%rax), %rdi
movl $0x4, %esi
leaq 0xbefb8(%rip), %rdx     # 0xe437e
movl $0x15, %ecx
callq 0x52f40
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl $0x1, (%rax)
movl $0x1, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1407120(%rcx), %eax
jge 0x25527
movsd 0xbd648(%rip), %xmm0    # 0xe2a48
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1407120(%rcx), %eax
jge 0x254ea
movq -0x48(%rbp), %rax
movslq -0x18(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x254da
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1407120(%rcx), %eax
jge 0x254d8
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x254c8
movq -0x30(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
movsd 0xbd5c8(%rip), %xmm1    # 0xe2a48
ucomisd %xmm1, %xmm0
jne 0x2548a
jp 0x2548a
jmp 0x2549a
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x254c6
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x10(%rbp)
movq -0x40(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x20(%rbp)
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x24(%rbp)
jmp 0x254c8
jmp 0x254ca
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x25438
jmp 0x254da
jmp 0x254dc
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2540c
movsd -0x58(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x48(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x25522
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x253e5
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x59ea0
movq -0x48(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movq -0xa0(%rbp), %rdi
callq 0x52e80
movq -0xd0(%rbp), %rdi
callq 0x52e80
cvtsi2sdl -0x14(%rbp), %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0x1407120(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x8(%rbp), %rdi
callq 0x229e0
movq -0x50(%rbp), %rdi
callq 0x44510
movq $0x0, -0x50(%rbp)
movsd -0x70(%rbp), %xmm0
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq