// File: /workspace/github_c_makefile_star2_O2/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 0x2c7e5(%rip), %rdx     # 0xa0c1d
pushq $0x1
popq %r9
xorl %ecx, %ecx
callq 0x73938
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x74269
decl %r15d
leaq 0x2c4be(%rip), %r12     # 0xa0918
pushq $-0x1
popq %r9
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x73938
leaq 0x2c3b1(%rip), %rbp     # 0xa0829
leaq 0x7a120(%rsp), %r13
movq %r13, %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x7327f
leaq 0x249f9(%rip), %rdx     # 0x98e90
leaq 0x2c773(%rip), %rcx     # 0xa0c11
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %r8
callq 0x736fc
leaq 0x2c6a7(%rip), %rsi     # 0xa0b59
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x249d5(%rip), %rdx     # 0x98e9b
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %r15
movq %r12, %rcx
movq %r13, %r8
callq 0x736fc
leaq 0x2c353(%rip), %rcx     # 0xa0833
movq %r13, %rdi
movl %ebx, %esi
movq %rbp, %rdx
callq 0x7327f
movq %rsp, %r12
movq %r12, %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %r15, %rcx
movq %r15, %rbp
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %r12, %rcx
callq 0x72b25
leaq 0x2c31f(%rip), %r15     # 0xa0839
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
leaq 0x2c30a(%rip), %rcx     # 0xa0833
callq 0x7327f
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %r12, %rcx
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
movq %r13, %rdi
movl %ebx, %esi
leaq 0x2c2c5(%rip), %rdx     # 0xa0829
movq %rbp, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
leaq 0x2c696(%rip), %rcx     # 0xa0c11
callq 0x72b25
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x7327f
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
leaq 0x2c67e(%rip), %rcx     # 0xa0c1d
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b3e
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
addq $0xf4248, %rsp          # imm = 0xF4248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq