// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/graphdata.c
// Function: create_data
void create_data(bayesiangraphptr mygraph, int data_count, char *f_name)
{
 /*!Last Changed 17.07.2008 Added find_bin function*/
	/*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 09.02.2001*/
 FILE *myfile;
 BOOLEAN finished, found;
 int i, j, k, pos;
 double *probability;
 int parent[MAXPARENT];
 int *values;
 if ((myfile = fopen(f_name, "w")) == NULL)
  {
   printf(m1268, f_name);
   return;
  }
 probability = (double *)safemalloc(mygraph->nodecount * sizeof(double), "create_data", 11);
 values = (int *)safemalloc(mygraph->nodecount * sizeof(int), "create_data", 12);
 for (i = 0; i < data_count; i++)
  {
   /*Assign random probabilities to each Bayesian node*/
   for (j = 0; j < mygraph->nodecount; j++)
    {
     probability[j] = (double)(produce_random_value(0, 1));
     values[j] = -1;
    }
   finished = BOOLEAN_FALSE;
   while (!finished)
    {
     finished = BOOLEAN_TRUE;
     for (j = 0; j < mygraph->nodecount; j++)
       if (values[j] == -1)
        {
         found = BOOLEAN_TRUE;
         pos = mygraph->nodes[j].pointer;
         while (pos != -1)
          {
           if ((pos != -1) && (values[mygraph->dest[pos]] == -1))
             found = BOOLEAN_FALSE;
           pos = mygraph->arcs[pos].pointer;
          }
         if (found) /*Eger butun parentlarinin degerleri belirlenmisse*/
          {
           finished = BOOLEAN_FALSE;
           if (mygraph->nodes[j].pointer == -1)/*No parent*/
             values[j] = find_bin(mygraph->nodes[j].table[0], mygraph->nodes[j].value_count, probability[j]);
           else
            { /*Parenti varsa*/
             k = 0;
             pos = mygraph->nodes[j].pointer;
             while (pos != -1)
              {
               parent[k] = values[mygraph->dest[pos]];
               pos = mygraph->arcs[pos].pointer;
               k++;
              }
             k = table_pos(mygraph->nodes[j], parent);
             values[j] = find_bin(mygraph->nodes[j].table[k], mygraph->nodes[j].value_count, probability[j]);
            }
          }
        }
    }
   for (j = 0; j < mygraph->nodecount; j++)
     fprintf(myfile, "%s ", mygraph->nodes[j].values[values[j]]);
   fprintf(myfile, "\n");
  }
 safe_free(values);
 safe_free(probability);
 fclose(myfile);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xb15cd(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x36c17
movq -0x18(%rbp), %rsi
leaq 0xae0e1(%rip), %rdi     # 0xe4cec
movb $0x0, %al
callq 0x4030
jmp 0x36fa8
movq -0x8(%rbp), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
leaq 0xae0de(%rip), %rsi     # 0xe4d08
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movslq 0x10(%rax), %rdi
shlq $0x2, %rdi
leaq 0xae0bd(%rip), %rsi     # 0xe4d08
movl $0xc, %edx
callq 0x52d70
movq %rax, -0x98(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x36f8a
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x36cbc
xorps %xmm0, %xmm0
movsd 0xab38b(%rip), %xmm1    # 0xe2018
callq 0x545a0
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x98(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x36c76
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x36cd5
jmp 0x36f10
movl $0x1, -0x24(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x36f0b
movq -0x98(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x36efb
movl $0x1, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x30(%rax), %eax
movl %eax, -0x38(%rbp)
cmpl $-0x1, -0x38(%rbp)
je 0x36d6c
cmpl $-0x1, -0x38(%rbp)
je 0x36d58
movq -0x98(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x38(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x36d58
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
jmp 0x36d28
cmpl $0x0, -0x28(%rbp)
je 0x36ef9
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x30(%rax)
jne 0x36ded
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %esi
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x4fff0
movl %eax, %edx
movq -0x98(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x36ef7
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x30(%rax), %eax
movl %eax, -0x38(%rbp)
cmpl $-0x1, -0x38(%rbp)
je 0x36e55
movq -0x98(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x38(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %ecx
movslq -0x34(%rbp), %rax
movl %ecx, -0x90(%rbp,%rax,4)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x36e0d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x30(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rcx
leaq -0x90(%rbp), %rdi
movq 0x40(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x40(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups 0x30(%rcx), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x703b0
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %esi
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x4fff0
movl %eax, %edx
movq -0x98(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x36ef9
jmp 0x36efb
jmp 0x36efd
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x36ce3
jmp 0x36cc3
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x36f6a
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x98(%rbp), %rcx
movslq -0x30(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0xb6563(%rip), %rsi     # 0xed4bb
movb $0x0, %al
callq 0x4280
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x36f17
movq -0x20(%rbp), %rdi
leaq 0xaedc6(%rip), %rsi     # 0xe5d3b
movb $0x0, %al
callq 0x4280
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x36c63
movq -0x98(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movq -0x20(%rbp), %rdi
callq 0x4250
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)