// File: /workspace/github_c_makefile_star2_O1/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 $0xf4248, %rsp          # imm = 0xF4248
movl %r8d, %r15d
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
leal -0x1(%rcx), %r8d
leaq 0x3058d(%rip), %rdx     # 0xadc21
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7d478
decl %r15d
leaq 0x30264(%rip), %r12     # 0xad91c
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r15d, %ecx
xorl %r8d, %r8d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0x7ca9f
leaq 0x30155(%rip), %rdx     # 0xad82d
leaq 0x7a120(%rsp), %r13
movq %r13, %rdi
movl %ebx, %esi
movq %r12, %rcx
callq 0x7c24c
leaq 0x287fc(%rip), %rsi     # 0xa5ef0
leaq 0x3051a(%rip), %rdx     # 0xadc15
movq %rsp, %rbp
movl %ebx, %edi
movq %r13, %rcx
movq %rbp, %r8
callq 0x7c601
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
callq 0x7c75c
leaq 0x3043e(%rip), %rsi     # 0xadb5d
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x287c8(%rip), %rsi     # 0xa5efb
movq %rsp, %r15
movl %ebx, %edi
movq %r12, %rdx
movq %r13, %rcx
movq %r15, %r8
callq 0x7c601
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7c75c
leaq 0x300dd(%rip), %rcx     # 0xad837
movq %r13, %rdi
movl %ebx, %esi
leaq 0x300c7(%rip), %r15     # 0xad82d
movq %r15, %rdx
callq 0x7c24c
movq %rsp, %rbp
movq %rbp, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x7c24c
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x7ba46
leaq 0x300a5(%rip), %r15     # 0xad83d
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
leaq 0x30090(%rip), %rcx     # 0xad837
callq 0x7c24c
movq %rbp, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x7c24c
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
movq %r13, %rdi
movl %ebx, %esi
leaq 0x3004b(%rip), %rdx     # 0xad82d
movq %r12, %rcx
callq 0x7c24c
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
leaq 0x3041c(%rip), %rcx     # 0xadc15
callq 0x7ba46
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x7c24c
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
leaq 0x30404(%rip), %rcx     # 0xadc21
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c8ac
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ccf4
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
addq $0xf4248, %rsp          # imm = 0xF4248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq