// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/graphdata.c
// Function: initial_graph_from_data
bayesiangraphptr initial_graph_from_data(char *graph_name, char *train_file, char *cv_file, char *test_file)
{
/*!Last Changed 09.03.2001*/
 FILE *myfile;
 int i, k = file_length(train_file);
 char *st;
 char tmp[10];
 char st1[3];
 char myline[READLINELENGTH];
 bayesiangraphptr mygraph;
 if (k == 0)
   return NULL;
 mygraph = create_graph(graph_name);
 st1[0] = ' ';
 st1[1] = '\n';
 st1[2] = '\0';
 myfile = fopen(train_file, "r");
 if (!myfile)
   return NULL;
 fgets(myline, READLINELENGTH, myfile);
 st = strtok(myline, st1);
 i = 0;
 while (st)
  {
   i++;
   sprintf(tmp, "Feature%d", i);
   add_one_node(mygraph, tmp);
   st = strtok(NULL, st1);
  }
 fseek(myfile, 0, SEEK_SET);
 while (fgets(myline, READLINELENGTH, myfile))
  {
   st = strtok(myline, st1);
   i = 0;
   while (st)
    {
     k = listindex(st, mygraph->nodes[i].values, mygraph->nodes[i].value_count);
     if (k == -1)
       add_one_value(&mygraph->nodes[i], st);
     i++;
     st = strtok(NULL, st1);
    }
  }
 fclose(myfile);
 load_data(mygraph, &train, train_file);
 load_data(mygraph, &cv, cv_file);
 load_data(mygraph, &test, test_file);
 return mygraph;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a158, %rsp          # imm = 0x7A158
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x38a4a
testl %eax, %eax
je 0x26faa
movq %rbx, %rdi
callq 0x4eade
movq %rax, %r14
movw $0xa20, 0x5(%rsp)       # imm = 0xA20
movb $0x0, 0x7(%rsp)
leaq 0x84b1a(%rip), %rsi     # 0xab95b
movq %rbp, %rdi
callq 0x40f0
testq %rax, %rax
je 0x26faa
movq %rax, %r13
movq %rbp, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
leaq 0x5(%rsp), %rsi
movq %rbx, %rdi
callq 0x4280
testq %rax, %rax
je 0x26ecc
movl $0x1, %ebx
leaq 0x81335(%rip), %r15     # 0xa81cc
leaq 0x26(%rsp), %rbp
leaq 0x5(%rsp), %r12
movq %rbp, %rdi
movq %r15, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4e5de
xorl %edi, %edi
movq %r12, %rsi
callq 0x4280
incl %ebx
testq %rax, %rax
jne 0x26ea1
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x40a0
leaq 0x30(%rsp), %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r13, %rdx
callq 0x4120
testq %rax, %rax
je 0x26f64
leaq 0x30(%rsp), %rbp
leaq 0x5(%rsp), %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4280
testq %rax, %rax
je 0x26f4f
movq %rax, %r15
xorl %r12d, %r12d
movq 0x8(%r14), %rax
movq 0x8(%rax,%r12), %rsi
movl 0x10(%rax,%r12), %edx
movq %r15, %rdi
callq 0x3b355
cmpl $-0x1, %eax
jne 0x26f39
movq 0x8(%r14), %rdi
addq %r12, %rdi
movq %r15, %rsi
callq 0x4e9e4
xorl %edi, %edi
movq %rbx, %rsi
callq 0x4280
movq %rax, %r15
addq $0x48, %r12
testq %rax, %rax
jne 0x26f0f
movq %rbp, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r13, %rdx
callq 0x4120
testq %rax, %rax
jne 0x26ef9
movq %r13, %rdi
callq 0x42a0
leaq 0xae545(%rip), %rsi     # 0xd54b8
movq %r14, %rdi
movq 0x8(%rsp), %rdx
callq 0x26a00
leaq 0xae541(%rip), %rsi     # 0xd54c8
movq %r14, %rdi
movq 0x10(%rsp), %rdx
callq 0x26a00
leaq 0xae53d(%rip), %rsi     # 0xd54d8
movq %r14, %rdi
movq 0x18(%rsp), %rdx
callq 0x26a00
jmp 0x26fad
xorl %r14d, %r14d
movq %r14, %rax
addq $0x7a158, %rsp          # imm = 0x7A158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq