// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/savenet.c
// Function: save_graph_bif
void save_graph_bif(bayesiangraphptr mygraph,char *file_name)
{
 /*!Last Changed 11.02.2001*/
 FILE *myfile;
 int i, j, k, *list, *valuelist;
 myfile = fopen(file_name, "w");
	if (!myfile)
		 return;
 fprintf(myfile, "network %s { }\n\n", mygraph->name);
 for (i = 0; i < mygraph->nodecount; i++)
  {
   fprintf(myfile, "variable %s {\n", mygraph->nodes[i].name);
   fprintf(myfile, "type discrete [%d] { ", mygraph->nodes[i].value_count);
   for (j = 0; j < mygraph->nodes[i].value_count - 1; j++)
     fprintf(myfile, "%s, ", mygraph->nodes[i].values[j]);
   fprintf(myfile, "%s };\n}\n\n", mygraph->nodes[i].values[j]);
  }
 for (i = 0; i < mygraph->nodecount; i++)
  {
   fprintf(myfile, "probability (%s", mygraph->nodes[i].name);
   if (mygraph->nodes[i].parents)
    {
     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");
   if (!mygraph->nodes[i].parents)
    {
     fprintf(myfile, "  table ");
     for (j = 0; j < mygraph->nodes[i].value_count - 1; j++)
       fprintf(myfile, " %4.f, ", mygraph->nodes[i].table[0][j]);
     fprintf(myfile, " %4.f;\n", mygraph->nodes[i].table[0][j]);
    }
   else
    {
     list = find_parents(mygraph, i);
     for (j = 0; j < mygraph->nodes[i].table_count; j++)
      {
       fprintf(myfile, "(");
       valuelist = table_list(mygraph->nodes[i], j);
       for (k = 0; k < mygraph->nodes[i].parents - 1; k++)
         fprintf(myfile, " %s,", mygraph->nodes[list[k]].values[valuelist[k]]);
       fprintf(myfile, "%s ) ", mygraph->nodes[list[k]].values[valuelist[k]]);
       for (k = 0; k < mygraph->nodes[i].value_count - 1; k++)
         fprintf(myfile, "%.4f, ", mygraph->nodes[i].table[j][k]);
       fprintf(myfile, "%.4f;\n", mygraph->nodes[i].table[j][k]);
       safe_free(valuelist);
      }
     safe_free(list);
    }
   fprintf(myfile, "}\n\n");
  }
 fclose(myfile); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x2b360(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xbce73
jmp 0xbd37f
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x30a3b(%rip), %rsi     # 0xed8c0
movb $0x0, %al
callq 0x4280
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbcf95
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x30a0d(%rip), %rsi     # 0xed8d1
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
leaq 0x309f4(%rip), %rsi     # 0xed8e0
movb $0x0, %al
callq 0x4280
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xbcf56
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x26f75(%rip), %rsi     # 0xe3eb9
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbcefa
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x30976(%rip), %rsi     # 0xed8f6
movb $0x0, %al
callq 0x4280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbce93
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbd376
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x30933(%rip), %rsi     # 0xed900
movb $0x0, %al
callq 0x4280
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x20(%rax)
je 0xbd068
movq -0x18(%rbp), %rdi
leaq 0x30918(%rip), %rsi     # 0xed910
movb $0x0, %al
callq 0x4280
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jge 0xbd066
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x704c0
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x30467(%rip), %rsi     # 0xed4bb
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbd006
jmp 0xbd068
movq -0x18(%rbp), %rdi
leaq 0x308a1(%rip), %rsi     # 0xed914
movb $0x0, %al
callq 0x4280
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x20(%rax)
jne 0xbd14a
movq -0x18(%rbp), %rdi
leaq 0x30877(%rip), %rsi     # 0xed919
movb $0x0, %al
callq 0x4280
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xbd110
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x30824(%rip), %rsi     # 0xed922
movb $0x1, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbd0b0
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x307ec(%rip), %rsi     # 0xed92a
movb $0x1, %al
callq 0x4280
jmp 0xbd356
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x70420
movq %rax, -0x30(%rbp)
movl $0x0, -0x20(%rbp)
movslq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x28(%rcx), %rax
jge 0xbd34d
movq -0x18(%rbp), %rdi
leaq 0x2fd65(%rip), %rsi     # 0xecef2
movb $0x0, %al
callq 0x4280
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x1c(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rcx
movl -0x20(%rbp), %edi
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 0x70320
movq %rax, -0x38(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
movl 0x20(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xbd24f
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x306f5(%rip), %rsi     # 0xed932
movb $0x0, %al
callq 0x4280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbd1e3
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x306ae(%rip), %rsi     # 0xed937
movb $0x0, %al
callq 0x4280
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xbd2fc
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x30653(%rip), %rsi     # 0xed93d
movb $0x1, %al
callq 0x4280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbd297
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x30615(%rip), %rsi     # 0xed944
movb $0x1, %al
callq 0x4280
movq -0x38(%rbp), %rdi
callq 0x52e80
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbd161
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x18(%rbp), %rdi
leaq 0x30534(%rip), %rsi     # 0xed895
movb $0x0, %al
callq 0x4280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbcf9c
movq -0x18(%rbp), %rdi
callq 0x4250
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)