// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/readnet.c
// Function: read_network_net
bayesiangraphptr read_network_net(char *f_name)
{
/*!Last Changed 24.12.2000*/
 FILE *myfile;
 bayesiangraphptr result;
 nodeptr current;
 int pos, var, parents, prob, res, parent_count, i, Index, where, table_index, currentp;
 int parent[MAXPARENT];
 char myline[READLINELENGTH];
 char *st;
 char st1[7];
 st1[0] = ' ';
 st1[1] = '\n';
 st1[2] = ':';
 st1[3] = '(';
 st1[4] = ')';
 st1[5] = '\t';
 st1[6] = '\0';
 if ((myfile = fopen(f_name, "r")) == NULL)
  {
   printf(m1308, f_name);
   return NULL;
  }
 pos = -1;
 var = 0;
 parents = 0;
 while (fgets(myline, READLINELENGTH, myfile))
  {
   st = strtok(myline, st1);
   while (st)
    {
     switch (listindex(st, net_words, 4)) 
      {
       case -1:switch (pos)
                {
                 case -1:return NULL;
                 case  0:result = create_graph(st);
                         break;
                 case  1:return NULL;
                 case  2:if (var == 0)
                          {
                           current = add_one_node(result, st);
                           var = 1;
                          }
                         else
                           add_one_value(current, st);
                         break;
                 case  3:if (parents == 0)
                          {
                           currentp = node_in(result, st);
                           if (currentp == -1)
                             return NULL;
                           current = &(result->nodes[currentp]);
                           parents = 1;
                          }
                         else
                           if ((parents == 1) && (isalpha(st[0])))
                            {
                             res = node_in(result, st);
                             if (res != -1)
                              {
                               add_parent_counts(result, current, res);
                               add_one_arc(result);
                               add_one_pointer(result, current, res);
                              }
                             else
                              {
                               prob = 1;
                               parent_count = 0;
                               for (i = 0; i < MAXPARENT; i++)
                                 parent[i] = 0;
                               parents = 2;
                               Index = 0;
                               alloc_conditional_table(current);
                              }
                            }
                           else
                             if (parents == 1)
                              {/*No parents*/
                               if (current->parents != 0)
                                 return NULL;
                               parents = 2;
                               prob = 0;
                               Index = 0;
                               alloc_conditional_table(current);
                              }
                         if (parents == 2)
                          {
                           if (prob == 0)/*No parents*/
                            {
                             current->table[0][Index] = (double) atof(st);
                             Index++;
                            }
                           else
                             if (isalpha(st[0]))
                              {
                               prob = 1;
                               where = parent_index(result, currentp, parent_count);
                               parent[parent_count] = listindex(st, result->nodes[where].values, result->nodes[where].value_count);
                               parent_count++;
                              }
                             else
                              {
                               if (prob == 1)
                                {
                                 parent_count = 0;
                                 Index = 0;
                                 table_index = table_pos(result->nodes[currentp], parent);
                                 current->table[table_index][0] = (double) atof(st);
                                 prob = 2;
                                }
                               else
                                {
                                 Index++;
                                 current->table[table_index][Index] = (double) atof(st);
                                }
                              }
                          }
                         break;
                 default:return NULL;
               }
               break;
       case  0:if (pos == -1)
                 pos = 0;
               else
                 return NULL;
               break;
       case  1:if (pos == 0)
                 pos = 1;
               else
                 return NULL;
               break;
       case  2:if (pos == 1)
                 pos = 2;
               else
                 if (pos == 2)
                   var = 0;
                 else
                   return NULL;
               break;
       case  3:if (pos == 2)
                 pos = 3;
               else
                 if (pos == 3)
                   parents = 0;
               break;
       default:return NULL;
     }
     st = strtok(NULL, st1);
    }
  }
 fclose(myfile);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a218, %rsp          # imm = 0x7A218
movq %rdi, %rbx
movl $0x283a0a20, 0x90(%rsp) # imm = 0x283A0A20
movw $0x929, 0x94(%rsp)      # imm = 0x929
movb $0x0, 0x96(%rsp)
leaq 0x334d3(%rip), %rsi     # 0x9b87f
callq 0x40f0
testq %rax, %rax
je 0x687fb
pushq $-0x1
popq %r15
leaq 0xf0(%rsp), %rbx
leaq 0x90(%rsp), %r12
leaq 0x64f3b(%rip), %r13     # 0xcd310
pushq $0x4
popq %rbp
leaq 0x37485(%rip), %r14     # 0x9f864
movl $0x0, 0x5c(%rsp)
movl $0x0, 0x50(%rsp)
movq %rcx, 0x88(%rsp)
movq %rcx, 0x60(%rsp)
movq %rax, 0x98(%rsp)
movq %rbx, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
testq %rax, %rax
je 0x68824
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4280
movq %rax, %rbx
testq %rax, %rax
je 0x687e1
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x35f17
incl %eax
cmpl $0x4, %eax
ja 0x687f6
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
cmpl $0x3, %r15d
je 0x684f9
cmpl $0x2, %r15d
je 0x684e3
testl %r15d, %r15d
jne 0x687f6
movq %rbx, %rdi
callq 0x4783d
movq %rax, 0x70(%rsp)
jmp 0x684d7
cmpl $0x2, %r15d
je 0x68548
cmpl $0x3, %r15d
jne 0x68660
movl $0x0, 0x50(%rsp)
jmp 0x68660
testl %r15d, %r15d
pushq $0x1
popq %r15
je 0x68660
jmp 0x687f6
cmpl $0x1, %r15d
je 0x684df
cmpl $0x2, %r15d
jne 0x687f6
movl $0x0, 0x5c(%rsp)
jmp 0x68660
cmpl $-0x1, %r15d
jne 0x687f6
xorl %r15d, %r15d
jmp 0x68660
pushq $0x2
jmp 0x6854a
cmpl $0x0, 0x5c(%rsp)
je 0x68551
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0x47750
jmp 0x68563
movl 0x50(%rsp), %eax
cmpl $0x2, %eax
je 0x685a6
cmpl $0x1, %eax
movq 0x68(%rsp), %r15
je 0x68573
testl %eax, %eax
jne 0x68548
movq 0x70(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x47224
cmpl $-0x1, %eax
je 0x687f6
movl %eax, 0x84(%rsp)
cltq
imulq $0x48, %rax, %rax
addq 0x8(%r15), %rax
movq %rax, 0x68(%rsp)
jmp 0x6861b
pushq $0x3
popq %r15
jmp 0x68660
movq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0x47398
movq %rax, 0x68(%rsp)
pushq $0x2
popq %r15
pushq $0x1
popq %rax
movl %eax, 0x5c(%rsp)
jmp 0x68660
callq 0x41a0
movq (%rax), %rdx
movsbq (%rbx), %rcx
testb $0x4, 0x1(%rdx,%rcx,2)
jne 0x685d4
cmpl $0x0, 0x20(%r15)
jne 0x687f6
movq %r15, %rdi
callq 0x4772a
movq %r15, 0x68(%rsp)
xorl %r15d, %r15d
jmp 0x68628
movl 0x58(%rsp), %r15d
testl %r15d, %r15d
je 0x68623
callq 0x41a0
cmpl $0x1, %r15d
sete %r8b
movq 0x88(%rsp), %rdx
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %r15
jmp 0x68695
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x47224
cmpl $-0x1, %eax
je 0x68667
movq %r15, %rdi
movq 0x68(%rsp), %rbx
movq %rbx, %rsi
movl %eax, %edx
movl %eax, 0x7c(%rsp)
callq 0x476d6
movq %r15, %rdi
callq 0x47603
movq %r15, %rdi
movq %rbx, %rsi
movl 0x7c(%rsp), %edx
callq 0x47654
pushq $0x3
popq %r15
pushq $0x1
jmp 0x6865b
movq 0x60(%rsp), %r15
movq %rbx, %rdi
callq 0x4130
movq 0x68(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movslq %r15d, %r15
movsd %xmm0, (%rax,%r15,8)
incl %r15d
movq %r15, 0x60(%rsp)
movl $0x0, 0x58(%rsp)
pushq $0x3
popq %r15
pushq $0x2
popq %rax
movl %eax, 0x50(%rsp)
xorl %edi, %edi
jmp 0x68420
xorl %eax, %eax
movq 0x68(%rsp), %r15
cmpq $0x14, %rax
je 0x68681
andl $0x0, 0xa0(%rsp,%rax,4)
incq %rax
jmp 0x6866e
movq %r15, %rdi
callq 0x4772a
xorl %edx, %edx
movb $0x1, %r8b
xorl %edi, %edi
movq 0x50(%rsp), %rax
movq (%rax), %rcx
movsbq (%rbx), %rsi
testb $0x4, 0x1(%rcx,%rsi,2)
jne 0x68727
testb %r8b, %r8b
je 0x6878d
movslq 0x84(%rsp), %rax
imulq $0x48, %rax, %rsi
movq 0x70(%rsp), %rax
addq 0x8(%rax), %rsi
pushq $0x9
popq %rcx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xa0(%rsp), %rdi
callq 0x472d4
movl %eax, 0x80(%rsp)
movq %rbx, %rdi
callq 0x4130
movq 0x38(%r15), %rax
movslq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq $0x0, 0x88(%rsp)
pushq $0x3
popq %r15
pushq $0x2
popq %rax
movl %eax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
jmp 0x68660
movq %rdi, 0x60(%rsp)
movq 0x70(%rsp), %rdi
movl 0x84(%rsp), %esi
movq %rdx, %r15
callq 0x47365
movq 0x70(%rsp), %rcx
movq 0x8(%rcx), %rcx
cltq
imulq $0x48, %rax, %rax
movq 0x8(%rcx,%rax), %rsi
movl 0x10(%rcx,%rax), %edx
movq %rbx, %rdi
callq 0x35f17
movslq %r15d, %r15
movl %eax, 0xa0(%rsp,%r15,4)
incl %r15d
movq %r15, 0x88(%rsp)
pushq $0x3
popq %r15
pushq $0x2
popq %rax
movl %eax, 0x50(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x58(%rsp)
jmp 0x68660
movq %rdx, 0x88(%rsp)
leal 0x1(%rdi), %eax
movl %eax, 0x7c(%rsp)
movq %rdi, 0x60(%rsp)
movq %rbx, %rdi
callq 0x4130
movq 0x38(%r15), %rax
movslq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x60(%rsp), %rcx
movsd %xmm0, 0x8(%rax,%rcx,8)
pushq $0x3
popq %r15
pushq $0x2
popq %rax
movl %eax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movl 0x7c(%rsp), %eax
movq %rax, 0x60(%rsp)
jmp 0x68660
movq 0x98(%rsp), %rax
leaq 0xf0(%rsp), %rbx
jmp 0x68404
xorl %r14d, %r14d
jmp 0x6880f
leaq 0x37178(%rip), %rdi     # 0x9f97a
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4030
movq %r14, %rax
addq $0x7a218, %rsp          # imm = 0x7A218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x98(%rsp), %rdi
callq 0x42a0
movq 0x70(%rsp), %r14
jmp 0x6880f