// File: /workspace/github_c_makefile_star2_O3/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 0x30309
movl %eax, %ebp
movl 0x1bc(%r12), %edx
leaq 0x2e402(%rip), %rsi     # 0xb0b8e
movq %r14, %rdi
movl %ebx, %ecx
callq 0x7ce21
movl %ebx, %eax
movq %rax, 0x8(%rsp)
cmpl $0x2, %ebx
jne 0x8281b
leaq 0x2daf4(%rip), %rdi     # 0xb029d
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x1bc(%r12), %r8d
leaq 0x2f0c1(%rip), %rcx     # 0xb188b
leaq 0x32f7d7(%rip), %r9     # 0x3b1fa8
movq %r14, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x7e724
movl 0x1bc(%r12), %r8d
leaq 0x23c34(%rip), %rcx     # 0xa6424
leaq 0x32f7e1(%rip), %r9     # 0x3b1fd8
movq %r14, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x7e724
movl 0x1407128(%r12), %ecx
leaq 0x2da69(%rip), %rsi     # 0xb027f
jmp 0x828be
movl 0x1bc(%r12), %r8d
leaq 0x2f061(%rip), %rcx     # 0xb188b
leaq 0x32f777(%rip), %r9     # 0x3b1fa8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e724
movl 0x1bc(%r12), %r8d
leaq 0x23bd7(%rip), %rcx     # 0xa6424
leaq 0x32f784(%rip), %r9     # 0x3b1fd8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e724
cmpl $0x5, %ebx
ja 0x8288c
movl 0x1407128(%r12), %ecx
leaq 0x2d7b7(%rip), %rax     # 0xb002c
movq 0x8(%rsp), %rdx
movslq (%rax,%rdx,4), %rdx
addq %rax, %rdx
jmpq *%rdx
leaq 0x2d9ef(%rip), %rsi     # 0xb0279
jmp 0x828be
movl 0x1bc(%r12), %r9d
subq $0x8, %rsp
leaq 0x2d8b9(%rip), %rcx     # 0xb0158
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %r8d
pushq %r13
callq 0x7ebcd
addq $0x10, %rsp
jmp 0x8291a
leaq 0x2d9cb(%rip), %rsi     # 0xb0289
leaq 0x2e2d0(%rip), %rdx     # 0xb0b95
movq %r14, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x1bc(%r12), %r9d
subq $0x8, %rsp
leaq 0x2d876(%rip), %rcx     # 0xb0158
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %r8d
pushq %r13
callq 0x7ebcd
addq $0x10, %rsp
cmpl $0x2, %ebx
jne 0x829e5
leaq 0x2d9f8(%rip), %rdi     # 0xb0300
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
leaq 0x2e398(%rip), %r8      # 0xb0cb9
leaq 0x2e08c(%rip), %r9      # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x7d617
leaq 0x2e25f(%rip), %r10     # 0xb0ba1
leaq 0x2e07f(%rip), %r11     # 0xb09c8
leaq 0x2e35d(%rip), %r8      # 0xb0cad
leaq 0x2df3f(%rip), %r9      # 0xb0896
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x4, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x7d617
addq $0x10, %rsp
movl 0x1bc(%r12), %r10d
leaq 0x2df00(%rip), %r11     # 0xb0884
leaq 0x2df4a(%rip), %r13     # 0xb08d5
leaq 0x2df33(%rip), %r8      # 0xb08c5
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 0x7d384
addq $0x30, %rsp
cmpl $0x2, %ebx
jne 0x82a89
leaq 0x2d742(%rip), %rdi     # 0xb0110
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x82a89
leaq 0x2e2cd(%rip), %r8      # 0xb0cb9
leaq 0x2dfc1(%rip), %r9      # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x7d617
leaq 0x2e194(%rip), %r10     # 0xb0ba1
leaq 0x2dfb4(%rip), %r11     # 0xb09c8
leaq 0x2e292(%rip), %r8      # 0xb0cad
leaq 0x2de74(%rip), %r9      # 0xb0896
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x4, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x7d617
addq $0x10, %rsp
movl 0x1bc(%r12), %r10d
leaq 0x2de35(%rip), %r11     # 0xb0884
leaq 0x2de7f(%rip), %r13     # 0xb08d5
leaq 0x2de68(%rip), %r8      # 0xb08c5
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 0x7d384
addq $0x30, %rsp
incl 0x32f759(%rip)          # 0x3b21e8
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x80ac7
leaq 0x2de22(%rip), %rdx     # 0xb08c5
leaq 0x2e167(%rip), %r8      # 0xb0c11
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %ecx
callq 0x7ee51
leaq 0x2de17(%rip), %rdx     # 0xb08d5
leaq 0x29bba(%rip), %r8      # 0xac67f
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %ecx
callq 0x7ee51
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %ecx
movl %r15d, %r8d
callq 0x7f0f5
leaq 0x2e1c2(%rip), %rdx     # 0xb0cad
leaq 0x2e123(%rip), %rcx     # 0xb0c15
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
leal -0x1(%r15), %r8d
leaq 0x2e1b2(%rip), %rdx     # 0xb0cb9
movq %r14, %rdi
movl %ebx, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
cmpl $0x5, %ebx
ja 0x82b48
leaq 0x5125b(%rip), %rax     # 0xd3d80
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x2dda0(%rip), %rdx     # 0xb08d5
leaq 0x2e17d(%rip), %rcx     # 0xb0cb9
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2de65(%rip), %rdx     # 0xb09b4
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x82b94
leaq 0x51186(%rip), %rax     # 0xd3cf0
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x2d5de(%rip), %rdx     # 0xb0158
leaq 0x2de33(%rip), %rcx     # 0xb09b4
leaq 0x2e00d(%rip), %r8      # 0xb0b95
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2e006(%rip), %rdx     # 0xb0ba1
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7d316
leaq 0x2e0f9(%rip), %rdx     # 0xb0cad
leaq 0x2dfe0(%rip), %rcx     # 0xb0b9b
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
leaq 0x2dfd4(%rip), %rsi     # 0xb0baa
movq %r12, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x2dfa4(%rip), %rsi     # 0xb0b8e
movq %r14, %rdi
movl %ebx, %edx
movq %r12, %rcx
callq 0x7d912
movq %r14, %rdi
movl %ebx, %esi
callq 0x7db1b
addq $0x7a138, %rsp          # imm = 0x7A138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq