// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/network.c
// Function: one_independence_test_indexed
double one_independence_test_indexed(bayesiangraphptr mygraph,int node1, int node2, int given)
{
/*!Last Changed 09.03.2001*/
 int flength=train.row, i, j, k;
 double p1, p2, p3;
 int list1[1], list2[2], list3[3];
 int value_list1[1], value_list2[2], value_list3[3];
 double denom;
	double result = 0;
 double temp;
 if (flength == 0)
   return 0;
 list1[0] = given;
 list3[0] = node1;
 list3[1] = node2;
 list3[2] = given;
 for (k = 0; k < mygraph->nodes[given].value_count; k++)
  {
   value_list1[0]=k;
   denom = count_data(list1,value_list1,1) + (double) 0.0;
   if (denom!=0)
     for (i = 0; i < mygraph->nodes[node1].value_count; i++)
      {
       value_list2[0]=i;
       value_list2[1]=k;
       list2[0]=node1;
       list2[1]=given;
       temp = count_data(list2,value_list2,2) + (double) 0.0;
       p2=temp/denom;
       if (p2!=0)
         for (j = 0; j < mygraph->nodes[node2].value_count; j++)
          {
           value_list3[0]=i;
           value_list3[1]=j;
           value_list3[2]=k;
           temp=count_data(list3,value_list3,3) + (double) 0.0;
           p1 = temp/denom;
           value_list2[0]=j;
           list2[0]=node2;
           temp=count_data(list2,value_list2,2) + (double) 0.0;
           p3=temp/denom;
           if ((p1 != 0) && (p3 != 0))
             result += p1 * log2(p1 / (p2 * p3));
          }
      }
  }
 if (result != 0)
   result = 1 - chi_square((mygraph->nodes[node1].value_count - 1) * (mygraph->nodes[node2].value_count - 1) * (mygraph->nodes[given].value_count - 1) , 2 * result * flength);
 return result;
}

// Assembly:
movl 0x8512f(%rip), %eax     # 0xcd4c0
testl %eax, %eax
je 0x485fe
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, %ebp
movq %rdi, %r15
movl %eax, 0x20(%rsp)
leaq 0x34(%rsp), %rax
movl %ecx, (%rax)
leaq 0x64(%rsp), %rax
movl %esi, (%rax)
movl %edx, 0x4(%rax)
movl %ecx, 0x8(%rax)
movslq %ecx, %rax
movl %esi, 0x28(%rsp)
movslq %esi, %rcx
movl %edx, 0x2c(%rsp)
movslq %edx, %rdx
xorl %ebx, %ebx
imulq $0x48, %rax, %rax
movq %rax, 0x50(%rsp)
imulq $0x48, %rcx, %rax
movq %rax, 0x38(%rsp)
imulq $0x48, %rdx, %r12
xorpd %xmm1, %xmm1
movl %ebp, 0x24(%rsp)
movq 0x8(%r15), %rax
movq 0x50(%rsp), %rcx
movl 0x10(%rax,%rcx), %edi
cmpl %edi, %ebx
jge 0x485a6
movsd %xmm1, 0x8(%rsp)
movl %ebx, 0x30(%rsp)
leaq 0x34(%rsp), %rdi
leaq 0x30(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x23c61
testl %eax, %eax
je 0x48599
cvtsi2sd %eax, %xmm0
movapd %xmm0, 0x70(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0x90(%rsp)
xorl %r14d, %r14d
movsd 0x8(%rsp), %xmm1
movq 0x8(%r15), %rax
movq 0x38(%rsp), %rcx
cmpl 0x10(%rax,%rcx), %r14d
jge 0x4859f
movsd %xmm1, 0x8(%rsp)
movl %r14d, 0x10(%rsp)
movl %ebx, 0x14(%rsp)
movl 0x28(%rsp), %eax
movl %eax, 0x18(%rsp)
movl %ebp, 0x1c(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x2
popq %rdx
callq 0x23c61
cvtsi2sd %eax, %xmm0
divsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
ucomisd 0x4d86e(%rip), %xmm0    # 0x95d18
jne 0x484b2
jnp 0x4858b
xorl %ebp, %ebp
movsd 0x8(%rsp), %xmm1
movq 0x8(%r15), %rax
cmpl 0x10(%rax,%r12), %ebp
jge 0x48585
movsd %xmm1, 0x8(%rsp)
movl %r14d, 0x44(%rsp)
movl %ebp, 0x48(%rsp)
movl %ebx, 0x4c(%rsp)
leaq 0x64(%rsp), %rdi
leaq 0x44(%rsp), %rsi
pushq $0x3
popq %rdx
callq 0x23c61
movl %eax, %r13d
movl %ebp, 0x10(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x18(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x2
popq %rdx
callq 0x23c61
movd %r13d, %xmm0
movd %eax, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtdq2pd %xmm1, %xmm2
divpd 0x90(%rsp), %xmm2
movapd %xmm2, %xmm0
cmpneqpd 0x4d77a(%rip), %xmm0    # 0x95cb0
movmskpd %xmm0, %eax
cmpl $0x3, %eax
jne 0x48578
movsd 0x58(%rsp), %xmm1
mulsd %xmm2, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
movapd %xmm2, 0x80(%rsp)
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
callq 0x34d77
mulsd 0x80(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
jmp 0x4857e
movsd 0x8(%rsp), %xmm1
incl %ebp
jmp 0x484ba
movl 0x24(%rsp), %ebp
jmp 0x48591
movsd 0x8(%rsp), %xmm1
incl %r14d
jmp 0x48451
movsd 0x8(%rsp), %xmm1
incl %ebx
jmp 0x483f8
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x485b2
jnp 0x485eb
movq 0x38(%rsp), %rcx
movl 0x10(%rax,%rcx), %ecx
decl %ecx
movl 0x10(%rax,%r12), %eax
decl %eax
decl %edi
imull %ecx, %edi
imull %eax, %edi
addsd %xmm1, %xmm1
cvtsi2sdl 0x20(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x1d59f
movsd 0x4cf39(%rip), %xmm1    # 0x95520
subsd %xmm0, %xmm1
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x48602
xorpd %xmm1, %xmm1
movapd %xmm1, %xmm0
retq