// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/data.c
// Function: find_variance
Instance find_variance(Instanceptr myptr)
{
 /*!Last Changed 02.02.2004 added safemalloc and safecalloc*/
 /*!Last Changed 18.03.2002*/
 int i, count = data_size(myptr);
 Instanceptr temp = myptr;
 Instance mean;
 Instance result;
 mean=find_mean(myptr);
 if (mustrealize)
  {
   result.values = (union value *)safemalloc(current_dataset->multifeaturecount * sizeof(union value), "find_variance", 8);
   for (i = 0; i < current_dataset->multifeaturecount; i++)
     if (i != current_dataset->classdefno)
       result.values[i].floatvalue = 0;
   while (temp)
    {
     for (i = 0; i < current_dataset->multifeaturecount; i++)
       if (i != current_dataset->classdefno)
         result.values[i].floatvalue += (temp->values[i].floatvalue - mean.values[i].floatvalue) * (temp->values[i].floatvalue-mean.values[i].floatvalue);
     temp = temp->next;
    }
   for (i =0 ; i < current_dataset->multifeaturecount; i++)
     if (i != current_dataset->classdefno)
       result.values[i].floatvalue /= (count - 1);
  }
 else
  {
   result.values = (union value *)safemalloc(current_dataset->featurecount * sizeof(union value), "find_variance", 25);
   for (i = 0; i < current_dataset->featurecount; i++)
     switch (current_dataset->features[i].type)
      {
       case INTEGER:result.values[i].floatvalue = 0;
                    break;
       case    REAL:result.values[i].floatvalue = 0;
                    break;
      }
   while (temp)
    {
     for (i = 0; i < current_dataset->featurecount; i++)
       switch (current_dataset->features[i].type)
        {
         case INTEGER:result.values[i].floatvalue += (temp->values[i].intvalue-mean.values[i].floatvalue) * (temp->values[i].intvalue - mean.values[i].floatvalue);
                      break;
         case    REAL:result.values[i].floatvalue += (temp->values[i].floatvalue-mean.values[i].floatvalue) * (temp->values[i].floatvalue - mean.values[i].floatvalue);
                      break;
        }
     temp=temp->next;
    }
   for (i = 0; i < current_dataset->featurecount; i++)
     switch (current_dataset->features[i].type)
      {
       case INTEGER:result.values[i].floatvalue /= (count - 1);
                    break;
       case    REAL:result.values[i].floatvalue /= (count - 1);
                    break;
      }
  }
 safe_free(mean.values);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x88(%rbp)
movq %rdi, -0x80(%rbp)
movq %rsi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x449f0
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x19b30
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0x30, %edx
callq 0x42b0
leaq 0x3c7e80(%rip), %rax    # 0x3e1f74
cmpl $0x0, (%rax)
je 0x1a2a6
leaq 0xeb73c(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq 0x1c0(%rax), %rdi
shlq $0x3, %rdi
leaq 0xc8f86(%rip), %rsi     # 0xe309f
movl $0x8, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xeb6ff(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0x1a184
movl -0xc(%rbp), %eax
leaq 0xeb6ea(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1407128(%rcx), %eax
je 0x1a177
movq -0x88(%rbp), %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a179
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1a137
jmp 0x1a186
cmpq $0x0, -0x18(%rbp)
je 0x1a23d
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xeb69e(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0x1a22c
movl -0xc(%rbp), %eax
leaq 0xeb689(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1407128(%rcx), %eax
je 0x1a21c
movq -0x88(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq -0x48(%rbp), %rcx
movslq -0xc(%rbp), %rdx
subsd (%rcx,%rdx,8), %xmm0
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm2
movq -0x48(%rbp), %rcx
movslq -0xc(%rbp), %rdx
subsd (%rcx,%rdx,8), %xmm2
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a21e
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1a198
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x1a186
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xeb5f2(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0x1a2a1
movl -0xc(%rbp), %eax
leaq 0xeb5dd(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1407128(%rcx), %eax
je 0x1a294
movq -0x88(%rbp), %rax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cvtsi2sd %ecx, %xmm1
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a296
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1a244
jmp 0x1a559
leaq 0xeb593(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq 0x1bc(%rax), %rdi
shlq $0x3, %rdi
leaq 0xc8ddd(%rip), %rsi     # 0xe309f
movl $0x19, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xeb556(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x1a368
leaq 0xeb544(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x8c(%rbp)
testl %eax, %eax
je 0x1a32a
jmp 0x1a31d
movl -0x8c(%rbp), %eax
subl $0x2, %eax
je 0x1a342
jmp 0x1a358
movq -0x88(%rbp), %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a358
movq -0x88(%rbp), %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a35a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1a2e0
jmp 0x1a36a
cmpq $0x0, -0x18(%rbp)
je 0x1a4a4
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xeb4ba(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x1a493
leaq 0xeb4a4(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x90(%rbp)
testl %eax, %eax
je 0x1a3cd
jmp 0x1a3bd
movl -0x90(%rbp), %eax
subl $0x2, %eax
je 0x1a429
jmp 0x1a483
movq -0x88(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
cvtsi2sdl (%rcx,%rdx,8), %xmm0
movq -0x48(%rbp), %rcx
movslq -0xc(%rbp), %rdx
subsd (%rcx,%rdx,8), %xmm0
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
cvtsi2sdl (%rcx,%rdx,8), %xmm2
movq -0x48(%rbp), %rcx
movslq -0xc(%rbp), %rdx
subsd (%rcx,%rdx,8), %xmm2
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a483
movq -0x88(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq -0x48(%rbp), %rcx
movslq -0xc(%rbp), %rdx
subsd (%rcx,%rdx,8), %xmm0
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm2
movq -0x48(%rbp), %rcx
movslq -0xc(%rbp), %rdx
subsd (%rcx,%rdx,8), %xmm2
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a485
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1a37c
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x1a36a
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xeb38b(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x1a557
leaq 0xeb375(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x94(%rbp)
testl %eax, %eax
je 0x1a4f9
jmp 0x1a4ec
movl -0x94(%rbp), %eax
subl $0x2, %eax
je 0x1a521
jmp 0x1a547
movq -0x88(%rbp), %rax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cvtsi2sd %ecx, %xmm1
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a547
movq -0x88(%rbp), %rax
movl -0x10(%rbp), %ecx
subl $0x1, %ecx
cvtsi2sd %ecx, %xmm1
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1a549
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1a4ab
jmp 0x1a559
movq -0x48(%rbp), %rdi
callq 0x52e80
movq -0x80(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nop