// File: /workspace/github_c_makefile_star2_O3/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 $0x7a208, %rsp          # imm = 0x7A208
movq %rdi, %r15
movl $0x283a0a20, 0x70(%rsp) # imm = 0x283A0A20
movw $0x929, 0x74(%rsp)      # imm = 0x929
movb $0x0, 0x76(%rsp)
leaq 0x39c63(%rip), %rsi     # 0xab95b
callq 0x40f0
testq %rax, %rax
je 0x7218f
movq %rax, %rbp
leaq 0xe0(%rsp), %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
testq %rax, %rax
je 0x721a8
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0xe0(%rsp), %r15
leaq 0x3dc09(%rip), %r14     # 0xaf944
movq %rax, 0x58(%rsp)
movq %rax, 0x78(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x54(%rsp)
movq %rbp, 0x88(%rsp)
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x4280
testq %rax, %rax
je 0x7215e
movq %rax, %rbp
movq %r13, %r15
leaq 0x63595(%rip), %r13     # 0xd5310
movq %rbp, %rdi
movq %r13, %rsi
movl $0x4, %edx
callq 0x3b355
incl %eax
cmpl $0x4, %eax
ja 0x721a4
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
cmpl $0x3, %ebx
je 0x71e39
cmpl $0x2, %ebx
je 0x71e25
testl %ebx, %ebx
jne 0x721a4
movq %rbp, %rdi
callq 0x4eade
movq %rax, 0x60(%rsp)
jmp 0x71e14
cmpl $0x2, %ebx
je 0x71e1b
cmpl $0x3, %ebx
jne 0x71eaa
xorl %r12d, %r12d
jmp 0x71eaa
testl %ebx, %ebx
movl $0x1, %ebx
je 0x71eaa
jmp 0x721a4
cmpl $0x1, %ebx
je 0x71ea5
cmpl $0x2, %ebx
jne 0x721a4
movl $0x0, 0x54(%rsp)
jmp 0x71eaa
cmpl $-0x1, %ebx
jne 0x721a4
xorl %ebx, %ebx
jmp 0x71eaa
movl $0x3, %ebx
jmp 0x71eaa
cmpl $0x0, 0x54(%rsp)
je 0x71e8d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4e9e4
jmp 0x71e9d
movl $0x3, %ebx
cmpl $0x2, %r12d
je 0x71f07
movq %r15, %r13
cmpl $0x1, %r12d
je 0x71ec7
testl %r12d, %r12d
jne 0x71f8c
movq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4e464
cmpl $-0x1, %eax
je 0x721a4
movl %eax, 0x6c(%rsp)
cltq
leaq (%rax,%rax,8), %rax
shlq $0x3, %rax
addq 0x8(%r15), %rax
movq %rax, %r15
jmp 0x71fcd
movq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x4e5de
movq %rax, %r15
movl $0x1, 0x54(%rsp)
movl $0x2, %ebx
xorl %edi, %edi
leaq 0x70(%rsp), %rsi
callq 0x4280
movq %rax, %rbp
testq %rax, %rax
jne 0x71d7b
jmp 0x72161
callq 0x41a0
movq %rax, %r15
movq (%rax), %rax
movsbq (%rbp), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x71f91
cmpl $0x0, 0x20(%r13)
jne 0x721a4
movq %r13, %rdi
callq 0x4e9b8
movq %r13, %r12
xorl %r15d, %r15d
leaq 0x6340e(%rip), %r13     # 0xd5310
jmp 0x71fe7
cmpl $0x0, 0x50(%rsp)
je 0x71fdf
callq 0x41a0
movq (%rax), %rax
movsbq (%rbp), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x72018
cmpl $0x1, 0x50(%rsp)
je 0x7207a
movq %r15, %r12
movq 0x58(%rsp), %r15
leal 0x1(%r15), %eax
movl %eax, 0x84(%rsp)
movq %rbp, %rdi
callq 0x4130
movq 0x38(%r12), %rax
movslq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq %r15d, %rcx
movq %r12, %r15
movsd %xmm0, 0x8(%rax,%rcx,8)
movl $0x2, %r12d
movl $0x2, 0x50(%rsp)
movl 0x84(%rsp), %eax
movq %rax, 0x58(%rsp)
jmp 0x71eaa
movq %r13, %r15
jmp 0x71fd3
movq 0x60(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4e464
cmpl $-0x1, %eax
je 0x72022
movq %r12, %rdi
movq %r13, %r15
movq %r13, %rsi
movl %eax, %ebp
movl %eax, %edx
callq 0x4e964
movq %r12, %rdi
callq 0x4e881
movq %r12, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x4e8d5
movl $0x1, %r12d
leaq 0x63336(%rip), %r13     # 0xd5310
jmp 0x71eaa
movq %r15, %r12
movq 0x58(%rsp), %r15
movq %rbp, %rdi
callq 0x4130
movq 0x38(%r12), %rax
movq (%rax), %rax
movslq %r15d, %r15
movsd %xmm0, (%rax,%r15,8)
incl %r15d
movq %r15, 0x58(%rsp)
movl $0x0, 0x50(%rsp)
movq %r12, %r15
jmp 0x72153
movq 0x78(%rsp), %r12
jmp 0x720fc
xorps %xmm0, %xmm0
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movq %r13, %rdi
callq 0x4e9b8
movq (%r15), %rax
movq %r13, %r15
movsbq (%rbp), %rcx
movq $0x0, 0x58(%rsp)
testb $0x4, 0x1(%rax,%rcx,2)
movl $0x0, %r12d
jne 0x720fc
movslq 0x6c(%rsp), %rax
leaq (%rax,%rax,8), %rsi
shlq $0x3, %rsi
movq 0x60(%rsp), %rax
addq 0x8(%rax), %rsi
movl $0x9, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x90(%rsp), %rdi
callq 0x4e515
movq %r15, %r13
movl %eax, %r15d
movq %rbp, %rdi
callq 0x4130
movq 0x38(%r13), %rax
movl %r15d, 0x80(%rsp)
movslq %r15d, %rcx
movq %r13, %r15
leaq 0x63241(%rip), %r13     # 0xd5310
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq $0x0, 0x78(%rsp)
movl $0x2, %r12d
movl $0x2, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
jmp 0x71eaa
movq %r15, %r13
movq 0x60(%rsp), %r15
movq %r15, %rdi
movl 0x6c(%rsp), %esi
movl %r12d, %edx
callq 0x4e5b4
movq 0x8(%r15), %rcx
movq %r13, %r15
leaq 0x631ef(%rip), %r13     # 0xd5310
cltq
leaq (%rax,%rax,8), %rax
movq 0x8(%rcx,%rax,8), %rsi
movl 0x10(%rcx,%rax,8), %edx
movq %rbp, %rdi
callq 0x3b355
movslq %r12d, %r12
movl %eax, 0x90(%rsp,%r12,4)
incl %r12d
movq %r12, 0x78(%rsp)
movl $0x1, 0x50(%rsp)
movl $0x2, %r12d
jmp 0x71eaa
movq %r13, %r15
movq %r15, %r13
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq 0x88(%rsp), %rbp
movq %rbp, %rdx
callq 0x4120
testq %rax, %rax
jne 0x71d58
jmp 0x721a8
leaq 0x3d8c4(%rip), %rdi     # 0xafa5a
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x4030
jmp 0x721b5
xorl %ebx, %ebx
jmp 0x721b5
movq %rbp, %rdi
callq 0x42a0
movq 0x60(%rsp), %rbx
movq %rbx, %rax
addq $0x7a208, %rsp          # imm = 0x7A208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop