// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7a250, %rsp          # imm = 0x7A250
movq %rdi, -0x10(%rbp)
movl $0xffffffff, -0x7a160(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x7a164(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x7a168(%rbp)
movb $0x20, -0x7a157(%rbp)
movb $0xa, -0x7a156(%rbp)
movb $0x7b, -0x7a155(%rbp)
movb $0x7d, -0x7a154(%rbp)
movb $0x3d, -0x7a153(%rbp)
movb $0x28, -0x7a152(%rbp)
movb $0x29, -0x7a151(%rbp)
movb $0x22, -0x7a150(%rbp)
movb $0x3b, -0x7a14f(%rbp)
movb $0x7c, -0x7a14e(%rbp)
movb $0x9, -0x7a14d(%rbp)
movb $0x5b, -0x7a14c(%rbp)
movb $0x5d, -0x7a14b(%rbp)
movb $0x2c, -0x7a14a(%rbp)
movb $0x0, -0x7a149(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x49cd5(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x9e4ff
movq -0x10(%rbp), %rsi
leaq 0x4dc93(%rip), %rdi     # 0xec17e
movb $0x0, %al
callq 0x4030
movq $0x0, -0x8(%rbp)
jmp 0x9eb1b
jmp 0x9e501
leaq -0x7a140(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x9eb07
leaq -0x7a140(%rbp), %rdi
leaq -0x7a157(%rbp), %rsi
callq 0x4230
movq %rax, -0x7a148(%rbp)
cmpq $0x0, -0x7a148(%rbp)
je 0x9eb00
movq -0x7a148(%rbp), %rdi
leaq 0x66eca(%rip), %rsi     # 0x105420
movl $0x9, %edx
callq 0x54910
incl %eax
movl %eax, %ecx
movq %rcx, -0x7a1f8(%rbp)
subl $0x9, %eax
ja 0x9eae4
movq -0x7a1f8(%rbp), %rax
leaq 0x4d916(%rip), %rcx     # 0xebe98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x7a148(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x9e5af
movq -0x7a148(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2f, %eax
jne 0x9e5af
jmp 0x9eb02
movl -0x7a160(%rbp), %eax
incl %eax
movl %eax, %ecx
movq %rcx, -0x7a200(%rbp)
subl $0x7, %eax
ja 0x9ea58
movq -0x7a200(%rbp), %rax
leaq 0x4d8e9(%rip), %rcx     # 0xebec0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x7a148(%rbp), %rdi
callq 0x70f80
movq %rax, -0x7a1e8(%rbp)
movl $0x1, -0x7a160(%rbp)
jmp 0x9ea58
movq $0x0, -0x8(%rbp)
jmp 0x9eb1b
jmp 0x9ea58
movq -0x7a1e8(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x70530
movq %rax, -0x7a1f0(%rbp)
jmp 0x9ea58
movq $0x0, -0x8(%rbp)
jmp 0x9eb1b
cmpl $-0x1, -0x7a164(%rbp)
jne 0x9e655
movl $0x0, -0x7a164(%rbp)
jmp 0x9e668
movq -0x7a1f0(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x70d80
jmp 0x9ea58
cmpl $0x0, -0x7a168(%rbp)
jne 0x9e6de
movq -0x7a1e8(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x702b0
movl %eax, -0x7a16c(%rbp)
movl $0x1, -0x7a178(%rbp)
cmpl $-0x1, -0x7a16c(%rbp)
jne 0x9e6af
movq $0x0, -0x8(%rbp)
jmp 0x9eb1b
movq -0x7a1e8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x7a16c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x7a1f0(%rbp)
movl $0x1, -0x7a168(%rbp)
jmp 0x9e83a
cmpl $0x1, -0x7a168(%rbp)
jne 0x9e7e9
callq 0x4160
movq (%rax), %rax
movq -0x7a148(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x9e71b
cmpl $0x0, -0x7a178(%rbp)
je 0x9e7e9
movq -0x7a1e8(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x702b0
movl %eax, -0x7a170(%rbp)
cmpl $-0x1, -0x7a170(%rbp)
je 0x9e77d
movq -0x7a1e8(%rbp), %rdi
movq -0x7a1f0(%rbp), %rsi
movl -0x7a170(%rbp), %edx
callq 0x70c80
movq -0x7a1e8(%rbp), %rdi
callq 0x70a70
movq -0x7a1e8(%rbp), %rdi
movq -0x7a1f0(%rbp), %rsi
movl -0x7a170(%rbp), %edx
callq 0x70b20
jmp 0x9e7e7
movl $0x1, -0x7a174(%rbp)
movl $0x0, -0x7a188(%rbp)
movl $0x0, -0x7a15c(%rbp)
cmpl $0x14, -0x7a15c(%rbp)
jge 0x9e7c7
movslq -0x7a15c(%rbp), %rax
movl $0x0, -0x7a1e0(%rbp,%rax,4)
movl -0x7a15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a15c(%rbp)
jmp 0x9e79b
movl $0x2, -0x7a168(%rbp)
movl $0x0, -0x7a184(%rbp)
movq -0x7a1f0(%rbp), %rdi
callq 0x70d30
jmp 0x9e838
cmpl $0x1, -0x7a168(%rbp)
jne 0x9e836
movq -0x7a1f0(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x9e80c
movq $0x0, -0x8(%rbp)
jmp 0x9eb1b
movl $0x2, -0x7a168(%rbp)
movl $0x0, -0x7a174(%rbp)
movl $0x0, -0x7a184(%rbp)
movq -0x7a1f0(%rbp), %rdi
callq 0x70d30
jmp 0x9e838
jmp 0x9e83a
cmpl $0x2, -0x7a168(%rbp)
jne 0x9ea56
cmpl $0x0, -0x7a174(%rbp)
jne 0x9e88a
movq -0x7a148(%rbp), %rdi
callq 0x4100
movq -0x7a1f0(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movslq -0x7a184(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x7a184(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a184(%rbp)
jmp 0x9ea54
movl -0x7a188(%rbp), %eax
movq -0x7a1e8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x7a16c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jge 0x9e943
movl $0x1, -0x7a174(%rbp)
movq -0x7a1e8(%rbp), %rdi
movl -0x7a16c(%rbp), %esi
movl -0x7a188(%rbp), %edx
callq 0x704c0
movl %eax, -0x7a17c(%rbp)
movq -0x7a148(%rbp), %rdi
movq -0x7a1e8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x7a17c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x7a1e8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x7a17c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
callq 0x54910
movl %eax, %ecx
movslq -0x7a188(%rbp), %rax
movl %ecx, -0x7a1e0(%rbp,%rax,4)
movl -0x7a188(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a188(%rbp)
jmp 0x9ea52
cmpl $0x1, -0x7a174(%rbp)
jne 0x9e9e0
movl $0x0, -0x7a184(%rbp)
movq -0x7a1e8(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x7a16c(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rcx
leaq -0x7a1e0(%rbp), %rdi
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 0x703b0
movl %eax, -0x7a180(%rbp)
movq -0x7a148(%rbp), %rdi
callq 0x4100
movq -0x7a1f0(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x7a180(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movl $0x2, -0x7a174(%rbp)
jmp 0x9ea50
movl -0x7a184(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a184(%rbp)
movq -0x7a148(%rbp), %rdi
callq 0x4100
movq -0x7a1f0(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x7a180(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x7a184(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x7a184(%rbp), %eax
addl $0x1, %eax
movq -0x7a1e8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x7a16c(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jne 0x9ea4e
movl $0x0, -0x7a188(%rbp)
jmp 0x9ea50
jmp 0x9ea52
jmp 0x9ea54
jmp 0x9ea56
jmp 0x9ea58
jmp 0x9eae4
movl $0x0, -0x7a160(%rbp)
jmp 0x9eae4
movl $0x2, -0x7a160(%rbp)
jmp 0x9eae4
movl $0x3, -0x7a160(%rbp)
jmp 0x9eae4
movl $0x4, -0x7a160(%rbp)
jmp 0x9eae4
cmpl $0x4, -0x7a160(%rbp)
jne 0x9eaaa
movl $0xffffffff, -0x7a164(%rbp) # imm = 0xFFFFFFFF
movl $0x5, -0x7a160(%rbp)
jmp 0x9eae4
movl $0x2, -0x7a160(%rbp)
jmp 0x9eae4
movl $0x6, -0x7a160(%rbp)
jmp 0x9eae4
movl $0x6, -0x7a160(%rbp)
movl $0x0, -0x7a168(%rbp)
jmp 0x9eae4
movl $0x0, -0x7a178(%rbp)
leaq -0x7a157(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x7a148(%rbp)
jmp 0x9e53a
jmp 0x9eb02
jmp 0x9e501
movq -0x18(%rbp), %rdi
callq 0x4250
movq -0x7a1e8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x7a250, %rsp          # imm = 0x7A250
popq %rbp
retq
nopl (%rax,%rax)