// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/hmm.c
// Function: generate_gaussian_mixture_data
void generate_gaussian_mixture_data(Gaussianmixtureptr gm, int* classes, int datacount, char* outfilename)
{
 /*!Last Changed 28.04.2007*/
 FILE* outfile;
 char pst[READLINELENGTH];
 int i, dimension, j, componentindex;
 matrix a, z, result;
 double value;
 set_precision(pst, NULL, " "); 
 dimension = gm->components[0].covariance.row;
 outfile = fopen(outfilename, "w");
 a = matrix_alloc(1, dimension);
 for (i = 0; i < datacount; i++)
  {
   for (j = 0; j < dimension; j++)
     a.values[0][j] = produce_normal_value(0.0, 1.0);
   value = produce_random_value(0, 1);
   componentindex = find_bin(gm->weights, gm->componentcount, value);
   cholesky_decomposition(gm->components[componentindex].covariance, &z);
   result = matrix_multiply(a, z);
   for (j = 0; j < dimension; j++)
     fprintf(outfile, pst, result.values[0][j] + gm->components[componentindex].mean[j]);
   if (gm->componentcount > 1)
     fprintf(outfile, "%d\n", classes[componentindex]);
   else 
     fprintf(outfile, "\n");
   matrix_free(z);
   matrix_free(result);
  }
 matrix_free(a);
 fclose(outfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a168, %rsp          # imm = 0x7A168
movq %rcx, %rbx
movl %edx, %r12d
movq %rsi, 0x28(%rsp)
movq %rdi, %r15
leaq 0x71ea5(%rip), %rdx     # 0x98665
xorl %r14d, %r14d
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x35305
movq (%r15), %rax
movl 0x8(%rax), %ebp
leaq 0x750b5(%rip), %rsi     # 0x9b891
movq %rbx, %rdi
callq 0x40f0
movq %rax, (%rsp)
pushq $0x1
popq %rdi
movl %ebp, %esi
callq 0x380d3
movq %rax, 0x10(%rsp)
movq %rdx, %rbx
testl %ebp, %ebp
cmovlel %r14d, %ebp
testl %r12d, %r12d
cmovlel %r14d, %r12d
movl %r12d, 0x8(%rsp)
xorl %eax, %eax
cmpl 0x8(%rsp), %eax
je 0x26925
movl %eax, 0xc(%rsp)
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
movsd 0x6ecf5(%rip), %xmm1    # 0x95520
cmpq %r14, %rbp
je 0x26843
callq 0x81937
movq (%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
jmp 0x2681f
callq 0x35cae
movq 0x10(%r15), %rdi
movl 0x8(%r15), %esi
callq 0x33688
movq (%r15), %rcx
movslq %eax, %rdx
movq %rdx, 0x30(%rsp)
imulq $0x18, %rdx, %r12
movq 0x8(%rcx,%r12), %rdi
movq 0x10(%rcx,%r12), %rsi
leaq 0x18(%rsp), %rdx
callq 0x38107
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3933d
movq %rax, 0x38(%rsp)
movq %rdx, %r14
xorl %r13d, %r13d
cmpq %r13, %rbp
je 0x268ca
movq (%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq (%r15), %rax
movq (%rax,%r12), %rax
addsd (%rax,%r13,8), %xmm0
movq (%rsp), %rdi
leaq 0x40(%rsp), %rsi
movb $0x1, %al
callq 0x42e0
incq %r13
jmp 0x2689a
cmpl $0x2, 0x8(%r15)
jl 0x268f2
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq (%rsp), %rdi
leaq 0x79c5c(%rip), %rsi     # 0xa0545
xorl %eax, %eax
callq 0x42e0
jmp 0x268fe
pushq $0xa
popq %rdi
movq (%rsp), %rsi
callq 0x4150
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x3929f
movq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x3929f
movl 0xc(%rsp), %eax
incl %eax
jmp 0x2680e
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3929f
movq (%rsp), %rdi
callq 0x42a0
addq $0x7a168, %rsp          # imm = 0x7A168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq