// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/savecode.c
// Function: code_sort_according_to_distances
void code_sort_according_to_distances(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, int size, int nearcount)
{
 /*!Last Changed 13.06.2006*/
 char st[MAXLENGTH], st2[MAXLENGTH];
 code_for(testcodefile, language, "i", 0, size - 1, 1);   
 code_calculate_distance(testcodefile, language, d); 
 code_for(testcodefile, language, "j", nearcount - 1, 0, -1);   
 code_array_index_variable(st, language, "distances", "j");  
 code_if(testcodefile, language, "<", "sum", st);
 sprintf(st, "%d", nearcount - 1);
 code_if(testcodefile, language, "!=", "j", st);
 code_array_index_variable(st, language, "distances", "j + 1");  
 code_array_index_variable(st2, language, "distances", "j");  
 code_set_variable(testcodefile, language, st, st2);  
 code_array_index_variable(st, language, "indexes", "j + 1");  
 code_array_index_variable(st2, language, "indexes", "j");  
 code_set_variable(testcodefile, language, st, st2);  
 code_endif(testcodefile, language);
 code_array_index_variable(st, language, "distances", "j");  
 code_set_variable(testcodefile, language, st, "sum");
 code_array_index_variable(st, language, "indexes", "j");  
 code_set_variable(testcodefile, language, st, "i");
 code_else(testcodefile, language);
 code_break(testcodefile, language);
 code_endif(testcodefile, language);
 code_endfor(testcodefile, language, "j");
 code_endfor(testcodefile, language, "i");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf4258, %rsp          # imm = 0xF4258
movl %r8d, %ebp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
leal -0x1(%rcx), %r8d
leaq 0x31b9d(%rip), %rdx     # 0xb0cb9
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7eed1
decl %ebp
leaq 0x31875(%rip), %rdx     # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %ecx
xorl %r8d, %r8d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0x7e3dc
movl %ebx, %r15d
leaq 0x54c22(%rip), %r13     # 0xd3d80
cmpl $0x5, %ebx
ja 0x7f182
movq (%r13,%r15,8), %rsi
leaq 0x31756(%rip), %rdx     # 0xb08c5
leaq 0x3183e(%rip), %rcx     # 0xb09b4
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
movq %r15, 0x8(%rsp)
leaq 0x29d92(%rip), %rsi     # 0xa8f20
leaq 0x31b18(%rip), %rdx     # 0xb0cad
leaq 0x10(%rsp), %r15
leaq 0x7a130(%rsp), %r12
movl %ebx, %edi
movq %r15, %rcx
movq %r12, %r8
callq 0x7df46
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e093
leaq 0x31a32(%rip), %rsi     # 0xb0bf5
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x29d55(%rip), %rsi     # 0xa8f2b
leaq 0x317d7(%rip), %rdx     # 0xb09b4
leaq 0x7a130(%rsp), %r12
movl %ebx, %edi
movq %r15, %rcx
movq %r12, %r8
callq 0x7df46
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e093
movslq %ebx, %r12
cmpl $0x5, %ebx
ja 0x7f26e
movl $0xb, %eax
btl %ebx, %eax
jae 0x7f21a
leaq 0x3116c(%rip), %rsi     # 0xb0384
jmp 0x7f22f
movl $0x30, %eax
btl %ebx, %eax
jae 0x7f3cf
leaq 0x31167(%rip), %rsi     # 0xb0396
leaq 0x3168f(%rip), %rdx     # 0xb08c5
leaq 0x31692(%rip), %rcx     # 0xb08cf
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
movq (%r13,%r12,8), %r15
leaq 0x31670(%rip), %rdx     # 0xb08c5
leaq 0x31758(%rip), %rcx     # 0xb09b4
leaq 0x7a130(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
leaq 0x10(%rsp), %rdx
leaq 0x7a130(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x7f2f1
movl $0xb, %eax
btl %ebx, %eax
jae 0x7f29d
leaq 0x310e9(%rip), %rsi     # 0xb0384
jmp 0x7f2b2
movl $0x30, %eax
btl %ebx, %eax
jae 0x7f3f8
leaq 0x310e4(%rip), %rsi     # 0xb0396
leaq 0x3161c(%rip), %rdx     # 0xb08d5
leaq 0x3160f(%rip), %rcx     # 0xb08cf
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
movq (%r13,%r12,8), %r15
leaq 0x315fd(%rip), %rdx     # 0xb08d5
leaq 0x316d5(%rip), %rcx     # 0xb09b4
leaq 0x7a130(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
leaq 0x10(%rsp), %rdx
leaq 0x7a130(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e23a
cmpl $0x5, %ebx
movq 0x8(%rsp), %r15
ja 0x7f33b
movq (%r13,%r15,8), %rsi
leaq 0x3159d(%rip), %rdx     # 0xb08c5
leaq 0x31685(%rip), %rcx     # 0xb09b4
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x3196b(%rip), %rcx     # 0xb0cad
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x7f375
movq (%r13,%r15,8), %rsi
leaq 0x31573(%rip), %rdx     # 0xb08d5
leaq 0x3164b(%rip), %rcx     # 0xb09b4
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x3193d(%rip), %rcx     # 0xb0cb9
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e1e3
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e631
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e23a
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
addq $0xf4258, %rsp          # imm = 0xF4258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30fb5(%rip), %r15     # 0xb038b
leaq 0x314e8(%rip), %rdx     # 0xb08c5
leaq 0x314eb(%rip), %rcx     # 0xb08cf
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
jmp 0x7f24e
leaq 0x30f8c(%rip), %r15     # 0xb038b
leaq 0x314cf(%rip), %rdx     # 0xb08d5
leaq 0x314c2(%rip), %rcx     # 0xb08cf
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
jmp 0x7f2d1