// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x21e67(%rip), %rsi     # 0xab96d
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x89db7
movq %rax, %r14
cmpl $0x0, 0x10(%rbx)
jle 0x89da1
leaq 0x276f1(%rip), %r15     # 0xb121c
xorl %r13d, %r13d
movq 0x8(%rbx), %rax
leaq (,%r13,8), %rcx
leaq (%rcx,%rcx,8), %rbp
movq (%rax,%rbp), %rdx
movq %r14, %rdi
leaq 0x27696(%rip), %rsi     # 0xb11e2
xorl %eax, %eax
callq 0x42e0
movq 0x8(%rbx), %rax
movq (%rax,%rbp), %rdx
movq %r14, %rdi
leaq 0x27686(%rip), %rsi     # 0xb11eb
xorl %eax, %eax
callq 0x42e0
movq 0x8(%rbx), %rax
movl 0x40(%rax,%rbp), %edx
movl 0x44(%rax,%rbp), %ecx
movq %r14, %rdi
leaq 0x2767a(%rip), %rsi     # 0xb11fc
xorl %eax, %eax
callq 0x42e0
movl $0xa, %esi
movl $0x1, %edx
leaq 0x27677(%rip), %rdi     # 0xb1211
movq %r14, %rcx
callq 0x42c0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x10(%rax,%rbp)
jle 0x89bd7
xorl %r12d, %r12d
movq 0x8(%rax,%rbp), %rax
movq (%rax,%r12,8), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r12
movq 0x8(%rbx), %rax
movslq 0x10(%rax,%rbp), %rcx
cmpq %rcx, %r12
jl 0x89bb0
movl $0x6, %esi
movl $0x1, %edx
leaq 0x2763a(%rip), %rdi     # 0xb1222
movq %r14, %rcx
callq 0x42c0
incq %r13
movslq 0x10(%rbx), %rax
cmpq %rax, %r13
jl 0x89b2e
testl %eax, %eax
jle 0x89da1
leaq 0x2763b(%rip), %r15     # 0xb124a
xorl %ecx, %ecx
movq %rcx, 0x8(%rsp)
movq 0x8(%rbx), %rax
leaq (,%rcx,8), %rcx
leaq (%rcx,%rcx,8), %rbp
movq (%rax,%rbp), %rdx
movq %r14, %rdi
leaq 0x275f5(%rip), %rsi     # 0xb1229
xorl %eax, %eax
callq 0x42e0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x20(%rax,%rbp)
jle 0x89cb4
movl $0x2, %esi
movl $0x1, %edx
leaq 0x275e0(%rip), %rdi     # 0xb1237
movq %r14, %rcx
callq 0x42c0
movq 0x8(%rbx), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rcx,8), %r13
cmpl $0x0, 0x20(%rax,%r13,8)
jle 0x89cb4
xorl %r12d, %r12d
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movl %r12d, %edx
callq 0x4e5b4
movq 0x8(%rbx), %rcx
cltq
leaq (%rax,%rax,8), %rax
movq (%rcx,%rax,8), %rdx
movq %r14, %rdi
leaq 0x271ac(%rip), %rsi     # 0xb0e4b
xorl %eax, %eax
callq 0x42e0
incl %r12d
movq 0x8(%rbx), %rax
cmpl 0x20(%rax,%r13,8), %r12d
jl 0x89c77
movl $0xc, %esi
movl $0x1, %edx
leaq 0x27575(%rip), %rdi     # 0xb123a
movq %r14, %rcx
callq 0x42c0
movq 0x8(%rbx), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rcx,8), %r12
cmpq $0x0, 0x28(%rax,%r12,8)
jle 0x89d73
xorl %r13d, %r13d
movq %r12, 0x10(%rsp)
movl $0x2, %esi
movl $0x1, %edx
leaq 0x27548(%rip), %rdi     # 0xb1247
movq %r14, %rcx
callq 0x42c0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x10(%rax,%r12,8)
jle 0x89d43
xorl %r12d, %r12d
movq 0x38(%rax,%rbp), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x42e0
incq %r12
movq 0x8(%rbx), %rax
movslq 0x10(%rax,%rbp), %rcx
cmpq %rcx, %r12
jl 0x89d16
movl $0x2, %esi
movl $0x1, %edx
leaq 0x270ec(%rip), %rdi     # 0xb0e40
movq %r14, %rcx
callq 0x42c0
incq %r13
movq 0x8(%rbx), %rax
movq 0x10(%rsp), %r12
cmpq %r13, 0x28(%rax,%r12,8)
jg 0x89cee
movl $0x5, %esi
movl $0x1, %edx
leaq 0x2749f(%rip), %rdi     # 0xb1223
movq %r14, %rcx
callq 0x42c0
movq 0x8(%rsp), %rcx
incq %rcx
movslq 0x10(%rbx), %rax
cmpq %rax, %rcx
jl 0x89c11
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq