// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/savecode.c
// Function: generate_test_code_knnreg
void generate_test_code_knnreg(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, int nearcount, Instanceptr m)
{
 /*!Last Changed 13.06.2006*/
 char st[MAXLENGTH];
 int size = data_size(m);
 code_function_header(testcodefile, "knnreg", d->featurecount, language);
 code_constant_start(testcodefile, language);
	code_1d_array_constant_instance(testcodefile, language, d, "mean", d->featurecount, &mean);
	code_1d_array_constant_instance(testcodefile, language, d, "variance", d->featurecount, &variance);
 code_constant_integer(testcodefile, language, "regno", d->classdefno);
 code_2d_array_constant_instance(testcodefile, language, d, "m", size, d->featurecount, m);
 code_variable_start(testcodefile, language);
 code_add_variable(testcodefile, language, INTEGER_VARIABLE, 2, "i", "j");
 code_add_variable(testcodefile, language, REAL_VARIABLE, 4, "sum", "m_ij", "x_j", "regvalue");
 code_add_array_variable(testcodefile, language, 3, REAL_VARIABLE, "distances", nearcount, INTEGER_VARIABLE, "indexes", nearcount, REAL_VARIABLE, "testdataconverted", d->featurecount);
 code_start(testcodefile, language);
	code_normalize(testcodefile, language, d);
 code_array_initialize(testcodefile, language, "distances", nearcount, "10000.0");
 code_array_initialize(testcodefile, language, "indexes", nearcount, "-1");
 code_sort_according_to_distances(testcodefile, language, d, size, nearcount);
 code_set_variable(testcodefile, language, "sum", "0.0");
 code_for(testcodefile, language, "i", 0, nearcount - 1, 1);     
 code_array_index_variable(st, language, "indexes", "i");  
 code_set_variable(testcodefile, language, "j", st); 
 code_2d_array_index_variable(st, language, "m", "j", "regno");
 code_set_variable(testcodefile, language, "regvalue", st);
 code_set_variable(testcodefile, language, "sum", "sum + regvalue");
 code_endfor(testcodefile, language, "i");
 sprintf(st, "sum / %d", nearcount);
 code_function_return_string(testcodefile, "knnreg", language, st);   
 code_function_end(testcodefile, language);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a138, %rsp          # imm = 0x7A138
movq %r8, %r13
movl %ecx, %r15d
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
movq %r8, %rdi
callq 0x2fa14
movl %eax, %ebp
movl 0x1bc(%r12), %edx
leaq 0x2d568(%rip), %rsi     # 0xadaf6
movq %r14, %rdi
movl %ebx, %ecx
callq 0x7b551
cmpl $0x2, %ebx
jne 0x80660
leaq 0x2cc5d(%rip), %rdi     # 0xad205
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x1bc(%r12), %r8d
leaq 0x2e232(%rip), %rcx     # 0xae7fb
leaq 0x32e9d8(%rip), %r9     # 0x3aefa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7cde7
movl 0x1bc(%r12), %r8d
leaq 0x22e38(%rip), %rcx     # 0xa3424
leaq 0x32e9e5(%rip), %r9     # 0x3aefd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7cde7
movl 0x1407128(%r12), %ecx
leaq 0x2d4ee(%rip), %rdx     # 0xadafd
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba0a
movl 0x1bc(%r12), %r9d
subq $0x8, %rsp
leaq 0x2ca94(%rip), %rcx     # 0xad0c0
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %r8d
pushq %r13
callq 0x7d214
addq $0x10, %rsp
leaq 0x2cc1f(%rip), %rdi     # 0xad268
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x806e8
movl 0x1bc(%r12), %r8d
leaq 0x2e18c(%rip), %rcx     # 0xae7fb
leaq 0x32e932(%rip), %r9     # 0x3aefa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7cde7
movl 0x1bc(%r12), %r8d
leaq 0x22d92(%rip), %rcx     # 0xa3424
leaq 0x32e93f(%rip), %r9     # 0x3aefd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7cde7
movl 0x1407128(%r12), %ecx
leaq 0x2d448(%rip), %rdx     # 0xadafd
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba0a
movl 0x1bc(%r12), %r9d
subq $0x8, %rsp
leaq 0x2c9ee(%rip), %rcx     # 0xad0c0
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %r8d
pushq %r13
callq 0x7d214
addq $0x10, %rsp
movl %ebp, 0xc(%rsp)
leaq 0x2d52e(%rip), %r8      # 0xadc21
leaq 0x2d222(%rip), %r9      # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x7bd1c
leaq 0x2d3f5(%rip), %r10     # 0xadb09
leaq 0x2d215(%rip), %r11     # 0xad930
leaq 0x2d4f3(%rip), %r8      # 0xadc15
leaq 0x2d0d5(%rip), %r9      # 0xad7fe
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x4, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x7bd1c
addq $0x10, %rsp
movl 0x1bc(%r12), %r10d
leaq 0x2d096(%rip), %r11     # 0xad7ec
leaq 0x2d0e0(%rip), %r13     # 0xad83d
leaq 0x2d0c9(%rip), %r8      # 0xad82d
movq %r14, %rdi
movl %ebx, %esi
movl $0x3, %edx
movl $0x1, %ecx
movl %r15d, %r9d
movl $0x0, %eax
pushq %r10
pushq %r11
pushq $0x1
pushq %r15
pushq %r13
pushq $0x0
callq 0x7bab4
addq $0x30, %rsp
cmpl $0x2, %ebx
jne 0x807ae
leaq 0x2c8dc(%rip), %rdi     # 0xad078
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
incl 0x32ea34(%rip)          # 0x3af1e8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7ec45
leaq 0x2d065(%rip), %rdx     # 0xad82d
leaq 0x2d3aa(%rip), %r8      # 0xadb79
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %ecx
callq 0x7d402
leaq 0x2d05a(%rip), %rbp     # 0xad83d
leaq 0x28dc9(%rip), %r8      # 0xa95b3
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
movl %r15d, %ecx
callq 0x7d402
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl 0xc(%rsp), %ecx
movl %r15d, %r8d
callq 0x7d66d
leaq 0x2d400(%rip), %rdx     # 0xadc15
leaq 0x2d361(%rip), %rcx     # 0xadb7d
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
leal -0x1(%r15), %r8d
leaq 0x2d3f0(%rip), %r13     # 0xadc21
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x7c24c
leaq 0x2d0ba(%rip), %r13     # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %r12, %rcx
callq 0x7ba46
leaq 0x2c847(%rip), %rdx     # 0xad0c0
leaq 0x2d27d(%rip), %r8      # 0xadafd
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rcx
callq 0x7c269
leaq 0x2d275(%rip), %rdx     # 0xadb09
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7ba46
leaq 0x2d25b(%rip), %rcx     # 0xadb03
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2d361(%rip), %rdx     # 0xadc15
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
leaq 0x2d248(%rip), %rsi     # 0xadb12
movq %r12, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x2d218(%rip), %rsi     # 0xadaf6
movq %r14, %rdi
movl %ebx, %edx
movq %r12, %rcx
callq 0x7bffb
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c1ca
addq $0x7a138, %rsp          # imm = 0x7A138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq