// File: /workspace/github_c_makefile_star2_O0/fukunagatsu[P]RIblast/rna_interaction_search.cpp
// Function: RnaInteractionSearch::CheckRedundancy(std::vector<Hit, std::allocator<Hit>>&, double)
void RnaInteractionSearch::CheckRedundancy(vector<Hit> &hit_result, double energy_threshold){
  for(int i = 0; i<hit_result.size();i++){
    if(hit_result[i].GetEnergy() > energy_threshold){
      hit_result[i].SetFlag();
    }

    if(!hit_result[i].GetFlag()){
      int a_QSp = hit_result[i].GetQSp();
      int a_DbSp = hit_result[i].GetDbSp();
      int a_QEp = a_QSp+hit_result[i].GetQLength()-1;
      int a_DbEp = a_DbSp+hit_result[i].GetDbLength()-1;

      for(int j = i+1; j<hit_result.size();j++){
        if(!hit_result[j].GetFlag()){
          int b_DbSp = hit_result[j].GetDbSp();
          if(a_DbEp < b_DbSp){
            break;
          }

          int b_QSp = hit_result[j].GetQSp();
          int b_QEp = b_QSp+hit_result[j].GetQLength()-1;
          int b_DbEp = b_DbSp+hit_result[j].GetDbLength()-1;
          if(a_QEp>=b_QEp && a_QSp <= b_QSp && a_DbEp >= b_DbEp){
	    if(hit_result[i].GetEnergy() > hit_result[j].GetEnergy()){
	      hit_result[i].SetFlag();
	    }else{
	      hit_result[j].SetFlag();
	    }
          }
        }
      }
    }
  }
  hit_result.erase(remove_if(hit_result.begin(), hit_result.end(), CheckFlag()), hit_result.end());

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20650
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jae 0x1f917
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x20800
ucomisd -0x18(%rbp), %xmm0
jbe 0x1f6c7
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x208e0
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x20900
testb $0x1, %al
jne 0x1f907
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1fb10
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1faf0
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x90(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1fb50
movw %ax, %cx
movl -0x90(%rbp), %eax
movzwl %cx, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1fb30
movw %ax, %cx
movl -0x8c(%rbp), %eax
movzwl %cx, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movslq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20650
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x1f905
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x20900
testb $0x1, %al
jne 0x1f8f5
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1faf0
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x1f7ea
jmp 0x1f905
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1fb10
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1fb50
movw %ax, %cx
movl -0xa0(%rbp), %eax
movzwl %cx, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x9c(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x1fb30
movw %ax, %cx
movl -0x9c(%rbp), %eax
movzwl %cx, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jl 0x1f8f3
movl -0x20(%rbp), %eax
cmpl -0x38(%rbp), %eax
jg 0x1f8f3
movl -0x2c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jl 0x1f8f3
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x20800
movsd %xmm0, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x20800
movaps %xmm0, %xmm1
movsd -0xa8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1f8dc
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x208e0
jmp 0x1f8f1
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x20680
movq %rax, %rdi
callq 0x208e0
jmp 0x1f8f3
jmp 0x1f8f5
jmp 0x1f8f7
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1f781
jmp 0x1f907
jmp 0x1f909
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1f66f
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20560
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20590
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x209b0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x209f0
movq -0x10(%rbp), %rdi
callq 0x20590
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x209f0
movq -0xb0(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x70(%rbp), %rdx
callq 0x20920
movq %rax, -0x80(%rbp)
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)