// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: adherentsubsets
double adherentsubsets(Datasetptr d)
{
 /*!Last Changed 09.05.2006 Oya*/
 Instance mean, variance;
 Instanceptr temp, traindata, *nearestneighbors;
 int count = 0, cno1, cno2;
 double result = 0, *order;
 int j, i, sumdifferent, different, *selected, *dataindex;
 matrix allsubsets;
 allsubsets = matrix_alloc(d->datacount, d->datacount);
 initialize_matrix(&allsubsets, 0);
 dataindex = (int *) safecalloc(d->datacount, sizeof(int), "adherentsubsets", 9);
 order = (double *) safecalloc(d->datacount, sizeof(double), "adherentsubsets", 10);
 selected = (int *) safecalloc(d->datacount, sizeof(int), "adherentsubsets", 11);
 read_from_train_file(d, &traindata);
 mean = find_mean(traindata);
 variance = find_variance(traindata);
 normalize(traindata, mean, variance);
 type_change(d);
 temp = traindata;
 j = 0;
 while (temp)
  {
   dataindex[j] = j; 
   cno2 = give_classno(temp);
   allsubsets.values[j][j] = 1;
   nearestneighbors = find_nearest_neighbors(traindata, temp, d->classcounts[cno2] + 1);
   for (i = 1; i < d->classcounts[cno2] + 1; i++)
    {   
     cno1 = give_classno(nearestneighbors[i]);
     if (cno1 == cno2)
      {
       allsubsets.values[j][nearestneighbors[i]->index] = 1;
       order[j] = order[j] + 1; 
      }
     else
      {
       break;
      }
    }
   temp = temp->next;
   j++;
   safe_free(nearestneighbors);
  }
 sort_two_arrays(order, dataindex, d->datacount);
 sumdifferent = 0;
 count = 0;
 for (i = d->datacount - 1; i >= 0; i--)
  {
   different = 0;
   for (j = 0; j < d->datacount; j++)
    {
     if (allsubsets.values[i][j] == 1)
       if (selected[j] == 0)
        {
         selected[j] = 1;
         different++;
        }
     }
   if (different != 0)
     count++;
   sumdifferent += different;
   if (sumdifferent == d->datacount)
     break;
  }
 safe_free(selected);
 safe_free(dataindex);
 safe_free(order);
 safe_free(mean.values);
 safe_free(variance.values);
 matrix_free(allsubsets);
 result = (double) count / d->datacount;
 deallocate(traindata);
 type_restore(d);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movl $0x0, -0x84(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x8(%rbp), %rax
movl 0x1407120(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x1407120(%rax), %esi
callq 0x57fc0
movq %rax, -0xe0(%rbp)
movq %rdx, -0xd8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0xd0(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x5a610
movq -0x8(%rbp), %rax
movslq 0x1407120(%rax), %rdi
movl $0x4, %esi
leaq 0xbe982(%rip), %rdx     # 0xe439f
movl $0x9, %ecx
callq 0x52f40
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rax
movslq 0x1407120(%rax), %rdi
movl $0x8, %esi
leaq 0xbe95a(%rip), %rdx     # 0xe439f
movl $0xa, %ecx
callq 0x52f40
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movslq 0x1407120(%rax), %rdi
movl $0x4, %esi
leaq 0xbe932(%rip), %rdx     # 0xe439f
movl $0xb, %ecx
callq 0x52f40
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x85c60
movq -0x78(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0x19b30
leaq -0x38(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x78(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x1a0a0
leaq -0x68(%rbp), %rdi
leaq -0x140(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
movq -0x78(%rbp), %rdi
movups -0x68(%rbp), %xmm0
movups -0x58(%rbp), %xmm1
movups -0x48(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x50(%rax)
movups %xmm1, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups -0x38(%rbp), %xmm0
movups -0x28(%rbp), %xmm1
movups -0x18(%rbp), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x16db0
movq -0x8(%rbp), %rdi
callq 0x22930
movq -0x78(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0xa4(%rbp)
cmpq $0x0, -0x70(%rbp)
je 0x25ca0
movl -0xa4(%rbp), %edx
movq -0xc0(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rdi
callq 0x43530
movl %eax, -0x8c(%rbp)
movq -0xc8(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0xa4(%rbp), %rcx
movsd 0xbc49b(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movl 0x1407140(%rax,%rcx,4), %edx
addl $0x1, %edx
callq 0x467e0
movq %rax, -0x80(%rbp)
movl $0x1, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x8c(%rbp), %rdx
movl 0x1407140(%rcx,%rdx,4), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x25c77
movq -0x80(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x43530
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jne 0x25c5f
movq -0xc8(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x80(%rbp), %rcx
movslq -0xa8(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0x18(%rcx), %rcx
movsd 0xbc3ee(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
movq -0xa0(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movsd 0xbc3d3(%rip), %xmm0    # 0xe2018
addsd (%rax,%rcx,8), %xmm0
movq -0xa0(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x25c61
jmp 0x25c77
jmp 0x25c63
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x25bb2
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
movq -0x80(%rbp), %rdi
callq 0x52e80
jmp 0x25b2b
movq -0xa0(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x1407120(%rax), %edx
callq 0x539d0
movl $0x0, -0xac(%rbp)
movl $0x0, -0x84(%rbp)
movq -0x8(%rbp), %rax
movl 0x1407120(%rax), %eax
subl $0x1, %eax
movl %eax, -0xa8(%rbp)
cmpl $0x0, -0xa8(%rbp)
jl 0x25de9
movl $0x0, -0xb0(%rbp)
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1407120(%rcx), %eax
jge 0x25d95
movq -0xc8(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0xa4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0xbc2db(%rip), %xmm1    # 0xe2018
ucomisd %xmm1, %xmm0
jne 0x25d7f
jp 0x25d7f
movq -0xb8(%rbp), %rax
movslq -0xa4(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x25d7d
movq -0xb8(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x25d7f
jmp 0x25d81
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x25d05
cmpl $0x0, -0xb0(%rbp)
je 0x25dad
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0xb0(%rbp), %eax
addl -0xac(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1407120(%rcx), %eax
jne 0x25dd3
jmp 0x25de9
jmp 0x25dd5
movl -0xa8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x25ce4
movq -0xb8(%rbp), %rdi
callq 0x52e80
movq -0xc0(%rbp), %rdi
callq 0x52e80
movq -0xa0(%rbp), %rdi
callq 0x52e80
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x68(%rbp), %rdi
callq 0x52e80
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x59ea0
cvtsi2sdl -0x84(%rbp), %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0x1407120(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x78(%rbp), %rdi
callq 0x44510
movq -0x8(%rbp), %rdi
callq 0x229e0
movsd -0x98(%rbp), %xmm0
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nopw %cs:(%rax,%rax)