// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/readnet.c
// Function: read_network_hugin
bayesiangraphptr read_network_hugin(char *f_name)
{
/*!Last Changed 06.02.2001 Commentlere dikkat*/
 FILE *myfile;
 bayesiangraphptr result = create_graph(file_only_name(f_name));
 char myline[READLINELENGTH];
 char *st;
 char st1[12];
 int pos = -1, ind = -1, child = -1, pindex, row = -1, col;
 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] = '\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, hugin_words, 7)) 
      {
       case -1:if (st[0] == '%')
                 goto devam;
               switch (pos) {
                 case -1:return NULL;
                 case  0:
                 case  2:break;
                 case  1:current = add_one_node(result, st);
                         break;
                 case  3:current->xpos = atoi(st);
                         pos++;
                         break;
                 case  4:current->ypos = atoi(st);
                         break;
                 case  5:add_one_value(current, st);
                         break;
                 case  6:if (ind == -1)
                          {
                           child = node_in(result, st);
                           if (child == -1)
                             return NULL;
                           ind++;
                          }
                         else
                          {
                           pindex = node_in(result, st);
                           if (pindex == -1)
                             return NULL;
                           add_parent_counts(result, &result->nodes[child],pindex);
                           add_one_arc(result);
                           add_one_pointer(result, &result->nodes[child],pindex);
                          }
                         break;
                 case  7:if (row == -1)
                          {
                           current = &result->nodes[child];
                           alloc_conditional_table(current);
                           row = 0;
                           col = 0;
                          }
                         else
                          {
                           current->table[row][col] = (double) atof(st);
                           col++;
                           if (col == current->value_count)
                            {
                             row++;
                             col = 0;
                            }
                          }
                         break;
               }
               break;
       case  0:pos = 0; /*net*/
               break;
       case  1:pos = 1; /*node*/
               break;
       case  2:pos = 2; /*label*/
               break;
       case  3:pos = 3; /*position*/
               break;
       case  4:pos = 5; /*states*/
               break;
       case  5:pos = 6; /*potential*/
               ind = -1;
               break;
       case  6:pos = 7; /*data*/
               row = -1;
               break;
     }
     st = strtok(NULL,st1);
    }
devam:;
  }
 fclose(myfile);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7a190, %rsp          # imm = 0x7A190
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x510a0
movq %rax, %rdi
callq 0x70f80
movq %rax, -0x20(%rbp)
movl $0xffffffff, -0x7a158(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x7a15c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x7a160(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x7a168(%rbp) # imm = 0xFFFFFFFF
movb $0x20, -0x7a154(%rbp)
movb $0xa, -0x7a153(%rbp)
movb $0x7b, -0x7a152(%rbp)
movb $0x7d, -0x7a151(%rbp)
movb $0x3d, -0x7a150(%rbp)
movb $0x28, -0x7a14f(%rbp)
movb $0x29, -0x7a14e(%rbp)
movb $0x22, -0x7a14d(%rbp)
movb $0x3b, -0x7a14c(%rbp)
movb $0x7c, -0x7a14b(%rbp)
movb $0x9, -0x7a14a(%rbp)
movb $0x0, -0x7a149(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x495cb(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x9ec09
movq -0x10(%rbp), %rsi
leaq 0x4d589(%rip), %rdi     # 0xec17e
movb $0x0, %al
callq 0x4030
movq $0x0, -0x8(%rbp)
jmp 0x9ef83
jmp 0x9ec0b
leaq -0x7a140(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x9ef72
leaq -0x7a140(%rbp), %rdi
leaq -0x7a154(%rbp), %rsi
callq 0x4230
movq %rax, -0x7a148(%rbp)
cmpq $0x0, -0x7a148(%rbp)
je 0x9ef6b
movq -0x7a148(%rbp), %rdi
leaq 0x66780(%rip), %rsi     # 0x1053e0
movl $0x7, %edx
callq 0x54910
incl %eax
movl %eax, %ecx
movq %rcx, -0x7a180(%rbp)
subl $0x7, %eax
ja 0x9ef4f
movq -0x7a180(%rbp), %rax
leaq 0x4d254(%rip), %rcx     # 0xebee0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x7a148(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
jne 0x9eca9
jmp 0x9ef6d
movl -0x7a158(%rbp), %eax
incl %eax
movl %eax, %ecx
movq %rcx, -0x7a188(%rbp)
subl $0x8, %eax
ja 0x9eee7
movq -0x7a188(%rbp), %rax
leaq 0x4d22f(%rip), %rcx     # 0xebf00
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, -0x8(%rbp)
jmp 0x9ef83
jmp 0x9eee7
movq -0x20(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x70530
movq %rax, -0x7a178(%rbp)
jmp 0x9eee7
movq -0x7a148(%rbp), %rdi
callq 0x41c0
movl %eax, %ecx
movq -0x7a178(%rbp), %rax
movl %ecx, 0x40(%rax)
movl -0x7a158(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a158(%rbp)
jmp 0x9eee7
movq -0x7a148(%rbp), %rdi
callq 0x41c0
movl %eax, %ecx
movq -0x7a178(%rbp), %rax
movl %ecx, 0x44(%rax)
jmp 0x9eee7
movq -0x7a178(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x70d80
jmp 0x9eee7
cmpl $-0x1, -0x7a15c(%rbp)
jne 0x9edaf
movq -0x20(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x702b0
movl %eax, -0x7a160(%rbp)
cmpl $-0x1, -0x7a160(%rbp)
jne 0x9ed9e
movq $0x0, -0x8(%rbp)
jmp 0x9ef83
movl -0x7a15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a15c(%rbp)
jmp 0x9ee2e
movq -0x20(%rbp), %rdi
movq -0x7a148(%rbp), %rsi
callq 0x702b0
movl %eax, -0x7a164(%rbp)
cmpl $-0x1, -0x7a164(%rbp)
jne 0x9eddb
movq $0x0, -0x8(%rbp)
jmp 0x9ef83
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movslq -0x7a160(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rsi
movl -0x7a164(%rbp), %edx
callq 0x70c80
movq -0x20(%rbp), %rdi
callq 0x70a70
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movslq -0x7a160(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rsi
movl -0x7a164(%rbp), %edx
callq 0x70b20
jmp 0x9eee7
cmpl $-0x1, -0x7a168(%rbp)
jne 0x9ee7b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x7a160(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x7a178(%rbp)
movq -0x7a178(%rbp), %rdi
callq 0x70d30
movl $0x0, -0x7a168(%rbp)
movl $0x0, -0x7a16c(%rbp)
jmp 0x9eee5
movq -0x7a148(%rbp), %rdi
callq 0x4100
movq -0x7a178(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x7a168(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x7a16c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x7a16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a16c(%rbp)
movl -0x7a16c(%rbp), %eax
movq -0x7a178(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x9eee3
movl -0x7a168(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a168(%rbp)
movl $0x0, -0x7a16c(%rbp)
jmp 0x9eee5
jmp 0x9eee7
jmp 0x9ef4f
movl $0x0, -0x7a158(%rbp)
jmp 0x9ef4f
movl $0x1, -0x7a158(%rbp)
jmp 0x9ef4f
movl $0x2, -0x7a158(%rbp)
jmp 0x9ef4f
movl $0x3, -0x7a158(%rbp)
jmp 0x9ef4f
movl $0x5, -0x7a158(%rbp)
jmp 0x9ef4f
movl $0x6, -0x7a158(%rbp)
movl $0xffffffff, -0x7a15c(%rbp) # imm = 0xFFFFFFFF
jmp 0x9ef4f
movl $0x7, -0x7a158(%rbp)
movl $0xffffffff, -0x7a168(%rbp) # imm = 0xFFFFFFFF
leaq -0x7a154(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x7a148(%rbp)
jmp 0x9ec44
jmp 0x9ef6d
jmp 0x9ec0b
movq -0x18(%rbp), %rdi
callq 0x4250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x7a190, %rsp          # imm = 0x7A190
popq %rbp
retq