// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/graphdata.c
// Function: guess_data
int guess_data(Bndata mydata, bayesiangraphptr mygraph)
{
	/*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 07.03.2001*/
 int i, j, k, pos, value_pos, *parents, *list1, result = 0, maxindex;
 double max;
 for (i = 0; i < mydata.row; i++)
   for (j = 0; j < mydata.col; j++)
    {
     value_pos = mydata.data[i][j];
     if (mygraph->nodes[j].parents)
      {
       parents = find_parents(mygraph, j);
       list1 = safemalloc(mygraph->nodes[j].parents * sizeof(int), "guess_data", 10);
       for (k = 0; k < mygraph->nodes[j].parents; k++)
         list1[k] = mydata.data[i][parents[k]];
       pos = table_pos(mygraph->nodes[j], list1);
       safe_free(parents);
       safe_free(list1);
      }
     else /*No parents*/
       pos = 0;
     max = 0;
     maxindex = -1;
     for (k = 0; k < mygraph->nodes[j].parents; k++)
       if (mygraph->nodes[j].table[pos][k] > max)
        {
         max = mygraph->nodes[j].table[pos][k];
         maxindex = k;
        }
     if (maxindex == value_pos)
       result++;   
    }
 return result;   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x37631
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x37621
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x20(%rax)
je 0x37556
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x70420
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movslq 0x20(%rax), %rdi
shlq $0x2, %rdi
leaq 0xad885(%rip), %rsi     # 0xe4d1e
movl $0xa, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jge 0x374fa
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x38(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x374ae
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x20(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rcx
movq -0x40(%rbp), %rdi
movq 0x40(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x40(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups 0x30(%rcx), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x703b0
movl %eax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
jmp 0x3755d
movl $0x0, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jge 0x37600
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x50(%rbp), %xmm0
jbe 0x375f0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x375f2
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x37573
movl -0x48(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x37611
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x37613
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x37428
jmp 0x37623
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x37415
movl -0x44(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)