// File: /workspace/github_c_makefile_star2_O1/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 $0x7a188, %rsp          # imm = 0x7A188
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, 0x50(%rsp)
movq %rdi, %r15
leaq 0x7bd7a(%rip), %rdx     # 0xa568d
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
callq 0x39529
movq (%r15), %rax
movl 0x8(%rax), %r12d
leaq 0x7ef74(%rip), %rsi     # 0xa88a1
movq %rbx, %rdi
callq 0x40f0
movq %rax, %rbx
movl $0x1, %edi
movl %r12d, %esi
callq 0x3c6e5
movq %rax, 0x28(%rsp)
movq %rdx, %r14
movl %ebp, 0x1c(%rsp)
testl %ebp, %ebp
jle 0x29ac5
movsd 0x78bbf(%rip), %xmm1    # 0xa2520
xorl %ebp, %ebp
movq %rbx, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movl %ebp, 0xc(%rsp)
testl %r12d, %r12d
jle 0x299a1
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
movsd 0x78b9c(%rip), %xmm1    # 0xa2520
callq 0x8cd13
movsd 0x78b8f(%rip), %xmm1    # 0xa2520
movq (%r14), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
cmpq %rbx, %r12
jne 0x29978
xorpd %xmm0, %xmm0
callq 0x39f62
movq 0x10(%r15), %rdi
movl 0x8(%r15), %esi
callq 0x374dd
movq (%r15), %rcx
cltq
movq %rax, 0x58(%rsp)
leaq (%rax,%rax,2), %rbx
movq 0x8(%rcx,%rbx,8), %rdi
movq 0x10(%rcx,%rbx,8), %rsi
leaq 0x40(%rsp), %rdx
callq 0x3c71f
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x3dc8b
movq %rax, 0x30(%rsp)
testl %r12d, %r12d
movq 0x10(%rsp), %r14
movq %r15, %r13
leaq 0x60(%rsp), %r15
movq %r12, %rbp
movq %rdx, 0x38(%rsp)
jle 0x29a43
xorl %r12d, %r12d
movq (%rdx), %rax
movsd (%rax,%r12,8), %xmm0
movq (%r13), %rax
movq (%rax,%rbx,8), %rax
addsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x42e0
movq 0x38(%rsp), %rdx
incq %r12
cmpq %r12, %rbp
jne 0x29a12
cmpl $0x2, 0x8(%r13)
movq %r13, %r15
jl 0x29a72
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
leaq 0x83ae0(%rip), %rsi     # 0xad549
xorl %eax, %eax
callq 0x42e0
jmp 0x29a84
movl $0xa, %edi
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x4150
movq 0x20(%rsp), %r14
movq %rbp, %r12
movl 0xc(%rsp), %ebp
movq 0x30(%rsp), %r13
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x3dbad
movq %r13, %rdi
movq 0x38(%rsp), %rsi
callq 0x3dbad
incl %ebp
cmpl 0x1c(%rsp), %ebp
movsd 0x78a61(%rip), %xmm1    # 0xa2520
jne 0x2996d
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x3dbad
movq %rbx, %rdi
callq 0x42a0
addq $0x7a188, %rsp          # imm = 0x7A188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq