// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/savecode.c
// Function: generate_test_code_ldaclass
void generate_test_code_ldaclass(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, Model_ldaclassptr m)
{
 /*!Last Changed 16.06.2006*/
 char st[MAXLENGTH];
 int i;
 code_function_header(testcodefile, "ldaclass", 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, "w0", d->classno, m->w0, REAL_TYPE);
 code_2d_array_start(testcodefile, language, "w", d->classno, m->newfeaturecount - 1);
 for (i = 0; i < d->classno; i++)
   code_constant_subarray(testcodefile, language, m->newfeaturecount - 1, m->w[i].values[0], i);
 code_2d_array_end(testcodefile, language);  
 code_2d_array_constant(testcodefile, language, "eigenvectors", m->eigenvectors.row, m->eigenvectors.col, m->eigenvectors.values);
 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, "w_ij", "eigenvectors_ij", "x_i", "x_j", "sum", "maxvalue");
 code_add_array_variable(testcodefile, language, 2, REAL_VARIABLE, "testdatareduced", m->newfeaturecount - 1, REAL_VARIABLE, "testdataconverted", d->multifeaturecount);
 code_start(testcodefile, language);
	code_realize(testcodefile, language, d, YES);
 code_dimension_reduce(testcodefile, language, d, m->newfeaturecount - 1);    
 code_set_variable(testcodefile, language, "maxvalue", "-10000.0"); 
 code_for(testcodefile, language, "i", 0, d->classno - 1, 1);     
 code_array_index_variable(st, language, "w0", "i");  
 code_set_variable(testcodefile, language, "sum", st); 
 code_for(testcodefile, language, "j", 0, m->newfeaturecount - 2, 1);     
 code_2d_array_index_variable(st, language, "w", "i", "j");
 code_set_variable(testcodefile, language, "w_ij", st);
 code_array_index_variable(st, language, "testdatareduced", "j");  
 code_set_variable(testcodefile, language, "x_j", st); 
 code_set_variable(testcodefile, language, "sum", "sum + w_ij * x_j"); 
 code_endfor(testcodefile, language, "j");
 code_compare_and_set_bound(testcodefile, language, ">", "sum", "maxvalue", "maxindex"); 
 code_endfor(testcodefile, language, "i");
 code_function_return_string(testcodefile, "ldaclass", 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 0x256f1(%rip), %rsi     # 0xa6d36
movl %ebx, %ecx
callq 0x7b551
cmpl $0x2, %ebx
jne 0x8166a
leaq 0x2bbad(%rip), %rdi     # 0xad205
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x2d17f(%rip), %rcx     # 0xae7fb
leaq 0x32d925(%rip), %r9     # 0x3aefa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7cde7
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x21d82(%rip), %rcx     # 0xa3424
leaq 0x32d92f(%rip), %r9     # 0x3aefd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7cde7
movl 0x10(%r12), %ecx
movq 0x8(%r15), %r8
leaq 0x2c4a1(%rip), %rdx     # 0xadb67
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %r9d
callq 0x7ceb8
movl 0x10(%r12), %ecx
movl (%r15), %r8d
decl %r8d
leaq 0x271b9(%rip), %rdx     # 0xa88a1
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d134
cmpl $0x0, 0x10(%r12)
jle 0x81730
movl $0x8, %ebp
xorl %r13d, %r13d
movl (%r15), %edx
decl %edx
movq 0x10(%r15), %rax
movq (%rax,%rbp), %rax
movq (%rax), %rcx
movq %r14, %rdi
movl %ebx, %esi
movl %r13d, %r8d
callq 0x7b706
incq %r13
movslq 0x10(%r12), %rax
addq $0x10, %rbp
cmpq %rax, %r13
jl 0x81702
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d183
movl 0x18(%r15), %ecx
movl 0x1c(%r15), %r8d
movq 0x20(%r15), %r9
leaq 0x2c159(%rip), %rdx     # 0xad8a6
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d0d5
cmpl $0x2, %ebx
jne 0x81866
leaq 0x2bb01(%rip), %rdi     # 0xad268
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
subq $0x8, %rsp
leaq 0x236c4(%rip), %r10     # 0xa4e48
leaq 0x2c55f(%rip), %r11     # 0xadcea
leaq 0x2c280(%rip), %r13     # 0xada12
leaq 0x2c488(%rip), %r8      # 0xadc21
leaq 0x2c17c(%rip), %r9      # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
callq 0x7bd1c
addq $0x20, %rsp
leaq 0x2c3ab(%rip), %r10     # 0xadb6f
leaq 0x2c44a(%rip), %r11     # 0xadc15
leaq 0x2c15e(%rip), %r13     # 0xad930
leaq 0x2c2ca(%rip), %rbp     # 0xadaa3
leaq 0x2c38a(%rip), %r8      # 0xadb6a
leaq 0x2c0cc(%rip), %r9      # 0xad8b3
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x6, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
pushq %rbp
callq 0x7bd1c
addq $0x20, %rsp
movl (%r15), %r9d
decl %r9d
movl 0x1c0(%r12), %r10d
subq $0x8, %rsp
leaq 0x2bfcb(%rip), %r11     # 0xad7ec
leaq 0x2c06e(%rip), %r8      # 0xad896
movq %r14, %rdi
movl %ebx, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq $0x1
callq 0x7bab4
addq $0x20, %rsp
leaq 0x2b829(%rip), %rdi     # 0xad078
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x81935
subq $0x8, %rsp
leaq 0x235d7(%rip), %r10     # 0xa4e48
leaq 0x2c472(%rip), %r11     # 0xadcea
leaq 0x2c193(%rip), %r13     # 0xada12
leaq 0x2c39b(%rip), %r8      # 0xadc21
leaq 0x2c08f(%rip), %r9      # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
callq 0x7bd1c
addq $0x20, %rsp
leaq 0x2c2be(%rip), %r10     # 0xadb6f
leaq 0x2c35d(%rip), %r11     # 0xadc15
leaq 0x2c071(%rip), %r13     # 0xad930
leaq 0x2c1dd(%rip), %rbp     # 0xadaa3
leaq 0x2c29d(%rip), %r8      # 0xadb6a
leaq 0x2bfdf(%rip), %r9      # 0xad8b3
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x6, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
pushq %rbp
callq 0x7bd1c
addq $0x20, %rsp
movl (%r15), %r9d
decl %r9d
movl 0x1c0(%r12), %r10d
subq $0x8, %rsp
leaq 0x2bede(%rip), %r11     # 0xad7ec
leaq 0x2bf81(%rip), %r8      # 0xad896
movq %r14, %rdi
movl %ebx, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq $0x1
callq 0x7bab4
addq $0x20, %rsp
incl 0x32d8ad(%rip)          # 0x3af1e8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x7e795
movl (%r15), %ecx
decl %ecx
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e25d
leaq 0x2c209(%rip), %rdx     # 0xadb6f
leaq 0x2c20b(%rip), %rcx     # 0xadb78
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
movl 0x10(%r12), %r8d
decl %r8d
leaq 0x2c29b(%rip), %r13     # 0xadc21
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
leaq 0x2c1c5(%rip), %rdx     # 0xadb67
movq %rsp, %rbp
movq %rbp, %rdi
movl %ebx, %esi
movq %r13, %rcx
callq 0x7c24c
leaq 0x2c25c(%rip), %r12     # 0xadc15
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x7ba46
movl (%r15), %r8d
addl $-0x2, %r8d
leaq 0x2bf45(%rip), %r15     # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
leaq 0x26eae(%rip), %rdx     # 0xa88a1
movq %rbp, %rdi
movl %ebx, %esi
movq %r13, %rcx
movq %r15, %r8
callq 0x7c269
leaq 0x2c160(%rip), %rdx     # 0xadb6a
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rcx
callq 0x7ba46
leaq 0x2be78(%rip), %rdx     # 0xad896
movq %rbp, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7c24c
leaq 0x2befe(%rip), %rdx     # 0xad930
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rcx
callq 0x7ba46
leaq 0x2c13b(%rip), %rcx     # 0xadb81
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
leaq 0x2c672(%rip), %rdx     # 0xae0d6
leaq 0x2bfa7(%rip), %r15     # 0xada12
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
leaq 0x2c0f5(%rip), %r8      # 0xadb6f
movq %r15, %r9
callq 0x7e616
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
leaq 0x252a3(%rip), %rsi     # 0xa6d36
movq %r14, %rdi
movl %ebx, %edx
movq %r15, %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