// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
movl 0x1bc(%rdx), %edx
leaq 0x26472(%rip), %rsi     # 0xa55b7
movl %ebx, %ecx
callq 0x7b551
cmpl $0x2, %ebx
jne 0x7f16a
leaq 0x2e0ad(%rip), %rdi     # 0xad205
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x1c0(%r15), %r8d
decl %r8d
leaq 0x2f680(%rip), %rcx     # 0xae7fb
leaq 0x32fe26(%rip), %r9     # 0x3aefa8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7cde7
movl 0x1c0(%r15), %r8d
decl %r8d
leaq 0x24284(%rip), %rcx     # 0xa3424
leaq 0x32fe31(%rip), %r9     # 0x3aefd8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7cde7
movl 0x10(%r15), %ecx
movq 0x10(%r12), %r8
leaq 0x2e847(%rip), %rdx     # 0xada0b
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %r9d
callq 0x7ceb8
movl 0x10(%r15), %ecx
movq 0x8(%r12), %r8
leaq 0x2fb93(%rip), %rdx     # 0xaed77
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %r9d
callq 0x7ceb8
movl 0x10(%r15), %r8d
movl 0x1c0(%r15), %r9d
decl %r9d
subq $0x8, %rsp
leaq 0x2deb3(%rip), %rcx     # 0xad0c0
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
pushq (%r12)
callq 0x7d214
addq $0x10, %rsp
cmpl $0x2, %ebx
jne 0x7f321
leaq 0x2e036(%rip), %rdi     # 0xad268
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
subq $0x8, %rsp
leaq 0x25bf9(%rip), %r10     # 0xa4e48
leaq 0x2ea94(%rip), %r11     # 0xadcea
leaq 0x2e7b5(%rip), %r12     # 0xada12
leaq 0x2e9bd(%rip), %r8      # 0xadc21
leaq 0x2e6b1(%rip), %r9      # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r12
callq 0x7bd1c
addq $0x18, %rsp
leaq 0x29712(%rip), %r10     # 0xa89a1
leaq 0x2e796(%rip), %r11     # 0xada2c
leaq 0x2e78b(%rip), %r12     # 0xada28
leaq 0x2e55a(%rip), %r13     # 0xad7fe
leaq 0x2e685(%rip), %rbp     # 0xad930
leaq 0x2e963(%rip), %r8      # 0xadc15
leaq 0x2e762(%rip), %r9      # 0xada1b
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x6, %ecx
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %r12
pushq %r13
pushq %rbp
callq 0x7bd1c
addq $0x30, %rsp
movl 0x1c0(%r15), %r9d
leaq 0x2e4ff(%rip), %r8      # 0xad7ec
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x7bab4
leaq 0x2dd6e(%rip), %rdi     # 0xad078
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x7f3e0
subq $0x8, %rsp
leaq 0x25b1c(%rip), %r10     # 0xa4e48
leaq 0x2e9b7(%rip), %r11     # 0xadcea
leaq 0x2e6d8(%rip), %r12     # 0xada12
leaq 0x2e8e0(%rip), %r8      # 0xadc21
leaq 0x2e5d4(%rip), %r9      # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r12
callq 0x7bd1c
addq $0x18, %rsp
leaq 0x29635(%rip), %r10     # 0xa89a1
leaq 0x2e6b9(%rip), %r11     # 0xada2c
leaq 0x2e6ae(%rip), %r12     # 0xada28
leaq 0x2e47d(%rip), %r13     # 0xad7fe
leaq 0x2e5a8(%rip), %rbp     # 0xad930
leaq 0x2e886(%rip), %r8      # 0xadc15
leaq 0x2e685(%rip), %r9      # 0xada1b
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x6, %ecx
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %r12
pushq %r13
pushq %rbp
callq 0x7bd1c
addq $0x30, %rsp
movl 0x1c0(%r15), %r9d
leaq 0x2e422(%rip), %r8      # 0xad7ec
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x7bab4
incl 0x32fe02(%rip)          # 0x3af1e8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x7e795
leaq 0x2e61c(%rip), %rdx     # 0xada1b
leaq 0x2e777(%rip), %r12     # 0xadb7d
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7ba46
movl 0x10(%r15), %r8d
decl %r8d
leaq 0x2e800(%rip), %rbp     # 0xadc21
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
leaq 0x2e7d8(%rip), %r13     # 0xadc15
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %r12, %rcx
callq 0x7ba46
leaq 0x2f923(%rip), %rdx     # 0xaed77
movq %rsp, %r12
movq %r12, %rdi
movl %ebx, %esi
movq %rbp, %rcx
callq 0x7c24c
leaq 0x2e5bd(%rip), %rdx     # 0xada28
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7ba46
leaq 0x2e58c(%rip), %rdx     # 0xada0b
movq %r12, %rdi
movl %ebx, %esi
movq %rbp, %rcx
callq 0x7c24c
leaq 0x2e599(%rip), %rdx     # 0xada2c
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7ba46
movl 0x1c0(%r15), %r8d
addl $-0x2, %r8d
leaq 0x2e46a(%rip), %r15     # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
leaq 0x2e31e(%rip), %rdx     # 0xad7ec
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7c24c
leaq 0x2e44e(%rip), %rdx     # 0xad930
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7ba46
leaq 0x2dbca(%rip), %rdx     # 0xad0c0
movq %r12, %rdi
movl %ebx, %esi
movq %rbp, %rcx
movq %r15, %r8
callq 0x7c269
leaq 0x2e2f1(%rip), %rdx     # 0xad7fe
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7ba46
leaq 0x2e2ea(%rip), %rcx     # 0xad80b
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
leaq 0x29462(%rip), %r15     # 0xa89a1
leaq 0x2e4ea(%rip), %rcx     # 0xada30
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7ba46
leaq 0x2eb7c(%rip), %rdx     # 0xae0d6
leaq 0x2e4b1(%rip), %r12     # 0xada12
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
leaq 0x2e4ab(%rip), %r8      # 0xada1b
movq %r12, %r9
callq 0x7e616
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
leaq 0x2602e(%rip), %rsi     # 0xa55b7
movq %r14, %rdi
movl %ebx, %edx
movq %r12, %rcx
callq 0x7bffb
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c1ca
addq $0x7a128, %rsp          # imm = 0x7A128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq