// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7a1c0, %rsp          # imm = 0x7A1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x7a150(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xa9939(%rip), %rdx     # 0xe5285
callq 0x53310
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x7a158(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xac852(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x28(%rbp)
movl -0x7a158(%rbp), %esi
movl $0x1, %edi
callq 0x57fc0
movq %rax, -0x7a1a8(%rbp)
movq %rdx, -0x7a1a0(%rbp)
movq -0x7a1a8(%rbp), %rax
movq %rax, -0x7a170(%rbp)
movq -0x7a1a0(%rbp), %rax
movq %rax, -0x7a168(%rbp)
movl $0x0, -0x7a154(%rbp)
movl -0x7a154(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x3bbb2
movl $0x0, -0x7a15c(%rbp)
movl -0x7a15c(%rbp), %eax
cmpl -0x7a158(%rbp), %eax
jge 0x3ba17
xorps %xmm0, %xmm0
movsd 0xa662d(%rip), %xmm1    # 0xe2018
callq 0xc4710
movq -0x7a168(%rbp), %rax
movq (%rax), %rax
movslq -0x7a15c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x7a15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a15c(%rbp)
jmp 0x3b9d2
xorps %xmm0, %xmm0
movsd 0xa65f6(%rip), %xmm1    # 0xe2018
callq 0x545a0
movsd %xmm0, -0x7a198(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %esi
movsd -0x7a198(%rbp), %xmm0
callq 0x4fff0
movl %eax, -0x7a160(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x7a160(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
leaq -0x7a180(%rbp), %rdx
callq 0x58010
movq -0x7a170(%rbp), %rdi
movq -0x7a168(%rbp), %rsi
movq -0x7a180(%rbp), %rdx
movq -0x7a178(%rbp), %rcx
callq 0x59fe0
movq %rax, -0x7a1b8(%rbp)
movq %rdx, -0x7a1b0(%rbp)
movq -0x7a1b8(%rbp), %rax
movq %rax, -0x7a190(%rbp)
movq -0x7a1b0(%rbp), %rax
movq %rax, -0x7a188(%rbp)
movl $0x0, -0x7a15c(%rbp)
movl -0x7a15c(%rbp), %eax
cmpl -0x7a158(%rbp), %eax
jge 0x3bb3a
movq -0x28(%rbp), %rdi
leaq -0x7a150(%rbp), %rsi
movq -0x7a188(%rbp), %rax
movq (%rax), %rax
movslq -0x7a15c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x7a160(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0x7a15c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movb $0x1, %al
callq 0x4280
movl -0x7a15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a15c(%rbp)
jmp 0x3bacf
movq -0x8(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jle 0x3bb66
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x7a160(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0xb10f4(%rip), %rsi     # 0xecc51
movb $0x0, %al
callq 0x4280
jmp 0x3bb78
movq -0x28(%rbp), %rdi
leaq 0xaa1ca(%rip), %rsi     # 0xe5d3b
movb $0x0, %al
callq 0x4280
movq -0x7a180(%rbp), %rdi
movq -0x7a178(%rbp), %rsi
callq 0x59ea0
movq -0x7a190(%rbp), %rdi
movq -0x7a188(%rbp), %rsi
callq 0x59ea0
movl -0x7a154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a154(%rbp)
jmp 0x3b9b9
movq -0x7a170(%rbp), %rdi
movq -0x7a168(%rbp), %rsi
callq 0x59ea0
movq -0x28(%rbp), %rdi
callq 0x4250
addq $0x7a1c0, %rsp          # imm = 0x7A1C0
popq %rbp
retq
nopw (%rax,%rax)