// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/savecode.c
// Function: generate_test_code_gaussian
void generate_test_code_gaussian(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, Model_gaussianptr m)
{
 /*!Last Changed 05.06.2006*/
 char st[MAXLENGTH];
 code_function_header(testcodefile, "gaussian", d->featurecount, language);
 code_constant_start(testcodefile, language);
	code_1d_array_constant_instance(testcodefile, language, d, "mean", d->multifeaturecount - 1, &mean);
	code_1d_array_constant_instance(testcodefile, language, d, "variance", d->multifeaturecount - 1, &variance);
 code_1d_array_constant(testcodefile, language, "priors", d->classno, m->priors, REAL_TYPE);
 code_1d_array_constant(testcodefile, language, "v", d->classno, m->variance, REAL_TYPE);
 code_2d_array_constant_instance(testcodefile, language, d, "m", d->classno, d->multifeaturecount - 1, m->mean);
 code_variable_start(testcodefile, language);
 code_add_variable(testcodefile, language, INTEGER_VARIABLE, 5, "i", "j", "maxindex", "k", "a");
 code_add_variable(testcodefile, language, REAL_VARIABLE, 6, "sum", "maxposterior", "x_j", "m_ij", "v_i", "p_i", "posterior");
 code_add_array_variable(testcodefile, language, 1, REAL_VARIABLE, "testdataconverted", d->multifeaturecount);
 code_start(testcodefile, language);  
	code_realize(testcodefile, language, d, YES);
 code_set_variable(testcodefile, language, "maxposterior", "0.0");
 code_for(testcodefile, language, "i", 0, d->classno - 1, 1);
 code_set_variable(testcodefile, language, "sum", "0.0");
 code_array_index_variable(st, language, "v", "i");
 code_set_variable(testcodefile, language, "v_i", st);
 code_array_index_variable(st, language, "priors", "i");
 code_set_variable(testcodefile, language, "p_i", st);
 code_for(testcodefile, language, "j", 0, d->multifeaturecount - 2, 1);
 code_array_index_variable(st, language, "testdataconverted", "j");
 code_set_variable(testcodefile, language, "x_j", st);
 code_2d_array_index_variable(st, language, "m", "i", "j");
 code_set_variable(testcodefile, language, "m_ij", st);
 code_set_variable(testcodefile, language, "sum", "sum + (x_j - m_ij) * (x_j - m_ij)");
 code_endfor(testcodefile, language, "j");
 code_set_variable(testcodefile, language, "posterior", "(p_i / (v_i * sqrt(2 * 3.1415926))) * exp(-sum / (2 * v_i * v_i))");
 code_compare_and_set_bound(testcodefile, language, ">", "posterior", "maxposterior", "maxindex"); 
 code_endfor(testcodefile, language, "i");
 code_function_return_string(testcodefile, "gaussian", language, "maxindex");
 code_function_end(testcodefile, language);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a128, %rsp          # imm = 0x7A128
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
movl 0x1bc(%rdx), %edx
leaq 0x228c1(%rip), %rsi     # 0x9858f
movl %ebx, %ecx
callq 0x72674
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b0a
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x2bafa(%rip), %rcx     # 0xa17eb
leaq 0x3342b0(%rip), %r9     # 0x3a9fa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x73bdf
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x2070d(%rip), %rcx     # 0x96424
leaq 0x3342ba(%rip), %r9     # 0x3a9fd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x73bdf
movl 0x10(%r12), %ecx
movq 0x10(%r15), %r8
leaq 0x2accc(%rip), %rdx     # 0xa0a07
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %r9d
callq 0x73cac
movl 0x10(%r12), %ecx
movq 0x8(%r15), %r8
leaq 0x2bff4(%rip), %rdx     # 0xa1d4f
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %r9d
callq 0x73cac
movl 0x10(%r12), %r8d
movl 0x1c0(%r12), %r9d
decl %r9d
subq $0x8, %rsp
leaq 0x2a339(%rip), %rcx     # 0xa00bc
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
pushq (%r15)
callq 0x74003
popq %rax
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x72fb3
subq $0x8, %rsp
leaq 0x22076(%rip), %r10     # 0x97e20
leaq 0x2af35(%rip), %r11     # 0xa0ce6
leaq 0x2ac56(%rip), %r13     # 0xa0a0e
leaq 0x2ae5e(%rip), %r8      # 0xa0c1d
leaq 0x2ab52(%rip), %r9      # 0xa0918
pushq $0x5
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
callq 0x72de1
addq $0x18, %rsp
leaq 0x25ba9(%rip), %r10     # 0x9b991
leaq 0x2ac39(%rip), %rbp     # 0xa0a28
leaq 0x2ac2e(%rip), %r15     # 0xa0a24
leaq 0x2a9fd(%rip), %r11     # 0xa07fa
leaq 0x2ab28(%rip), %r13     # 0xa092c
leaq 0x2ae06(%rip), %r8      # 0xa0c11
leaq 0x2ac05(%rip), %r9      # 0xa0a17
pushq $0x6
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
pushq $0x1
popq %rdx
movl $0x0, %eax
pushq %r10
pushq %rbp
pushq %r15
pushq %r11
pushq %r13
callq 0x72de1
addq $0x30, %rsp
movl 0x1c0(%r12), %r9d
leaq 0x2a9a5(%rip), %r8      # 0xa07e8
movq %r14, %rdi
movl %ebx, %esi
pushq $0x1
popq %rcx
movl %ecx, %edx
movl %ecx, %ebp
xorl %eax, %eax
callq 0x72b76
movq %r14, %rdi
movl %ebx, %esi
callq 0x726d3
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x753f5
leaq 0x2ad03(%rip), %r13     # 0xa0b79
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ab95(%rip), %rdx     # 0xa0a17
movq %r13, %rcx
callq 0x72b25
movl 0x10(%r12), %r8d
decl %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ad7f(%rip), %r15     # 0xa0c1d
movq %r15, %rdx
xorl %ecx, %ecx
movl %ebp, %r9d
callq 0x73938
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ad5a(%rip), %rdx     # 0xa0c11
movq %r13, %rcx
callq 0x72b25
movq %rsp, %r13
movq %r13, %rdi
movl %ebx, %esi
leaq 0x2be81(%rip), %rdx     # 0xa1d4f
movq %r15, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ab42(%rip), %rdx     # 0xa0a24
movq %r13, %rcx
callq 0x72b25
movq %r13, %rdi
movl %ebx, %esi
leaq 0x2ab11(%rip), %rdx     # 0xa0a07
movq %r15, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ab1e(%rip), %rdx     # 0xa0a28
movq %r13, %rcx
callq 0x72b25
movl 0x1c0(%r12), %r8d
addl $-0x2, %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2a9ee(%rip), %r15     # 0xa0918
movq %r15, %rdx
xorl %ecx, %ecx
movl %ebp, %r9d
callq 0x73938
movq %r13, %rdi
movl %ebx, %esi
leaq 0x2a8a5(%rip), %rdx     # 0xa07e8
movq %r15, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2a9d5(%rip), %rdx     # 0xa092c
movq %r13, %rcx
callq 0x72b25
movq %r13, %rdi
movl %ebx, %esi
leaq 0x2a151(%rip), %rdx     # 0xa00bc
leaq 0x2acab(%rip), %rcx     # 0xa0c1d
movq %r15, %r8
callq 0x7329c
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2a874(%rip), %rdx     # 0xa07fa
movq %r13, %rcx
callq 0x72b25
leaq 0x2a872(%rip), %rcx     # 0xa0807
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ac70(%rip), %rdx     # 0xa0c11
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
leaq 0x2aa75(%rip), %rcx     # 0xa0a2c
movq %r14, %rdi
movl %ebx, %esi
leaq 0x259ce(%rip), %r15     # 0x9b991
movq %r15, %rdx
callq 0x72b25
leaq 0x2b100(%rip), %rdx     # 0xa10d2
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
leaq 0x2aa36(%rip), %r8      # 0xa0a17
leaq 0x2aa26(%rip), %r15     # 0xa0a0e
movq %r15, %r9
callq 0x752a9
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
movq %r14, %rdi
leaq 0x2258b(%rip), %rsi     # 0x9858f
movl %ebx, %edx
movq %r15, %rcx
callq 0x7308c
movq %r14, %rdi
movl %ebx, %esi
callq 0x7320f
addq $0x7a128, %rsp          # imm = 0x7A128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq