// File: /workspace/github_c_makefile_star2_O1/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 0x37e22
testl %eax, %eax
je 0x2686a
movq %rbx, %rdi
callq 0x4d68a
movq %rax, %r14
movw $0xa20, 0x5(%rsp)       # imm = 0xA20
movb $0x0, 0x7(%rsp)
leaq 0x8218e(%rip), %rsi     # 0xa888f
movq %rbp, %rdi
callq 0x40f0
testq %rax, %rax
je 0x2686a
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 0x2678c
movl $0x1, %ebx
leaq 0x7ea1d(%rip), %r15     # 0xa5174
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 0x4d16a
xorl %edi, %edi
movq %r12, %rsi
callq 0x4280
incl %ebx
testq %rax, %rax
jne 0x26761
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 0x26824
leaq 0x30(%rsp), %rbp
leaq 0x5(%rsp), %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4280
testq %rax, %rax
je 0x2680f
movq %rax, %r15
xorl %r12d, %r12d
movq 0x8(%r14), %rax
movq 0x8(%rax,%r12), %rsi
movl 0x10(%rax,%r12), %edx
movq %r15, %rdi
callq 0x3a2c5
cmpl $-0x1, %eax
jne 0x267f9
movq 0x8(%r14), %rdi
addq %r12, %rdi
movq %r15, %rsi
callq 0x4d58c
xorl %edi, %edi
movq %rbx, %rsi
callq 0x4280
movq %rax, %r15
addq $0x48, %r12
testq %rax, %rax
jne 0x267cf
movq %rbp, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r13, %rdx
callq 0x4120
testq %rax, %rax
jne 0x267b9
movq %r13, %rdi
callq 0x42a0
leaq 0xabc85(%rip), %rsi     # 0xd24b8
movq %r14, %rdi
movq 0x8(%rsp), %rdx
callq 0x262ac
leaq 0xabc81(%rip), %rsi     # 0xd24c8
movq %r14, %rdi
movq 0x10(%rsp), %rdx
callq 0x262ac
leaq 0xabc7d(%rip), %rsi     # 0xd24d8
movq %r14, %rdi
movq 0x18(%rsp), %rdx
callq 0x262ac
jmp 0x2686d
xorl %r14d, %r14d
movq %r14, %rax
addq $0x7a158, %rsp          # imm = 0x7A158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq