// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xf4260, %rsp          # imm = 0xF4260
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %r8d
subl $0x1, %r8d
leaq 0x3b1f6(%rip), %rdx     # 0xed329
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0xb10b0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0xb1ef0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
leaq 0x3aec0(%rip), %rdx     # 0xed024
xorl %r8d, %r8d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xb10b0
leaq -0x7a140(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3adb2(%rip), %rdx     # 0xecf35
leaq 0x3ae9a(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %r8
leaq 0x3391c(%rip), %rdx     # 0xe5ac0
leaq 0x3b172(%rip), %rcx     # 0xed31d
callq 0xb0d00
leaq -0x7a140(%rbp), %rdi
movl -0x20(%rbp), %edx
subl $0x1, %edx
leaq 0x3b0a1(%rip), %rsi     # 0xed265
movb $0x0, %al
callq 0x4170
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %r8
leaq 0x338eb(%rip), %rdx     # 0xe5acb
leaq 0x3ae3d(%rip), %rcx     # 0xed024
callq 0xb0d00
leaq -0x7a140(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3ad38(%rip), %rdx     # 0xecf35
leaq 0x3ad3b(%rip), %rcx     # 0xecf3f
callq 0xb04c0
leaq -0xf4260(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3ad1b(%rip), %rdx     # 0xecf35
leaq 0x3ae03(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %rdx
leaq -0xf4260(%rbp), %rcx
callq 0xafa00
leaq -0x7a140(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3acf4(%rip), %rdx     # 0xecf45
leaq 0x3ace7(%rip), %rcx     # 0xecf3f
callq 0xb04c0
leaq -0xf4260(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3acd7(%rip), %rdx     # 0xecf45
leaq 0x3adaf(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %rdx
leaq -0xf4260(%rbp), %rcx
callq 0xafa00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0ec0
leaq -0x7a140(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3ac84(%rip), %rdx     # 0xecf35
leaq 0x3ad6c(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %rdx
leaq 0x3b04b(%rip), %rcx     # 0xed31d
callq 0xafa00
leaq -0x7a140(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3ac5d(%rip), %rdx     # 0xecf45
leaq 0x3ad35(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %rdx
leaq 0x3b020(%rip), %rcx     # 0xed329
callq 0xafa00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0e70
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb13b0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0ec0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3ace4(%rip), %rdx     # 0xed024
callq 0xb13f0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3afd6(%rip), %rdx     # 0xed329
callq 0xb13f0
addq $0xf4260, %rsp          # imm = 0xF4260
popq %rbp
retq
nopw %cs:(%rax,%rax)