// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/savenet.c
// Function: save_graph_hugin
void save_graph_hugin(bayesiangraphptr mygraph, char *file_name)
{
 /*!Last Changed 11.02.2001*/
 FILE *myfile;
 int i, j, k;
 myfile = fopen(file_name, "w");
	if (!myfile)
		 return;
 for (i = 0; i < mygraph->nodecount; i++)
  {
   fprintf(myfile, "node %s\n", mygraph->nodes[i].name);
   fprintf(myfile, "{ label = \"%s\";\n", mygraph->nodes[i].name);
   fprintf(myfile, "position = (%d %d);\n", mygraph->nodes[i].xpos, mygraph->nodes[i].ypos);
   fprintf(myfile, "states = (");
   for (j = 0; j < mygraph->nodes[i].value_count; j++)
     fprintf(myfile, "\"%s\" ", mygraph->nodes[i].values[j]);
   fprintf(myfile, ");\n}\n\n");
  }
 for (i = 0; i < mygraph->nodecount; i++)
  {
   fprintf(myfile, "potential (%s", mygraph->nodes[i].name);
   if (mygraph->nodes[i].parents > 0)
     fprintf(myfile, " |");
   for (j = 0; j < mygraph->nodes[i].parents; j++)
    {
     k = parent_index(mygraph, i, j);
     fprintf(myfile, "%s ", mygraph->nodes[k].name);
    }
   fprintf(myfile, ")\n{ data = \n");
   for (j = 0; j < mygraph->nodes[i].table_count; j++)
    {
     fprintf(myfile, "( ");
     for (k = 0; k < mygraph->nodes[i].value_count; k++)
       fprintf(myfile, "%4.f ", mygraph->nodes[i].table[j][k]);
     fprintf(myfile, ")\n");
    }
   fprintf(myfile, ";\n}\n\n");
  }
 fclose(myfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x1f219(%rip), %rsi     # 0x9b891
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x7c8bd
movq %rax, %r14
pushq $0x1
popq %r12
leaq 0x24ae9(%rip), %r13     # 0xa1180
xorl %ebp, %ebp
movslq 0x10(%rbx), %rax
cmpq %rax, %rbp
jge 0x7c75f
movq 0x8(%rbx), %rax
imulq $0x48, %rbp, %r15
movq (%rax,%r15), %rdx
movq %r14, %rdi
leaq 0x24a8a(%rip), %rsi     # 0xa1146
xorl %eax, %eax
callq 0x42e0
movq 0x8(%rbx), %rax
movq (%rax,%r15), %rdx
movq %r14, %rdi
leaq 0x24a7a(%rip), %rsi     # 0xa114f
xorl %eax, %eax
callq 0x42e0
movq 0x8(%rbx), %rax
movl 0x40(%rax,%r15), %edx
movl 0x44(%rax,%r15), %ecx
movq %r14, %rdi
leaq 0x24a6c(%rip), %rsi     # 0xa1160
xorl %eax, %eax
callq 0x42e0
leaq 0x24a73(%rip), %rdi     # 0xa1175
pushq $0xa
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x42c0
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
movslq 0x10(%rax,%r15), %rcx
cmpq %rcx, %r12
jge 0x7c73e
addq %r15, %rax
movq 0x8(%rax), %rax
movq (%rax,%r12,8), %rdx
movq %r14, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r12
jmp 0x7c713
leaq 0x24a41(%rip), %rdi     # 0xa1186
pushq $0x6
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
movq %r14, %rcx
callq 0x42c0
incq %rbp
jmp 0x7c699
pushq $0x2
popq %r15
leaq 0x24a44(%rip), %r12     # 0xa11ae
xorl %ecx, %ecx
cltq
cmpq %rax, %rcx
jge 0x7c8a7
movq 0x8(%rbx), %rax
movq %rcx, (%rsp)
imulq $0x48, %rcx, %rbp
movq (%rax,%rbp), %rdx
movq %r14, %rdi
leaq 0x249fc(%rip), %rsi     # 0xa118d
xorl %eax, %eax
callq 0x42e0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x20(%rax,%rbp)
jle 0x7c7b8
leaq 0x249f1(%rip), %rdi     # 0xa119b
movq %r15, %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x42c0
xorl %r13d, %r13d
movq 0x8(%rbx), %rax
cmpl 0x20(%rax,%rbp), %r13d
jge 0x7c7f9
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r13d, %edx
callq 0x47365
movq 0x8(%rbx), %rcx
cltq
imulq $0x48, %rax, %rax
movq (%rcx,%rax), %rdx
movq %r14, %rdi
leaq 0x245c2(%rip), %rsi     # 0xa0daf
xorl %eax, %eax
callq 0x42e0
incl %r13d
jmp 0x7c7bb
leaq 0x2499e(%rip), %rdi     # 0xa119e
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x42c0
xorl %r13d, %r13d
movq 0x8(%rbx), %rax
cmpq %r13, 0x28(%rax,%rbp)
jle 0x7c883
leaq 0x24988(%rip), %rdi     # 0xa11ab
movq %r15, %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x42c0
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movslq 0x10(%rax,%rbp), %rcx
cmpq %rcx, %r15
jge 0x7c865
addq %rbp, %rax
movq 0x38(%rax), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%r15,8), %xmm0
movq %r14, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x42e0
incq %r15
jmp 0x7c834
leaq 0x24538(%rip), %rdi     # 0xa0da4
pushq $0x2
popq %r15
movq %r15, %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x42c0
incq %r13
jmp 0x7c811
leaq 0x248fd(%rip), %rdi     # 0xa1187
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x42c0
movq (%rsp), %rcx
incq %rcx
movl 0x10(%rbx), %eax
jmp 0x7c76c
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq