// File: /workspace/github_c_makefile_star2_O2/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, %r12
movl %ecx, %r15d
movq %rdx, %r13
movl %esi, %ebx
movq %rdi, %r14
movq %r8, %rdi
callq 0x2c3cc
movl %eax, %ebp
movl %eax, 0xc(%rsp)
movl 0x1bc(%r13), %edx
leaq 0x29efe(%rip), %rsi     # 0xa0af2
movq %r14, %rdi
movl %ebx, %ecx
callq 0x72674
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b0a
movl 0x1bc(%r13), %r8d
leaq 0x2abd5(%rip), %rcx     # 0xa17eb
leaq 0x33338b(%rip), %r9     # 0x3a9fa8
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x73bdf
movl 0x1bc(%r13), %r8d
leaq 0x1f7ec(%rip), %rcx     # 0x96424
leaq 0x333399(%rip), %r9     # 0x3a9fd8
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x73bdf
movl 0x1407128(%r13), %ecx
leaq 0x29e9f(%rip), %rdx     # 0xa0af9
movq %r14, %rdi
movl %ebx, %esi
callq 0x72aed
movl 0x1bc(%r13), %r9d
subq $0x8, %rsp
leaq 0x29446(%rip), %rcx     # 0xa00bc
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movl %ebp, %r8d
pushq %r12
callq 0x74003
popq %rax
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x72fb3
leaq 0x29f82(%rip), %r8      # 0xa0c1d
leaq 0x29c76(%rip), %r9      # 0xa0918
pushq $0x2
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x72de1
leaq 0x29e4b(%rip), %r11     # 0xa0b05
leaq 0x29c6b(%rip), %r10     # 0xa092c
leaq 0x29f49(%rip), %r8      # 0xa0c11
leaq 0x29b2b(%rip), %r9      # 0xa07fa
pushq $0x1
popq %r12
pushq $0x4
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
movl %r12d, %edx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x72de1
popq %rax
popq %rcx
movl 0x1bc(%r13), %r10d
leaq 0x29aef(%rip), %r11     # 0xa07e8
leaq 0x29b39(%rip), %rbp     # 0xa0839
leaq 0x29b22(%rip), %r8      # 0xa0829
pushq $0x3
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
movl %r12d, %ecx
movq %r8, %r12
movl %r15d, %r9d
movl $0x0, %eax
pushq %r10
pushq %r11
pushq $0x1
pushq %r15
pushq %rbp
pushq $0x0
callq 0x72b76
addq $0x30, %rsp
movq %r14, %rdi
movl %ebx, %esi
callq 0x726d3
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x75838
leaq 0x29e26(%rip), %r8      # 0xa0b75
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x741f5
leaq 0x2583d(%rip), %r8      # 0x9c5a3
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %rbp, %r12
movl %r15d, %ecx
callq 0x741f5
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movl 0xc(%rsp), %ecx
movl %r15d, %r8d
callq 0x74411
leaq 0x29de5(%rip), %rcx     # 0xa0b79
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29e71(%rip), %rdx     # 0xa0c11
callq 0x72b25
leal -0x1(%r15), %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29e68(%rip), %rbp     # 0xa0c1d
movq %rbp, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r9
callq 0x73938
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29b34(%rip), %r12     # 0xa0918
movq %r12, %rdx
movq %r13, %rcx
callq 0x72b25
movq %r13, %rdi
movl %ebx, %esi
leaq 0x292c1(%rip), %rdx     # 0xa00bc
movq %r12, %rcx
leaq 0x29cf4(%rip), %r8      # 0xa0af9
callq 0x7329c
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29cef(%rip), %rdx     # 0xa0b05
movq %r13, %rcx
callq 0x72b25
leaq 0x29cda(%rip), %rcx     # 0xa0aff
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29de0(%rip), %rdx     # 0xa0c11
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
leaq 0x29cc7(%rip), %rsi     # 0xa0b0e
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
leaq 0x29c94(%rip), %rsi     # 0xa0af2
movl %ebx, %edx
movq %r13, %rcx
callq 0x7308c
movq %r14, %rdi
movl %ebx, %esi
callq 0x7320f
addq $0x7a138, %rsp          # imm = 0x7A138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq