// File: /workspace/github_c_makefile_star2_O2/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 0x22461(%rip), %rsi     # 0x99cce
movl %ebx, %ecx
callq 0x72674
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b0a
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x29f5b(%rip), %rcx     # 0xa17eb
leaq 0x332711(%rip), %r9     # 0x3a9fa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x73bdf
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x1eb6e(%rip), %rcx     # 0x96424
leaq 0x33271b(%rip), %r9     # 0x3a9fd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x73bdf
movl 0x10(%r12), %ecx
movq 0x8(%r15), %r8
leaq 0x29289(%rip), %rdx     # 0xa0b63
pushq $0x1
popq %r9
movq %r14, %rdi
movl %ebx, %esi
callq 0x73cac
movl 0x10(%r12), %ecx
movl (%r15), %r8d
decl %r8d
leaq 0x23f97(%rip), %rdx     # 0x9b891
movq %r14, %rdi
movl %ebx, %esi
callq 0x73f26
pushq $0x8
popq %rbp
xorl %r13d, %r13d
movslq 0x10(%r12), %rax
cmpq %rax, %r13
jge 0x7793a
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 0x7280c
incq %r13
addq $0x10, %rbp
jmp 0x7790a
movq %r14, %rdi
movl %ebx, %esi
callq 0x73f75
movl 0x18(%r15), %ecx
movl 0x1c(%r15), %r8d
movq 0x20(%r15), %r9
leaq 0x28f4b(%rip), %rdx     # 0xa08a2
movq %r14, %rdi
movl %ebx, %esi
callq 0x73ec6
movq %r14, %rdi
movl %ebx, %esi
callq 0x72fb3
subq $0x8, %rsp
leaq 0x204aa(%rip), %r10     # 0x97e20
leaq 0x29369(%rip), %r11     # 0xa0ce6
leaq 0x2908a(%rip), %rbp     # 0xa0a0e
leaq 0x29292(%rip), %r8      # 0xa0c1d
leaq 0x28f86(%rip), %r9      # 0xa0918
pushq $0x5
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %rbp
callq 0x72de1
addq $0x20, %rsp
leaq 0x291b8(%rip), %r11     # 0xa0b6b
leaq 0x29257(%rip), %r13     # 0xa0c11
leaq 0x28f6b(%rip), %rbp     # 0xa092c
leaq 0x290d7(%rip), %r10     # 0xa0a9f
leaq 0x29197(%rip), %r8      # 0xa0b66
leaq 0x28ed9(%rip), %r9      # 0xa08af
pushq $0x1
popq %rdx
pushq $0x6
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
xorl %eax, %eax
pushq %r11
pushq %r13
pushq %rbp
pushq %r10
callq 0x72de1
addq $0x20, %rsp
movl (%r15), %r9d
decl %r9d
movl 0x1c0(%r12), %r10d
subq $0x8, %rsp
leaq 0x28ddc(%rip), %r11     # 0xa07e8
leaq 0x28e7f(%rip), %r8      # 0xa0892
pushq $0x2
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
pushq $0x1
popq %rcx
movl %ecx, %ebp
xorl %eax, %eax
pushq %r10
pushq %r11
pushq $0x1
callq 0x72b76
addq $0x20, %rsp
movq %r14, %rdi
movl %ebx, %esi
callq 0x726d3
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x753f5
movl (%r15), %ecx
decl %ecx
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x74f01
leaq 0x29111(%rip), %rcx     # 0xa0b74
movq %r14, %rdi
movl %ebx, %esi
leaq 0x290fc(%rip), %rdx     # 0xa0b6b
callq 0x72b25
movl 0x10(%r12), %r8d
decl %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29195(%rip), %r13     # 0xa0c1d
movq %r13, %rdx
xorl %ecx, %ecx
movl %ebp, %r9d
callq 0x73938
leaq 0x290c7(%rip), %rdx     # 0xa0b63
movq %rsp, %r12
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29159(%rip), %rbp     # 0xa0c11
movq %rbp, %rdx
movq %r12, %rcx
callq 0x72b25
movl (%r15), %r8d
addl $-0x2, %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x28e42(%rip), %r15     # 0xa0918
movq %r15, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r9
callq 0x73938
leaq 0x23da6(%rip), %rdx     # 0x9b891
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rcx
movq %r15, %r8
callq 0x7329c
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2905f(%rip), %rdx     # 0xa0b66
movq %r12, %rcx
callq 0x72b25
movq %r12, %rdi
movl %ebx, %esi
leaq 0x28d77(%rip), %rdx     # 0xa0892
movq %r15, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
leaq 0x28dfd(%rip), %rdx     # 0xa092c
movq %r12, %rcx
callq 0x72b25
leaq 0x2903f(%rip), %rcx     # 0xa0b7d
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
leaq 0x29576(%rip), %rdx     # 0xa10d2
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rcx
leaq 0x29000(%rip), %r8      # 0xa0b6b
leaq 0x28e9c(%rip), %r15     # 0xa0a0e
movq %r15, %r9
callq 0x752a9
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
leaq 0x22143(%rip), %rsi     # 0x99cce
movq %r14, %rdi
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