// File: /workspace/github_c_makefile_star2_O3/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 0x26427(%rip), %rsi     # 0xa9da6
movl %ebx, %ecx
callq 0x7ce21
cmpl $0x2, %ebx
jne 0x839a4
leaq 0x2c90b(%rip), %rdi     # 0xb029d
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x2ded5(%rip), %rcx     # 0xb188b
leaq 0x32e5eb(%rip), %r9     # 0x3b1fa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e724
movl 0x1c0(%r12), %r8d
decl %r8d
leaq 0x22a48(%rip), %rcx     # 0xa6424
leaq 0x32e5f5(%rip), %r9     # 0x3b1fd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e724
movl 0x10(%r12), %ecx
movq 0x8(%r15), %r8
leaq 0x2d1ff(%rip), %rdx     # 0xb0bff
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %r9d
callq 0x7e7f5
movl 0x10(%r12), %ecx
movl (%r15), %r8d
decl %r8d
leaq 0x27f4b(%rip), %rdx     # 0xab96d
movq %r14, %rdi
movl %ebx, %esi
callq 0x7eac9
cmpl $0x0, 0x10(%r12)
jle 0x83a6a
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 0x7cfdc
incq %r13
movslq 0x10(%r12), %rax
addq $0x10, %rbp
cmpq %rax, %r13
jl 0x83a3c
cmpl $0x5, %ebx
ja 0x83a8e
movl %ebx, %eax
leaq 0x501e8(%rip), %rcx     # 0xd3c60
movq (%rcx,%rax,8), %rdi
movl $0x3, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x18(%r15), %ecx
movl 0x1c(%r15), %r8d
movq 0x20(%r15), %r9
leaq 0x2ce9d(%rip), %rdx     # 0xb093e
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ea43
cmpl $0x2, %ebx
jne 0x83bc3
leaq 0x2c845(%rip), %rdi     # 0xb0300
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
subq $0x8, %rsp
leaq 0x243c8(%rip), %r10     # 0xa7ea0
leaq 0x2d2a3(%rip), %r11     # 0xb0d82
leaq 0x2cfc4(%rip), %r13     # 0xb0aaa
leaq 0x2d1cc(%rip), %r8      # 0xb0cb9
leaq 0x2cec0(%rip), %r9      # 0xb09b4
movq %r14, %rdi
movl $0x2, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
callq 0x7d617
addq $0x20, %rsp
leaq 0x2d0ec(%rip), %r10     # 0xb0c07
leaq 0x2d18b(%rip), %r11     # 0xb0cad
leaq 0x2ce9f(%rip), %r13     # 0xb09c8
leaq 0x2d00b(%rip), %rbp     # 0xb0b3b
leaq 0x2d0cb(%rip), %r8      # 0xb0c02
leaq 0x2ce0d(%rip), %r9      # 0xb094b
movq %r14, %rdi
movl $0x2, %esi
movl $0x1, %edx
movl $0x6, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
pushq %rbp
callq 0x7d617
addq $0x20, %rsp
movl (%r15), %r9d
decl %r9d
movl 0x1c0(%r12), %r10d
subq $0x8, %rsp
leaq 0x2cd09(%rip), %r11     # 0xb0884
leaq 0x2cdac(%rip), %r8      # 0xb092e
movq %r14, %rdi
movl $0x2, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq $0x1
callq 0x7d384
addq $0x20, %rsp
leaq 0x2c564(%rip), %rdi     # 0xb0110
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x83c92
subq $0x8, %rsp
leaq 0x242d2(%rip), %r10     # 0xa7ea0
leaq 0x2d1ad(%rip), %r11     # 0xb0d82
leaq 0x2cece(%rip), %r13     # 0xb0aaa
leaq 0x2d0d6(%rip), %r8      # 0xb0cb9
leaq 0x2cdca(%rip), %r9      # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x5, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
callq 0x7d617
addq $0x20, %rsp
leaq 0x2cff9(%rip), %r10     # 0xb0c07
leaq 0x2d098(%rip), %r11     # 0xb0cad
leaq 0x2cdac(%rip), %r13     # 0xb09c8
leaq 0x2cf18(%rip), %rbp     # 0xb0b3b
leaq 0x2cfd8(%rip), %r8      # 0xb0c02
leaq 0x2cd1a(%rip), %r9      # 0xb094b
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x6, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
pushq %rbp
callq 0x7d617
addq $0x20, %rsp
movl (%r15), %r9d
decl %r9d
movl 0x1c0(%r12), %r10d
subq $0x8, %rsp
leaq 0x2cc19(%rip), %r11     # 0xb0884
leaq 0x2ccbc(%rip), %r8      # 0xb092e
movq %r14, %rdi
movl %ebx, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq $0x1
callq 0x7d384
addq $0x20, %rsp
incl 0x32e550(%rip)          # 0x3b21e8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x8050d
movl (%r15), %ecx
decl %ecx
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7feaa
leaq 0x2cf44(%rip), %rdx     # 0xb0c07
leaq 0x2cf46(%rip), %rcx     # 0xb0c10
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movl 0x10(%r12), %r8d
decl %r8d
leaq 0x2cfd6(%rip), %rdx     # 0xb0cb9
movq %r14, %rdi
movl %ebx, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
cmpl $0x5, %ebx
ja 0x83d1f
movl %ebx, %eax
leaq 0x5007d(%rip), %rcx     # 0xd3d80
movq (%rcx,%rax,8), %rsi
leaq 0x2cef1(%rip), %rdx     # 0xb0bff
leaq 0x2cfa4(%rip), %rcx     # 0xb0cb9
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2cf87(%rip), %rdx     # 0xb0cad
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movl (%r15), %r8d
addl $-0x2, %r8d
leaq 0x2cc73(%rip), %rdx     # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
cmpl $0x5, %ebx
ja 0x83d84
movl %ebx, %eax
leaq 0x4ff8f(%rip), %rcx     # 0xd3cf0
movq (%rcx,%rax,8), %rsi
leaq 0x27c01(%rip), %rdx     # 0xab96d
leaq 0x2cf46(%rip), %rcx     # 0xb0cb9
leaq 0x2cc3a(%rip), %r8      # 0xb09b4
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2ce77(%rip), %rdx     # 0xb0c02
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x83dc2
movl %ebx, %eax
leaq 0x4ffda(%rip), %rcx     # 0xd3d80
movq (%rcx,%rax,8), %rsi
leaq 0x2cb7d(%rip), %rdx     # 0xb092e
leaq 0x2cbfc(%rip), %rcx     # 0xb09b4
movq %rsp, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2cbff(%rip), %rdx     # 0xb09c8
movq %rsp, %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
leaq 0x2ced0(%rip), %r15     # 0xb0cad
leaq 0x2ce35(%rip), %rcx     # 0xb0c19
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
leaq 0x2d36c(%rip), %rdx     # 0xb116e
leaq 0x2cdfe(%rip), %r8      # 0xb0c07
leaq 0x2cc9a(%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 0x25f75(%rip), %rsi     # 0xa9da6
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