// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/savenet.c
// Function: save_graph_xml
void save_graph_xml(bayesiangraphptr mygraph, char *file_name)
{
/*!Last Changed 28.12.2000*/
 FILE *myfile;
 int i, j, k, *list, *valuelist;
 myfile = fopen(file_name, "w");
	if (!myfile)
		 return;
 fprintf(myfile, "<ANALYSISNOTEBOOK NAME=\"%s\"\n", mygraph->name);
 fprintf(myfile, "                  ROOT=\"%s\">\n", mygraph->name);
 fprintf(myfile, "   <BNMODEL NAME=\"%s\">\n", mygraph->name);
 fprintf(myfile, "      <STATICPROPERTIES>\n");
 fprintf(myfile, "         <FORMAT VALUE=\"MSR DTAS XML\"/>\n");
 fprintf(myfile, "         <VERSION VALUE=\"0.2\"/>\n");
 fprintf(myfile, "         <CREATOR VALUE=\"Bayesian Learner\"/>\n");
 fprintf(myfile, "      </STATICPROPERTIES>\n");
 fprintf(myfile, "      <VARIABLES>\n");
 for (i = 0; i < mygraph->nodecount; i++)
  {
   fprintf(myfile, "         <VAR NAME=\"%s\" TYPE=\"discrete\" XPOS=\"%d\" YPOS=\"%d\">\n", mygraph->nodes[i].name, mygraph->nodes[i].xpos, mygraph->nodes[i].ypos);
   fprintf(myfile, "            <DESCRIPTION></DESCRIPTION>\n");
   for (j = 0; j < mygraph->nodes[i].value_count; j++)
     fprintf(myfile, "            <STATENAME>%s</STATENAME>\n", mygraph->nodes[i].values[j]);
   fprintf(myfile, "         </VAR>\n");
  }
 fprintf(myfile, "      </VARIABLES>\n");
 fprintf(myfile, "      <STRUCTURE>\n");
 for (i = 0; i < mygraph->nodecount; i++)
   for (j = 0; j < mygraph->nodes[i].parents; j++)
    {
     k = parent_index(mygraph, i, j);
     fprintf(myfile, "         <ARC PARENT=\"%s\" CHILD=\"%s\"/>\n", mygraph->nodes[k].name, mygraph->nodes[i].name);
    }
 fprintf(myfile, "      </STRUCTURE>\n");
 fprintf(myfile, "      <DISTRIBUTIONS>\n");
 for (i = 0; i < mygraph->nodecount; i++)
  {
   fprintf(myfile, "         <DIST TYPE=\"discrete\">\n");
   if (mygraph->nodes[i].parents > 0)
    {
     fprintf(myfile, "            <CONDSET>\n");
     for (j = 0; j < mygraph->nodes[i].parents; j++)
      {
       k = parent_index(mygraph, i, j);
       fprintf(myfile, "               <CONDELEM NAME=\"%s\"/>\n", mygraph->nodes[k].name);
      }
     fprintf(myfile, "            </CONDSET>\n");
    }
   fprintf(myfile, "            <PRIVATE NAME=\"%s\"/>\n", mygraph->nodes[i].name);
   fprintf(myfile, "            <DPIS>\n");
   if (mygraph->nodes[i].parents == 0)
    {
     fprintf(myfile, "               <DPI>");
     for (j = 0; j < mygraph->nodes[i].value_count; j++)
       fprintf(myfile, " %.4f", mygraph->nodes[i].table[0][j]);
     fprintf(myfile, " <\\DPI>\n");
    }
   else
    {
     list = find_parents(mygraph, i);/*Print parents*/
     for (j = 0; j < mygraph->nodes[i].table_count; j++)
      {
       fprintf(myfile, "               <DPI INDEXES=\"");
       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, "</DPI>\n");  
       safe_free(valuelist);
      }
     safe_free(list);
    }
   fprintf(myfile, "            </DPIS>\n");
   fprintf(myfile, "         </DIST>\n");
  }
 fprintf(myfile, "      </DISTRIBUTIONS>\n");
 fprintf(myfile, "   </BNMODEL>\n");
 fprintf(myfile, "</ANALYSISNOTEBOOK>\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 0x2bd50(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xbc483
jmp 0xbcaf1
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x3102e(%rip), %rsi     # 0xed4c3
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x31032(%rip), %rsi     # 0xed4e0
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x31037(%rip), %rsi     # 0xed4fe
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x3103d(%rip), %rsi     # 0xed516
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x31045(%rip), %rsi     # 0xed530
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x3105c(%rip), %rsi     # 0xed559
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x3106b(%rip), %rsi     # 0xed57a
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x31087(%rip), %rsi     # 0xed5a8
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x31090(%rip), %rsi     # 0xed5c3
movb $0x0, %al
callq 0x4280
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbc636
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
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %ecx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rsi
imulq $0x48, %rsi, %rsi
addq %rsi, %rax
movl 0x44(%rax), %r8d
leaq 0x31037(%rip), %rsi     # 0xed5d6
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x31063(%rip), %rsi     # 0xed614
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 0xbc616
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 0x31039(%rip), %rsi     # 0xed63d
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc5bf
movq -0x18(%rbp), %rdi
leaq 0x31043(%rip), %rsi     # 0xed664
movb $0x0, %al
callq 0x4280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbc541
movq -0x18(%rbp), %rdi
leaq 0x31034(%rip), %rsi     # 0xed675
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x31036(%rip), %rsi     # 0xed689
movb $0x0, %al
callq 0x4280
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbc6fe
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 0xbc6ee
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
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
leaq 0x30fc0(%rip), %rsi     # 0xed69c
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc678
jmp 0xbc6f0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbc661
movq -0x18(%rbp), %rdi
leaq 0x30fbb(%rip), %rsi     # 0xed6c4
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x30fbd(%rip), %rsi     # 0xed6d8
movb $0x0, %al
callq 0x4280
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xbcab2
movq -0x18(%rbp), %rdi
leaq 0x30fab(%rip), %rsi     # 0xed6ef
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)
jle 0xbc7f3
movq -0x18(%rbp), %rdi
leaq 0x30f9d(%rip), %rsi     # 0xed710
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 0xbc7e1
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 0x30f58(%rip), %rsi     # 0xed727
movb $0x0, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc781
movq -0x18(%rbp), %rdi
leaq 0x30f61(%rip), %rsi     # 0xed74d
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
movq (%rax), %rdx
leaq 0x30f51(%rip), %rsi     # 0xed765
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x30f61(%rip), %rsi     # 0xed787
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 0xbc8d5
movq -0x18(%rbp), %rdi
leaq 0x30f46(%rip), %rsi     # 0xed79b
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 0xbc8be
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 0x30f04(%rip), %rsi     # 0xed7b0
movb $0x1, %al
callq 0x4280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc863
movq -0x18(%rbp), %rdi
leaq 0x30eed(%rip), %rsi     # 0xed7b6
movb $0x0, %al
callq 0x4280
jmp 0xbca80
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 0xbca77
movq -0x18(%rbp), %rdi
leaq 0x30ea7(%rip), %rsi     # 0xed7bf
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 0xbc9d5
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 0x30af8(%rip), %rsi     # 0xed4bb
movb $0x0, %al
callq 0x4280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbc96e
movq -0x18(%rbp), %rdi
leaq 0x30dfd(%rip), %rsi     # 0xed7dd
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 0xbca4e
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 0x30da4(%rip), %rsi     # 0xed7e0
movb $0x1, %al
callq 0x4280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xbc9ee
movq -0x18(%rbp), %rdi
leaq 0x30d8e(%rip), %rsi     # 0xed7e7
movb $0x0, %al
callq 0x4280
movq -0x38(%rbp), %rdi
callq 0x52e80
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbc8ec
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x18(%rbp), %rdi
leaq 0x30d64(%rip), %rsi     # 0xed7ef
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x30d67(%rip), %rsi     # 0xed804
movb $0x0, %al
callq 0x4280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xbc729
movq -0x18(%rbp), %rdi
leaq 0x30d59(%rip), %rsi     # 0xed816
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x30d5f(%rip), %rsi     # 0xed82e
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
leaq 0x30d5c(%rip), %rsi     # 0xed83d
movb $0x0, %al
callq 0x4280
movq -0x18(%rbp), %rdi
callq 0x4250
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)