// File: afinit[P]afin/fusion.cpp
// Function: Fusion::sort_matches()
void Fusion::sort_matches(){
  Mismatch temp_mim;

  // sort by overlap length
  for( int i=0; i<match_list.size(); i++ ){
    for( int j=i; j<match_list.size(); j++ ){
      if( match_list[i].get_length() < match_list[j].get_length() ){
        temp_mim = match_list[i];
        match_list[i] = match_list[j];
        match_list[j] = temp_mim;
      }
    }
  }

  // sort by score
  for( int i=0; i<match_list.size(); i++ ){
    for( int j=i; j<match_list.size(); j++ ){
      if( match_list[i].get_score() > match_list[j].get_score() ){
        temp_mim = match_list[i];
        match_list[i] = match_list[j];
        match_list[j] = temp_mim;
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xfe80
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x2c(%rbp), %rax
movq %rax, -0x48(%rbp)
addq $0x10, %rdi
callq 0x15530
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x13cbb
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
addq $0x10, %rdi
callq 0x15530
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x13cab
movq -0x40(%rbp), %rdi
addq $0x10, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x15550
movq %rax, %rdi
callq 0x10010
movq -0x40(%rbp), %rdi
movl %eax, -0x54(%rbp)
addq $0x10, %rdi
movslq -0x30(%rbp), %rsi
callq 0x15550
movq %rax, %rdi
callq 0x10010
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
jge 0x13c9b
movq -0x40(%rbp), %rdi
addq $0x10, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x15550
movq -0x40(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl 0x18(%rax), %eax
movl %eax, -0x10(%rbp)
addq $0x10, %rdi
movslq -0x30(%rbp), %rsi
callq 0x15550
movq -0x40(%rbp), %rdi
movq %rax, -0x60(%rbp)
addq $0x10, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x15550
movq -0x60(%rbp), %rcx
movq -0x40(%rbp), %rdi
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
addq $0x10, %rdi
movslq -0x30(%rbp), %rsi
callq 0x15550
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x10(%rbp), %ecx
movl %ecx, 0x18(%rax)
jmp 0x13c9d
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x13b92
jmp 0x13cad
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x13b67
movl $0x0, -0x34(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x34(%rbp), %rax
movq %rax, -0x68(%rbp)
addq $0x10, %rdi
callq 0x15530
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x13e1d
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
addq $0x10, %rdi
callq 0x15530
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0x13e0d
movq -0x40(%rbp), %rdi
addq $0x10, %rdi
movslq -0x34(%rbp), %rsi
callq 0x15550
movq %rax, %rdi
callq 0xfff0
movq -0x40(%rbp), %rdi
movsd %xmm0, -0x78(%rbp)
addq $0x10, %rdi
movslq -0x38(%rbp), %rsi
callq 0x15550
movq %rax, %rdi
callq 0xfff0
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13dfd
movq -0x40(%rbp), %rdi
addq $0x10, %rdi
movslq -0x34(%rbp), %rsi
callq 0x15550
movq -0x40(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x18(%rbp)
movl 0x18(%rax), %eax
movl %eax, -0x10(%rbp)
addq $0x10, %rdi
movslq -0x38(%rbp), %rsi
callq 0x15550
movq -0x40(%rbp), %rdi
movq %rax, -0x80(%rbp)
addq $0x10, %rdi
movslq -0x34(%rbp), %rsi
callq 0x15550
movq -0x80(%rbp), %rcx
movq -0x40(%rbp), %rdi
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
addq $0x10, %rdi
movslq -0x38(%rbp), %rsi
callq 0x15550
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x10(%rbp), %ecx
movl %ecx, 0x18(%rax)
jmp 0x13dff
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x13ced
jmp 0x13e0f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x13cc2
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)