// File: /workspace/github_c_makefile_star2_O3/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 0x2751b(%rip), %rsi     # 0xa860f
movl %ebx, %ecx
callq 0x7ce21
cmpl $0x2, %ebx
jne 0x81119
leaq 0x2f196(%rip), %rdi     # 0xb029d
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x1c0(%r15), %r8d
decl %r8d
leaq 0x30761(%rip), %rcx     # 0xb188b
leaq 0x330e77(%rip), %r9     # 0x3b1fa8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7e724
movl 0x1c0(%r15), %r8d
decl %r8d
leaq 0x252d5(%rip), %rcx     # 0xa6424
leaq 0x330e82(%rip), %r9     # 0x3b1fd8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7e724
movl 0x10(%r15), %ecx
movq 0x10(%r12), %r8
leaq 0x2f930(%rip), %rdx     # 0xb0aa3
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %r9d
callq 0x7e7f5
movl 0x10(%r15), %ecx
movq 0x8(%r12), %r8
leaq 0x30c64(%rip), %rdx     # 0xb1df7
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %r9d
callq 0x7e7f5
movl 0x10(%r15), %r8d
movl 0x1c0(%r15), %r9d
decl %r9d
subq $0x8, %rsp
leaq 0x2ef9c(%rip), %rcx     # 0xb0158
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
pushq (%r12)
callq 0x7ebcd
addq $0x10, %rsp
cmpl $0x2, %ebx
jne 0x812d9
leaq 0x2f11f(%rip), %rdi     # 0xb0300
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
subq $0x8, %rsp
leaq 0x26ca2(%rip), %r10     # 0xa7ea0
leaq 0x2fb7d(%rip), %r11     # 0xb0d82
leaq 0x2f89e(%rip), %r12     # 0xb0aaa
leaq 0x2faa6(%rip), %r8      # 0xb0cb9
leaq 0x2f79a(%rip), %r9      # 0xb09b4
movq %r14, %rdi
movl $0x2, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r12
callq 0x7d617
addq $0x18, %rsp
leaq 0x2a82c(%rip), %r10     # 0xaba6d
leaq 0x2f87c(%rip), %r11     # 0xb0ac4
leaq 0x2f871(%rip), %r12     # 0xb0ac0
leaq 0x2f640(%rip), %r13     # 0xb0896
leaq 0x2f76b(%rip), %rbp     # 0xb09c8
leaq 0x2fa49(%rip), %r8      # 0xb0cad
leaq 0x2f848(%rip), %r9      # 0xb0ab3
movq %r14, %rdi
movl $0x2, %esi
movl $0x1, %edx
movl $0x6, %ecx
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %r12
pushq %r13
pushq %rbp
callq 0x7d617
addq $0x30, %rsp
movl 0x1c0(%r15), %r9d
leaq 0x2f5e2(%rip), %r8      # 0xb0884
movq %r14, %rdi
movl $0x2, %esi
movl $0x1, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x7d384
leaq 0x2ee4e(%rip), %rdi     # 0xb0110
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x81398
subq $0x8, %rsp
leaq 0x26bbc(%rip), %r10     # 0xa7ea0
leaq 0x2fa97(%rip), %r11     # 0xb0d82
leaq 0x2f7b8(%rip), %r12     # 0xb0aaa
leaq 0x2f9c0(%rip), %r8      # 0xb0cb9
leaq 0x2f6b4(%rip), %r9      # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r12
callq 0x7d617
addq $0x18, %rsp
leaq 0x2a749(%rip), %r10     # 0xaba6d
leaq 0x2f799(%rip), %r11     # 0xb0ac4
leaq 0x2f78e(%rip), %r12     # 0xb0ac0
leaq 0x2f55d(%rip), %r13     # 0xb0896
leaq 0x2f688(%rip), %rbp     # 0xb09c8
leaq 0x2f966(%rip), %r8      # 0xb0cad
leaq 0x2f765(%rip), %r9      # 0xb0ab3
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 0x7d617
addq $0x30, %rsp
movl 0x1c0(%r15), %r9d
leaq 0x2f502(%rip), %r8      # 0xb0884
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x7d384
incl 0x330e4a(%rip)          # 0x3b21e8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x8050d
leaq 0x2f6fc(%rip), %rdx     # 0xb0ab3
leaq 0x2f857(%rip), %r12     # 0xb0c15
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7d316
movl 0x10(%r15), %r8d
decl %r8d
leaq 0x2f8e0(%rip), %rdx     # 0xb0cb9
movq %r14, %rdi
movl %ebx, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
leaq 0x2f8bb(%rip), %rdx     # 0xb0cad
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7d316
movl %ebx, %r12d
leaq 0x52977(%rip), %r13     # 0xd3d80
cmpl $0x5, %ebx
ja 0x8142b
movq (%r13,%r12,8), %rsi
leaq 0x309dd(%rip), %rdx     # 0xb1df7
leaq 0x2f898(%rip), %rcx     # 0xb0cb9
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2f68e(%rip), %rdx     # 0xb0ac0
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x81461
movq (%r13,%r12,8), %rsi
leaq 0x2f653(%rip), %rdx     # 0xb0aa3
leaq 0x2f862(%rip), %rcx     # 0xb0cb9
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2f65c(%rip), %rdx     # 0xb0ac4
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movl 0x1c0(%r15), %r8d
addl $-0x2, %r8d
leaq 0x2f52d(%rip), %rdx     # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
cmpl $0x5, %ebx
ja 0x814bb
movq (%r13,%r12,8), %rsi
leaq 0x2f3da(%rip), %rdx     # 0xb0884
leaq 0x2f503(%rip), %rcx     # 0xb09b4
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2f506(%rip), %rdx     # 0xb09c8
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x814fe
leaq 0x52815(%rip), %rax     # 0xd3cf0
movq (%rax,%r12,8), %rsi
leaq 0x2ec72(%rip), %rdx     # 0xb0158
leaq 0x2f7cc(%rip), %rcx     # 0xb0cb9
leaq 0x2f4c0(%rip), %r8      # 0xb09b4
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2f391(%rip), %rdx     # 0xb0896
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
leaq 0x2f794(%rip), %rdx     # 0xb0cad
leaq 0x2f383(%rip), %rcx     # 0xb08a3
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
leaq 0x2a532(%rip), %r15     # 0xaba6d
leaq 0x2f586(%rip), %rcx     # 0xb0ac8
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7d316
leaq 0x2fc18(%rip), %rdx     # 0xb116e
leaq 0x2f556(%rip), %r8      # 0xb0ab3
leaq 0x2f546(%rip), %r12     # 0xb0aaa
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
movq %r12, %r9
callq 0x80365
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
leaq 0x2708a(%rip), %rsi     # 0xa860f
movq %r14, %rdi
movl %ebx, %edx
movq %r12, %rcx
callq 0x7d912
movq %r14, %rdi
movl %ebx, %esi
callq 0x7db1b
addq $0x7a128, %rsp          # imm = 0x7A128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq