// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/readnet.c
// Function: read_network_bif
bayesiangraphptr read_network_bif(char *f_name)
{
/*!Last Changed 09.02.2001 Commentlere dikkat*/
 FILE *myfile;
 char myline[READLINELENGTH];
 char *st;
 char st1[15];
 int i,pos = -1, ind = -1, parents = 0, currentp, res, prob, noparents;
 int where, table_index, Index, parent_count;
 int parent[MAXPARENT];
 bayesiangraphptr result;
 nodeptr current;
 st1[0] = ' ';
 st1[1] = '\n';
 st1[2] = '{';
 st1[3] = '}';
 st1[4] = '=';
 st1[5] = '(';
 st1[6] = ')';
 st1[7] = '"';
 st1[8] = ';';
 st1[9] = '|';
 st1[10] = '\t';
 st1[11] = '[';
 st1[12] = ']';
 st1[13] = ',';
 st1[14] = '\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, bif_words, 9)) 
      {
       case -1:if ((st[0] == '/') && (st[1] == '/'))
                 goto devam;
               switch (pos) 
                {
                 case -1:
                 case  0:result = create_graph(st);
                         pos = 1;
                         break;
                 case  1:return NULL;
                 case  2:break;
                 case  3:current = add_one_node(result, st);
                         break;
                 case  4:return NULL;
                 case  5:if (ind == -1)
                           ind = 0;
                         else
                           add_one_value(current, st);
                         break;
                 case  6:if (parents == 0)
                          {
                           currentp = node_in(result, st);
                           noparents = 1;
                           if (currentp == -1)
                             return NULL;
                           current = &(result->nodes[currentp]);
                           parents = 1;
                          }
                         else
                           if ((parents == 1) && (isalpha(st[0]) || (noparents)))
                            {
                             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 (parent_count < result->nodes[currentp].parents)
                              {
                               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)
                                {
                                 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);
                                 if (Index + 1 == result->nodes[currentp].value_count)
                                   parent_count = 0;
                                }
                              }
                          }
                         break;
               }
               break;
       case  0:pos = 0; /*network*/
               break;
       case  1:pos = 2; /*property*/
               break;
       case  2:pos = 3; /*variable*/
               break;
       case  3:pos = 4;/*type*/
               break;
       case  4:if (pos == 4) /*discrete*/
                {
                 ind = -1;
                 pos = 5;
                }
               break;
       case  5:pos = 2; /*function*/
               break;
       case  6:pos = 6; /*max*/
               break;
       case  7:pos = 6; /*probability*/
               parents = 0;
               break;
       case  8:noparents = 0; /*table*/
               break;
     }
     st = strtok(NULL, st1);
    }
devam:;
  }
 fclose(myfile);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a218, %rsp          # imm = 0x7A218
movq %rdi, %r15
movabsq $0x2229283d7d7b0a20, %rax # imm = 0x2229283D7D7B0A20
movq %rax, 0x88(%rsp)
movl $0x5b097c3b, 0x90(%rsp) # imm = 0x5B097C3B
movw $0x2c5d, 0x94(%rsp)     # imm = 0x2C5D
movb $0x0, 0x96(%rsp)
leaq 0x3acc1(%rip), %rsi     # 0xab95b
callq 0x40f0
testq %rax, %rax
je 0x711c1
movq %rax, %r13
leaq 0xf0(%rsp), %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
testq %rax, %rax
je 0x711d6
leaq 0xf0(%rsp), %rbp
leaq 0x88(%rsp), %r12
leaq 0x3eaa8(%rip), %r14     # 0xaf788
movq %rax, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movl $0x0, 0x48(%rsp)
movl $0xffffffff, 0x4c(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %r13, 0x98(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4280
testq %rax, %rax
je 0x71190
movq %rax, %rbp
leaq 0x6472a(%rip), %r13     # 0xd5450
movq %rbp, %rdi
movq %r13, %rsi
movl $0x9, %edx
callq 0x3b355
movl %eax, %ebx
leal 0x1(%rbx), %eax
cmpl $0x9, %eax
ja 0x70dc7
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movl $0x2, %ebx
jmp 0x70ea6
movsbq (%rbp), %r13
cmpq $0x2f, %r13
jne 0x70d6c
cmpb $0x2f, 0x1(%rbp)
je 0x71190
leal 0x1(%r15), %eax
cmpl $0x7, %eax
ja 0x70e83
leaq 0x3ea30(%rip), %rcx     # 0xaf7b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbp, %rdi
callq 0x4eade
movq %rax, 0x60(%rsp)
movl $0x1, %ebx
jmp 0x70e9f
movl $0x0, 0x6c(%rsp)
jmp 0x70dc7
cmpl $0x4, %r15d
movl $0x5, %eax
cmovel %eax, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl 0x4c(%rsp), %ecx
cmovel %eax, %ecx
movl %ecx, 0x4c(%rsp)
movl %r15d, %ebx
jmp 0x70ea6
movl $0x3, %ebx
jmp 0x70ea6
movl $0x4, %ebx
jmp 0x70ea6
movl $0x0, 0x48(%rsp)
movl $0x6, %ebx
jmp 0x70ea6
movl $0x5, %ebx
cmpl $-0x1, 0x4c(%rsp)
je 0x70e0e
movq 0x50(%rsp), %rdi
movq %rbp, %rsi
callq 0x4e9e4
movl $0x0, 0x4c(%rsp)
jmp 0x70e9f
movl $0x6, %ebx
movl 0x48(%rsp), %eax
cmpl $0x2, %eax
je 0x70f46
cmpl $0x1, %eax
je 0x70ec4
testl %eax, %eax
jne 0x70e9f
movq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4e464
cmpl $-0x1, %eax
leaq 0x645fc(%rip), %r13     # 0xd5450
je 0x711e5
movl %eax, 0x68(%rsp)
cltq
leaq (%rax,%rax,8), %rax
shlq $0x3, %rax
addq 0x8(%r15), %rax
movq %rax, 0x50(%rsp)
movl $0x1, 0x48(%rsp)
movl $0x1, 0x6c(%rsp)
jmp 0x70ea6
movl %r15d, %ebx
jmp 0x70e9f
movq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x4e5de
movq %rax, 0x50(%rsp)
movl $0x3, %ebx
leaq 0x645aa(%rip), %r13     # 0xd5450
xorl %edi, %edi
movq %r12, %rsi
callq 0x4280
movq %rax, %rbp
movl %ebx, %r15d
testq %rax, %rax
jne 0x70d26
jmp 0x71193
callq 0x41a0
movq (%rax), %rax
movb 0x1(%rax,%r13,2), %al
andb $0x4, %al
shrb $0x2, %al
cmpl $0x0, 0x6c(%rsp)
setne %cl
orb %al, %cl
cmpb $0x1, %cl
movq 0x60(%rsp), %r15
jne 0x70f82
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4e464
cmpl $-0x1, %eax
leaq 0x6454d(%rip), %r13     # 0xd5450
je 0x71066
movq %r15, %rdi
movq %r15, %rbp
movq 0x50(%rsp), %r15
movq %r15, %rsi
movl %eax, %edx
movl %eax, 0x48(%rsp)
callq 0x4e964
movq %rbp, %rdi
callq 0x4e881
movq %rbp, %rdi
movq %r15, %rsi
movl 0x48(%rsp), %edx
callq 0x4e8d5
movl $0x1, 0x48(%rsp)
jmp 0x70ea6
movl 0x5c(%rsp), %edx
testl %edx, %edx
movq 0x78(%rsp), %rcx
je 0x70fb3
movq 0x60(%rsp), %rax
movq 0x8(%rax), %r15
movslq 0x68(%rsp), %rax
leaq (%rax,%rax,8), %r13
movq 0x70(%rsp), %rax
cmpl 0x20(%r15,%r13,8), %eax
jge 0x70fef
movq 0x60(%rsp), %r15
leaq 0x644d3(%rip), %r13     # 0xd5450
jmp 0x710c1
movq 0x50(%rsp), %r15
cmpl $0x0, 0x20(%r15)
leaq 0x644bd(%rip), %r13     # 0xd5450
jne 0x711e5
movq %r15, %rdi
movq %r15, 0x50(%rsp)
callq 0x4e9b8
movl $0x0, 0x6c(%rsp)
xorl %r15d, %r15d
jmp 0x70fbd
leaq 0x64496(%rip), %r13     # 0xd5450
movq %rcx, %r15
movq %rbp, %rdi
callq 0x4130
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movslq %r15d, %r15
movsd %xmm0, (%rax,%r15,8)
incl %r15d
movq %r15, 0x78(%rsp)
movl $0x0, 0x5c(%rsp)
jmp 0x71115
cmpl $0x1, %edx
je 0x71122
leal 0x1(%rcx), %eax
movl %eax, 0x84(%rsp)
movq %rbp, %rdi
movq %rcx, %rbp
callq 0x4130
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq %ebp, %rcx
movsd %xmm0, 0x8(%rax,%rcx,8)
addl $0x2, %ecx
cmpl 0x10(%r15,%r13,8), %ecx
movl $0x0, %eax
movq 0x70(%rsp), %rcx
cmovel %eax, %ecx
movq %rcx, 0x70(%rsp)
movl $0x2, 0x48(%rsp)
movl $0x2, 0x5c(%rsp)
movl 0x84(%rsp), %eax
movq %rax, 0x78(%rsp)
jmp 0x70e9f
xorps %xmm0, %xmm0
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movq 0x50(%rsp), %rdi
callq 0x4e9b8
movq 0x8(%r15), %rax
movslq 0x68(%rsp), %rcx
leaq (%rcx,%rcx,8), %rcx
movq $0x0, 0x70(%rsp)
cmpl $0x0, 0x20(%rax,%rcx,8)
jle 0x7112f
movq $0x0, 0x78(%rsp)
movq %r15, 0x60(%rsp)
movq %r15, %rdi
movl 0x68(%rsp), %esi
movq 0x70(%rsp), %r15
movl %r15d, %edx
callq 0x4e5b4
movq 0x60(%rsp), %rcx
movq 0x8(%rcx), %rcx
cltq
leaq (%rax,%rax,8), %rax
movq 0x8(%rcx,%rax,8), %rsi
movl 0x10(%rcx,%rax,8), %edx
movq %rbp, %rdi
callq 0x3b355
movslq %r15d, %r15
movl %eax, 0xa0(%rsp,%r15,4)
incl %r15d
movq %r15, 0x70(%rsp)
movl $0x1, 0x5c(%rsp)
movl $0x2, 0x48(%rsp)
jmp 0x70ea6
leaq (%r15,%r13,8), %rsi
leaq 0x64323(%rip), %r13     # 0xd5450
jmp 0x71133
leaq (%rax,%rcx,8), %rsi
movl $0x9, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xa0(%rsp), %rdi
callq 0x4e515
movl %eax, %r15d
movq %rbp, %rdi
callq 0x4130
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rax
movl %r15d, 0x80(%rsp)
movslq %r15d, %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq $0x0, 0x78(%rsp)
movl $0x2, 0x48(%rsp)
movl $0x2, 0x5c(%rsp)
jmp 0x70ea6
movl %r15d, %ebx
leaq 0xf0(%rsp), %rbp
movq %rbp, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq 0x98(%rsp), %r13
movq %r13, %rdx
callq 0x4120
movl %ebx, %r15d
testq %rax, %rax
jne 0x70d08
jmp 0x711d6
leaq 0x3e892(%rip), %rdi     # 0xafa5a
movq %r15, %rsi
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4030
jmp 0x711e7
movq %r13, %rdi
callq 0x42a0
movq 0x60(%rsp), %rbx
jmp 0x711e7
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x7a218, %rsp          # imm = 0x7A218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq