// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/readnet.c
// Function: read_network_xml
bayesiangraphptr read_network_xml(char *f_name)
{
/*!Last Changed 28.12.2000*/
 FILE *myfile;
 bayesiangraphptr result = NULL;
 char myline[READLINELENGTH];
 char *st;
 char st1[10];
 int anydata = 0, pos = -1, temp, childindex = -1, cond = -1, pcount = -1, pindex;
 int parents[MAXPARENT], parent_values[MAXPARENT];
 nodeptr current;
 st1[0] = ' ';
 st1[1] = '\n';
 st1[2] = '<';
 st1[3] = '>';
 st1[4] = ':';
 st1[5] = '"';
 st1[6] = '/';
 st1[7] = '=';
 st1[8] = '\t';
 st1[9] = '\0';
 if ((myfile = fopen(f_name,"r")) == NULL)
  {
   printf(m1308, f_name);
   return NULL;
  }
 while (fgets(myline, READLINELENGTH, myfile))
  {
   st = strtok(myline, st1);
   while (st)
    {
     switch (listindex(st, xml_words, 28)) 
      {
       case -1:switch (pos){
                 case -1:case  0:case  3:case  5:case  6:
                 case  8:case 10:case 12:case 13:case 14:
                 case 20:case 22:case 23:case 24:case 27:
                 case 28:case 29:case 31:case 33:case 35:
                 case 36:case 37:case 38:case 39:case 42:
                 case 43:case 44:
                 case 45:return NULL;
                 case  1:case  2:case  7:case 11:
                 case 19:anydata = 1;
                         break;
                 case  4:if (!result)
                           result = create_graph(st);
                         break;
                 case  9:if (strcmp(st,"0.2") != 0)
                           return NULL;
                         break;
                 case 15:current = add_one_node(result,st);
                         break;
                 case 16:
                 case 30:if (strcmp(st,"discrete") != 0)
                           return NULL;
                         break;
                 case 17:current->xpos = atoi(st);
                         break;
                 case 18:current->ypos = atoi(st);
                         break;
                 case 21:add_one_value(current, st);
                         break;
                 case 25:pindex = node_in(result, st);
                         if (pindex == -1)
                           return NULL;
                         break;
                 case 26:temp = node_in(result, st);
                         if (temp != -1)
                          {
                           add_parent_counts(result, &result->nodes[temp], pindex);
                           add_one_arc(result);
                           add_one_pointer(result, &result->nodes[temp], pindex);
                          }
                         else
                           return NULL;
                         break;
                 case 32:temp = node_in(result, st);
                         if (temp != -1)
                          {
                           current = &result->nodes[temp];
                           alloc_conditional_table(current);
                          }
                         else
                           return NULL;
                         break;
                 case 34:current->table[0][childindex] = (double) atof(st);
                         childindex++;
                         break;
                 case 40:temp = node_in(result, st);
                         if (temp != -1)
                          {
                           parents[cond] = temp;
                           cond++;
                          }
                         else
                           return NULL;
                         break;
                 case 41:if (pcount < current->parents)
                          {
                           parent_values[pcount] = listindex(st, result->nodes[parents[pcount]].values, result->nodes[parents[pcount]].value_count);
                           pcount++;
                           childindex = 0;
                          }
                         else
                          {
                           if (childindex == 0)
                             pindex = table_pos(*current, parent_values);
                           current->table[pindex][childindex] = (double) atof(st);
                           childindex++;
                          }
                         break;
               };
               break;
       case  0:if (pos == -1)/*ANALYSISNOTEBOOK basliyor*/
                 pos++;
               else
                 if (pos == 44)/*ANALYSISNOTEBOOK bitti*/
                   pos++;
                 else
                   return NULL;
               break;  
       case  1:if (in_list(pos, 5, 0, 3, 14, 31, 39))/*NAME*/
                 pos++;
               else
                 return NULL;
               break;
       case  2:
       case  3:if (((pos == 1) || (pos == 2)) && (anydata))/*ROOT,BNMODEL*/
                {
                 anydata = 0;
                 pos++;
                }
               else
                 if (pos == 43)/*BNMODEL bitti*/
                   pos++;
                 else
                   return NULL;
               break;
       case  4:if (in_list(pos, 2, 4, 11))/*STATICPROPERTIES*/
                 pos++;
               else
                 return NULL;
               break;
       case  5:
       case  7:
       case  8:if (in_list(pos, 3, 5, 7, 9))/*FORMAT,VERSION,CREATOR*/
                 pos++;
               else
                 return NULL;
               break;
       case  6:if (in_list(pos, 3, 6, 8, 10))/*VALUE*/
                {
                 anydata = 0;
                 pos++;
                }
               else
                 return NULL;
               break;
       case  9:if (pos == 12)/*VARIABLES basliyor*/
                 pos++;
               else
                 if (pos == 13)/*VARIABLES bitti*/
                   pos = 22;
                 else
                   return NULL;
               break;
       case 10:if (pos == 13)/*VAR basliyor*/
                 pos++;
               else
                 if (pos == 21)/*VAR bitti*/
                   pos = 13;
                 else
                   return NULL;
               break;
       case 11:if (pos == 15)/*TYPE*/
                 pos++;
               else
                 if (pos == 29)
                   pos++;
                 else
                   return NULL;
               break;
       case 12:if (pos == 16)/*XPOS*/
                 pos++;
               else
                 return NULL;
               break;
       case 13:if (pos == 17)/*YPOS*/
                 pos++;
               else
                 return NULL;
               break;
       case 14:if (in_list(pos, 2, 18, 19))/*DESCRIPTION*/
                 pos++;
               else
                 return NULL;
               break;
       case 15:if (pos == 20)/*STATENAME*/
                 pos++;
               else
                 if (pos == 21)
                   ;
                 else
                   return NULL;
               break;
       case 16:if (pos == 22)/*STRUCTURE basliyor*/
                 pos++;
               else
                 if (pos == 26)/*STRUCTURE bitti*/
                   pos++;
                 else
                   return NULL;
               break;
       case 17:if (pos == 23)/*ARC*/
                 pos++;
               else
                 if (pos == 26)
                   pos = 24;
                 else
                   return NULL;
               break;
       case 18:if (pos == 24)/*PARENT*/
                 pos++;
               else
                 return NULL;
               break;
       case 19:if (pos == 25)/*CHILD*/
                 pos++;
               else
                 return NULL;
               break;
       case 20:if (pos == 27)/*DISTRIBUTIONS basliyor*/
                 pos++;
               else
                 if (pos == 37)/*DISTRIBUTIONS bitti*/
                   pos = 43;
                 else
                   return NULL;
               break;
       case 21:if (in_list(pos, 2, 28, 37))/*DIST basliyor*/
                 pos = 29;
               else
                 if (pos == 36)/*DIST bitti*/
                   pos++;
                 else
                   return NULL;
               break;
       case 22:if (pos == 30)/*PRIVATE*/
                 pos++;
               else
                 return NULL;
               break;
       case 23:if (pos == 32)/*DPIS basliyor*/
                 pos++;
               else
                 if (in_list(pos, 2, 35, 42))/*DPIS bitti*/
                   pos = 36;
                 else
                   return NULL;
               break;
       case 24:if (in_list(pos, 2, 33, 42))/*DPI basliyor*/
                {
                 pos = 34;
                 childindex = 0;
                }
               else
                 if (in_list(pos, 2, 34, 41)) /*DPI bitti*/
                   pos++;
                 else
                   return NULL;
               break;
       case 25:if (pos == 30)/*CONDSET*/
                {
                 pos = 38;
                 cond = 0;
                }
               else
                 if (pos == 40)
                   pos = 30;
                 else
                   return NULL;
               break;
       case 26:if (pos == 38)/*CONDELEM*/
                 pos++;
               else
                 if (pos == 40)
                   pos = 39;
                 else
                   return NULL;
               break;
       case 27:if ((pos == 34) && (cond > 0))/*INDEXES*/
                {
                 pcount = 0;
                 pos = 41;
                }
               else
                 return NULL;
               break;
     }
     st = strtok(NULL, st1);
    }
  }
 fclose(myfile);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a268, %rsp          # imm = 0x7A268
movq %rdi, %rbx
movabsq $0x3d2f223a3e3c0a20, %rax # imm = 0x3D2F223A3E3C0A20
movq %rax, 0x88(%rsp)
movw $0x9, 0x90(%rsp)
leaq 0x33be5(%rip), %rsi     # 0x9b87f
callq 0x40f0
testq %rax, %rax
je 0x6832f
movq %rax, %r14
pushq $-0x1
popq %r15
movq $0x0, 0x60(%rsp)
leaq 0x140(%rsp), %rbx
movq $0x0, 0x80(%rsp)
movl %r15d, %eax
movl %r15d, 0x5c(%rsp)
movl %r15d, 0x6c(%rsp)
movq %rax, 0x50(%rsp)
movq %r14, 0x98(%rsp)
pushq $0x11
popq %r13
movq %rbx, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r14, %rdx
callq 0x4120
testq %rax, %rax
je 0x68360
movq %rbx, %rdi
leaq 0x88(%rsp), %rsi
callq 0x4280
movq %rax, %r14
testq %rax, %rax
je 0x6830f
movq %r14, %rdi
leaq 0x65607(%rip), %rsi     # 0xcd330
pushq $0x1c
popq %rdx
callq 0x35f17
incl %eax
cmpl $0x1c, %eax
ja 0x68092
leaq 0x379f1(%rip), %rcx     # 0x9f734
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
pushq $0x12
popq %r12
pushq $0x1e
popq %rax
pushq $0xd
popq %rcx
pushq $0x29
popq %rsi
pushq $0x22
popq %r8
pushq $0x1a
popq %rdi
pushq $0x19
popq %rbx
pushq $0x15
popq %rbp
jmpq *%rdx
pushq $0x3
popq %rsi
pushq $0x5
popq %rdx
pushq $0x7
popq %rcx
pushq $0x9
jmp 0x67f40
leal -0x1(%r15), %eax
cmpl $0x2, %eax
setb %al
cmpl $0x0, 0x80(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x67da6
incl %r15d
movq $0x0, 0x80(%rsp)
jmp 0x68092
cmpl $0x2b, %r15d
jne 0x68324
pushq $0x2c
jmp 0x68062
cmpl $0xf, %r15d
je 0x6804b
cmpl $0x1d, %r15d
je 0x68056
jmp 0x68324
movl %r8d, %ebx
pushq $0x2
popq %rsi
pushq $0x21
popq %rdx
pushq $0x2a
popq %rcx
movl %r15d, %edi
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x68074
movl %ebx, %r15d
movl $0x0, 0x5c(%rsp)
jmp 0x68092
pushq $0x2
popq %rsi
pushq $0x12
popq %rdx
pushq $0x13
jmp 0x6807c
cmpl $0x20, %r15d
jne 0x6802c
pushq $0x21
jmp 0x68062
cmpl $0xc, %r15d
je 0x67f65
cmpl $0xd, %r15d
jne 0x68324
pushq $0x16
jmp 0x68062
cmpl $0x10, %r15d
movl %r13d, %r15d
je 0x68092
jmp 0x68324
pushq $0x2
popq %rsi
pushq $0x4
popq %rdx
pushq $0xb
jmp 0x6807c
cmpl $0x16, %r15d
je 0x6804f
cmpl $0x1a, %r15d
jne 0x68324
pushq $0x1b
jmp 0x68062
cmpl $0x19, %r15d
movl %edi, %r15d
je 0x68092
jmp 0x68324
cmpl $0x1b, %r15d
je 0x68053
cmpl $0x25, %r15d
jne 0x68324
pushq $0x2b
jmp 0x68062
pushq $0x18
popq %rax
cmpl $0x17, %r15d
je 0x68056
cmpl $0x1a, %r15d
jmp 0x68022
movl $0x27, (%rsp)
pushq $0x5
popq %rsi
pushq $0x3
popq %rcx
pushq $0xe
popq %r8
pushq $0x1f
popq %r9
movl %r15d, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x35812
jmp 0x68087
leal 0x1(%r15), %eax
cmpl $0x2e, %eax
ja 0x68092
leaq 0x378ba(%rip), %rcx     # 0x9f7a8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movl 0x5c(%rsp), %edx
movslq %edx, %r9
jmpq *%rax
pushq $0x1
popq %rax
movq %rax, 0x80(%rsp)
jmp 0x68092
cmpl $-0x1, %r15d
je 0x6805b
cmpl $0x2c, %r15d
jne 0x68324
pushq $0x2d
jmp 0x68062
movq $0x0, 0x80(%rsp)
pushq $0x3
popq %rsi
pushq $0x6
popq %rdx
pushq $0x8
popq %rcx
pushq $0xa
popq %r8
movl %r15d, %edi
xorl %eax, %eax
callq 0x35812
jmp 0x68087
cmpl $0xd, %r15d
je 0x68060
cmpl $0x15, %r15d
jne 0x68324
movl %ecx, %r15d
jmp 0x68092
pushq $0x2
popq %rsi
pushq $0x1c
popq %rdx
pushq $0x25
popq %r14
movl %r15d, %edi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x68099
pushq $0x1d
jmp 0x68062
cmpl $0x11, %r15d
movl %r12d, %r15d
je 0x68092
jmp 0x68324
cmpl $0x18, %r15d
movl %ebx, %r15d
je 0x68092
jmp 0x68324
andl $-0x2, %r15d
cmpl $0x14, %r15d
movl %ebp, %r15d
je 0x68092
jmp 0x68324
cmpl $0x1e, %r15d
jne 0x68324
pushq $0x1f
jmp 0x68062
movq $0x0, 0x50(%rsp)
cmpl $0x22, %r15d
jne 0x68349
movl %esi, %r15d
cmpl $0x0, 0x6c(%rsp)
jg 0x68092
jmp 0x68349
cmpl $0x1e, %r15d
je 0x68066
cmpl $0x28, %r15d
je 0x68056
jmp 0x68324
pushq $0x27
popq %rax
cmpl $0x26, %r15d
je 0x68056
cmpl $0x28, %r15d
movl %eax, %r15d
je 0x68092
jmp 0x68324
pushq $0x2
popq %rsi
pushq $0x23
popq %rdx
pushq $0x2a
popq %rcx
movl %r15d, %edi
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x68324
pushq $0x24
jmp 0x68062
pushq $0x10
jmp 0x68062
pushq $0x17
jmp 0x68062
pushq $0x1c
popq %rax
movl %eax, %r15d
jmp 0x68092
xorl %r15d, %r15d
jmp 0x68092
pushq $0xe
popq %r15
jmp 0x68092
pushq $0x26
popq %r15
movl $0x0, 0x6c(%rsp)
jmp 0x68092
pushq $0x2
popq %rsi
pushq $0x22
popq %rdx
pushq $0x29
popq %rcx
movl %r15d, %edi
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x68324
incl %r15d
xorl %edi, %edi
jmp 0x67d06
cmpl $0x24, %r15d
movl %r14d, %r15d
je 0x68092
jmp 0x68324
leaq 0x31b34(%rip), %rsi     # 0x99be2
movq %r14, %rdi
callq 0x4260
testl %eax, %eax
je 0x68092
jmp 0x68324
movq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x47224
cmpl $-0x1, %eax
je 0x68324
movl 0x6c(%rsp), %edx
movslq %edx, %rcx
movl %eax, 0xf0(%rsp,%rcx,4)
incl %edx
movl %edx, 0x6c(%rsp)
pushq $0x28
jmp 0x68062
movl %edi, %r12d
movq 0x60(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x47224
cmpl $-0x1, %eax
je 0x68324
cltq
imulq $0x48, %rax, %rbx
movq 0x8(%r15), %rsi
addq %rbx, %rsi
movq %r15, %rdi
movl 0x7c(%rsp), %ebp
movl %ebp, %edx
callq 0x476d6
movq %r15, %rdi
callq 0x47603
addq 0x8(%r15), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x47654
jmp 0x68164
movq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x47750
jmp 0x68307
movq %r14, %rdi
callq 0x4200
movq 0x70(%rsp), %rcx
movl %eax, 0x44(%rcx)
movl %r12d, %r15d
jmp 0x68092
leaq 0x3781a(%rip), %rsi     # 0x9f98d
movq %r14, %rdi
callq 0x4260
testl %eax, %eax
jne 0x68324
pushq $0x9
jmp 0x68062
pushq $0x4
popq %r15
cmpq $0x0, 0x60(%rsp)
jne 0x68092
movq %r14, %rdi
callq 0x4783d
movq %rax, 0x60(%rsp)
jmp 0x68092
movq 0x50(%rsp), %rcx
movq 0x70(%rsp), %rax
cmpl 0x20(%rax), %ecx
jge 0x682b7
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movslq %ecx, %rbx
movq %rcx, %r15
movslq 0xf0(%rsp,%rbx,4), %rcx
imulq $0x48, %rcx, %rcx
movl %esi, %ebp
movq 0x8(%rax,%rcx), %rsi
movl 0x10(%rax,%rcx), %edx
movq %r14, %rdi
callq 0x35f17
movl %eax, 0xa0(%rsp,%rbx,4)
incl %r15d
movq %r15, 0x50(%rsp)
movl $0x0, 0x5c(%rsp)
jmp 0x68307
movq %r14, %rdi
movl %edx, %ebx
movl %r8d, %ebp
movq %r9, %r14
callq 0x4130
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movsd %xmm0, (%rax,%r14,8)
jmp 0x68301
movq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x47224
movl %ebx, %r15d
movl %eax, 0x7c(%rsp)
cmpl $-0x1, %eax
jne 0x68092
jmp 0x68324
movq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x47398
movq %rax, 0x70(%rsp)
pushq $0xf
jmp 0x68062
movq %r14, %rdi
callq 0x4200
movq 0x70(%rsp), %rcx
movl %eax, 0x40(%rcx)
movl %r13d, %r15d
jmp 0x68092
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47224
cmpl $-0x1, %eax
je 0x68324
cltq
imulq $0x48, %rax, %rdi
addq 0x8(%rbx), %rdi
movq %rdi, 0x70(%rsp)
callq 0x4772a
pushq $0x20
jmp 0x68062
movq %r9, %r15
movl %esi, %ebp
testl %edx, %edx
movl %edx, %ebx
jne 0x682e1
pushq $0x9
popq %rcx
movq %rsp, %rdi
movq 0x70(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xa0(%rsp), %rdi
callq 0x472d4
movl %eax, 0x7c(%rsp)
movq %r14, %rdi
callq 0x4130
movq 0x70(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x7c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax,%r15,8)
incl %ebx
movl %ebx, 0x5c(%rsp)
movl %ebp, %r15d
jmp 0x68092
movq 0x98(%rsp), %r14
leaq 0x140(%rsp), %rbx
jmp 0x67cea
movq $0x0, 0x50(%rsp)
jmp 0x68349
leaq 0x37644(%rip), %rdi     # 0x9f97a
movq $0x0, 0x50(%rsp)
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4030
movq 0x50(%rsp), %rax
addq $0x7a268, %rsp          # imm = 0x7A268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x42a0
movq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x68349