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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x2c1a0(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xbc033
jmp 0xbc447
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x31446(%rip), %rsi     # 0xed48b
movb $0x0, %al
callq 0x4280
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbc109
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 0x31421(%rip), %rsi     # 0xed4a5
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 0x10(%rcx), %eax
jge 0xbc0e9
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 0x313e4(%rip), %rsi     # 0xed4bb
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc092
movq -0x18(%rbp), %rdi
leaq 0x313bb(%rip), %rsi     # 0xed4af
movb $0x0, %al
callq 0x4280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbc053
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbc43e
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 0x31372(%rip), %rsi     # 0xed4b3
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 0xbc1f0
movq -0x18(%rbp), %rdi
leaq 0x30d82(%rip), %rsi     # 0xecef2
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 0x10(%rcx), %eax
jge 0xbc1d9
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 0x3161a(%rip), %rsi     # 0xed7e1
movb $0x1, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc17e
movq -0x18(%rbp), %rdi
leaq 0x312cc(%rip), %rsi     # 0xed4b0
movb $0x0, %al
callq 0x4280
jmp 0xbc42e
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x70420
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x30ce7(%rip), %rsi     # 0xecef2
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 0xbc26f
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movslq -0x20(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x3125e(%rip), %rsi     # 0xed4bb
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc219
movq -0x18(%rbp), %rdi
leaq 0x31245(%rip), %rsi     # 0xed4bf
movb $0x0, %al
callq 0x4280
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 0xbc413
movq -0x18(%rbp), %rdi
leaq 0x30c3e(%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
cmpl 0x20(%rcx), %eax
jge 0xbc371
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 0x3115c(%rip), %rsi     # 0xed4bb
movb $0x0, %al
callq 0x4280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbc30a
movq -0x18(%rbp), %rdi
leaq 0x30feb(%rip), %rsi     # 0xed367
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
cmpl 0x10(%rcx), %eax
jge 0xbc3ea
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 0x31409(%rip), %rsi     # 0xed7e1
movb $0x1, %al
callq 0x4280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbc38a
movq -0x18(%rbp), %rdi
leaq 0x310bb(%rip), %rsi     # 0xed4b0
movb $0x0, %al
callq 0x4280
movq -0x38(%rbp), %rdi
callq 0x52e80
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc288
movq -0x18(%rbp), %rdi
leaq 0x31092(%rip), %rsi     # 0xed4b0
movb $0x0, %al
callq 0x4280
movq -0x30(%rbp), %rdi
callq 0x52e80
jmp 0xbc430
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbc110
movq -0x18(%rbp), %rdi
callq 0x4250
addq $0x80, %rsp
popq %rbp
retq