// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/graphdata.c
// Function: load_data
int load_data(bayesiangraphptr mygraph, Bndata* mydata, char *f_name)
{
	/*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 07.03.2001*/
 FILE *myfile;
 int i, j, k = file_length(f_name);
 char *st;
 char st1[3];
 char myline[READLINELENGTH];
 if (k == 0)
   return 0;
 if (mydata->data)
   free_2d((void**)(void **)mydata->data, mydata->row);
 mydata->row = k;
 mydata->data = (int**) safemalloc_2d(sizeof(int *), sizeof(int), mydata->row, mydata->col, "load_data", 11);
 st1[0] = ' ';
 st1[1] = '\n';
 st1[2] = '\0';
 myfile = fopen(f_name, "r");
 if (!myfile)
   return 0;
 fgets(myline, READLINELENGTH, myfile);
 st = strtok(myline, st1);
 i = 0;
 while (st)
  {
   i++;
   st = strtok(NULL,st1);
  }
 mydata->col = i;
 fseek(myfile, 0, SEEK_SET);
 j = 0;
 while (fgets(myline, READLINELENGTH, myfile))
  {
   st = strtok(myline, st1);
   i = 0;
   while (st)
    {
     mydata->data[j][i] = listindex(st, mygraph->nodes[i].values, mygraph->nodes[i].value_count);
     i++;
     st = strtok(NULL, st1);
    }
   j++;
  }
 fclose(myfile);
 return k;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7a170, %rsp          # imm = 0x7A170
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x50f90
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x369f5
movl $0x0, -0x4(%rbp)
jmp 0x36bbe
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x36a12
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x52e20
movl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
movl $0x8, %edi
movl $0x4, %esi
leaq 0xae2a7(%rip), %r8      # 0xe4ce2
movl $0xb, %r9d
callq 0x53120
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movb $0x20, -0x43(%rbp)
movb $0xa, -0x42(%rbp)
movb $0x0, -0x41(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xb173f(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x36a83
movl $0x0, -0x4(%rbp)
jmp 0x36bbe
leaq -0x7a170(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
leaq -0x7a170(%rbp), %rdi
leaq -0x43(%rbp), %rsi
callq 0x4230
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x36ad6
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x43(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x40(%rbp)
jmp 0x36ab3
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x4080
movl $0x0, -0x30(%rbp)
leaq -0x7a170(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x36baf
leaq -0x7a170(%rbp), %rdi
leaq -0x43(%rbp), %rsi
callq 0x4230
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x36ba1
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
callq 0x54910
movl %eax, %edx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
leaq -0x43(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x40(%rbp)
jmp 0x36b30
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x36af6
movq -0x28(%rbp), %rdi
callq 0x4250
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x7a170, %rsp          # imm = 0x7A170
popq %rbp
retq
nopw (%rax,%rax)