// File: /workspace/github_c_makefile_star2_O2/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 0x33f62
testl %eax, %eax
je 0x23b82
movq %rbx, %rdi
callq 0x4783d
movq %rax, %r14
movw $0xa20, 0x5(%rsp)       # imm = 0xA20
movb $0x0, 0x7(%rsp)
leaq 0x77d7d(%rip), %rsi     # 0x9b87f
movq %rbp, %rdi
callq 0x40f0
testq %rax, %rax
je 0x23b82
movq %rax, %r13
movq %rbp, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
leaq 0x5(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4280
pushq $0x1
popq %rbp
leaq 0x745fc(%rip), %r15     # 0x9814c
leaq 0x26(%rsp), %r12
testq %rax, %rax
je 0x23b8a
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movq %r12, %rsi
callq 0x47398
xorl %edi, %edi
movq %rbx, %rsi
callq 0x4280
incl %ebp
jmp 0x23b55
xorl %r14d, %r14d
jmp 0x23c4c
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x40a0
leaq 0x30(%rsp), %rbp
leaq 0x5(%rsp), %rbx
movq %rbp, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r13, %rdx
callq 0x4120
testq %rax, %rax
je 0x23c08
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4280
movq %rax, %r15
xorl %r12d, %r12d
testq %r15, %r15
je 0x23ba0
movq 0x8(%r14), %rax
movq 0x8(%rax,%r12), %rsi
movl 0x10(%rax,%r12), %edx
movq %r15, %rdi
callq 0x35f17
cmpl $-0x1, %eax
jne 0x23bf5
movq 0x8(%r14), %rdi
addq %r12, %rdi
movq %r15, %rsi
callq 0x47750
xorl %edi, %edi
movq %rbx, %rsi
callq 0x4280
movq %rax, %r15
addq $0x48, %r12
jmp 0x23bc6
movq %r13, %rdi
callq 0x42a0
leaq 0xa98a1(%rip), %rsi     # 0xcd4b8
movq %r14, %rdi
movq 0x8(%rsp), %rdx
callq 0x23708
leaq 0xa989d(%rip), %rsi     # 0xcd4c8
movq %r14, %rdi
movq 0x10(%rsp), %rdx
callq 0x23708
leaq 0xa9899(%rip), %rsi     # 0xcd4d8
movq %r14, %rdi
movq 0x18(%rsp), %rdx
callq 0x23708
movq %r14, %rax
addq $0x7a158, %rsp          # imm = 0x7A158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq