// File: /workspace/github_c_makefile_star2_O2/fukunagatsu[P]RIblast/rna_interaction_search.cpp
// Function: RnaInteractionSearch::Run(RnaInteractionSearchParameters)
void RnaInteractionSearch::Run(const RnaInteractionSearchParameters parameters){
  vector<string> sequences; sequences.reserve(500);
  vector<string> names; names.reserve(500);
  
  LoadDatabase(parameters.GetDbFilename(), parameters.GetHashSize());
  ReadFastaFile(parameters, sequences, names);
  int count = 0;
  cout << "RIblast ris mode has started." << endl;
  for(int i = 0; i<sequences.size();i++){
    vector<unsigned char> query_encoded_sequence; query_encoded_sequence.reserve(10);
    vector<int> query_suffix_array;
    vector<float> query_accessibility; query_accessibility.reserve(10);
    vector<float> query_conditional_accessibility; query_conditional_accessibility.reserve(10);
    string query_sequence = sequences[i];
    string query_name = names[i];
    cout << "Rna interaction search of query:" << names[i] << " has started." << endl;
    CalculateAccessibility(parameters, query_sequence, query_accessibility, query_conditional_accessibility);
    ConstructSuffixArray(parameters, query_sequence, query_encoded_sequence, query_suffix_array);
    vector<Hit> hit_result; hit_result.reserve(50000000);
    SearchSeed(parameters,hit_result, query_encoded_sequence, query_suffix_array, query_accessibility, query_conditional_accessibility);
    ExtendWithoutGap(parameters,hit_result, query_encoded_sequence, query_accessibility, query_conditional_accessibility);
    ExtendWithGap(parameters,hit_result, query_encoded_sequence, query_accessibility, query_conditional_accessibility);
    int length_count = 0;
    for(int j= 0; j<query_encoded_sequence.size();j++){
      if(query_encoded_sequence[j]>=2 && query_encoded_sequence[j]<=5){
	length_count++;
      }
    }
    Output(parameters,hit_result,query_name,i,&count,length_count);
    hit_result.clear();
    cout << "Rna interaction search of query:" << names[i] << " has finished." << endl;
  }
  cout << "RIblast ris mode has finished." << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5e8, %rsp            # imm = 0x5E8
movq %rsi, %rbp
movq %rdi, 0x18(%rsp)
xorps %xmm0, %xmm0
leaq 0xd0(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x5f58
leaq 0xb0(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x5f58
leaq 0x148(%rsp), %rdi
movq %rbp, %rsi
callq 0x32d0
movl 0x64(%rbp), %edx
leaq 0x148(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0xc3c8
leaq 0x148(%rsp), %rdi
callq 0x3100
leaq 0x188(%rsp), %rdi
movq %rbp, %rsi
callq 0x3f06
leaq 0x188(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
leaq 0xb0(%rsp), %rcx
callq 0xcaee
movq %rbp, 0x10(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x3f8a
andl $0x0, 0x2c(%rsp)
movq 0xd7166(%rip), %rdi     # 0xe2fd0
leaq 0x3bc49(%rip), %rsi     # 0x47aba
callq 0x31e0
movq %rax, %rdi
callq 0x3110
xorl %ebp, %ebp
xorps %xmm0, %xmm0
pushq $0xa
popq %r15
leaq 0x548(%rsp), %r12
leaq 0x4a8(%rsp), %r14
leaq 0x168(%rsp), %rbx
movq 0xd8(%rsp), %rax
subq 0xd0(%rsp), %rax
sarq $0x5, %rax
cmpq %rbp, %rax
jbe 0xc244
movq %rbp, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0xd634
xorps %xmm0, %xmm0
movaps %xmm0, 0xf0(%rsp)
andq $0x0, 0x100(%rsp)
movaps %xmm0, 0x90(%rsp)
andq $0x0, 0xa0(%rsp)
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
callq 0xd6be
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0xd6be
movq 0x20(%rsp), %r15
shlq $0x5, %r15
movq 0xd0(%rsp), %rsi
addq %r15, %rsi
leaq 0x108(%rsp), %rdi
callq 0x32d0
movq 0xb0(%rsp), %rsi
addq %r15, %rsi
leaq 0x128(%rsp), %rdi
callq 0x32d0
movq 0xd7064(%rip), %rdi     # 0xe2fd0
leaq 0x3bb65(%rip), %rsi     # 0x47ad8
callq 0x31e0
movq 0xb0(%rsp), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
leaq 0x3bb35(%rip), %rsi     # 0x47aca
callq 0x31e0
movq %rax, %rdi
callq 0x3110
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x3f06
movq %r12, %r13
movq %r12, %rsi
leaq 0x108(%rsp), %rdx
leaq 0x90(%rsp), %rcx
leaq 0x70(%rsp), %r8
callq 0xcb4a
movq %r13, %rdi
callq 0x3f8a
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x3f06
movq %r14, %r13
movq %r14, %rsi
leaq 0x108(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0xf0(%rsp), %r8
callq 0xcbb6
movq %r13, %rdi
callq 0x3f8a
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movl $0x2faf080, %esi        # imm = 0x2FAF080
leaq 0x50(%rsp), %rdi
callq 0xd754
leaq 0x408(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3f06
leaq 0x70(%rsp), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rdi
leaq 0x408(%rsp), %r13
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0xf0(%rsp), %r8
leaq 0x90(%rsp), %r9
callq 0xcc1c
movq %r13, %rdi
callq 0x3f8a
leaq 0x368(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3f06
movq 0x18(%rsp), %rdi
leaq 0x368(%rsp), %r13
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x90(%rsp), %r8
leaq 0x70(%rsp), %r9
callq 0xccf0
movq %r13, %rdi
callq 0x3f8a
leaq 0x2c8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3f06
movq 0x18(%rsp), %rdi
leaq 0x2c8(%rsp), %r13
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x90(%rsp), %r8
leaq 0x70(%rsp), %r9
callq 0xcd6c
movq %r13, %rdi
callq 0x3f8a
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
xorl %edx, %edx
xorl %r13d, %r13d
leaq 0x228(%rsp), %rdi
cmpq %rdx, %rcx
je 0xc13b
movb (%rax,%rdx), %sil
addb $-0x2, %sil
cmpb $0x4, %sil
adcl $0x0, %r13d
incq %rdx
jmp 0xc121
movq 0x10(%rsp), %rsi
callq 0x3f06
movq %rbx, %rdi
leaq 0x128(%rsp), %rsi
callq 0x32d0
movq %rbx, %rbp
movl %r13d, (%rsp)
movq 0x18(%rsp), %rdi
leaq 0x228(%rsp), %rbx
movq %rbx, %rsi
leaq 0x50(%rsp), %r13
movq %r13, %rdx
movq %rbp, %rcx
movq 0x20(%rsp), %r8
leaq 0x2c(%rsp), %r9
callq 0xce20
movq %rbp, %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3f8a
movq %r13, %rdi
callq 0xd7f6
movq 0xd6e2b(%rip), %rdi     # 0xe2fd0
leaq 0x3b92c(%rip), %rsi     # 0x47ad8
callq 0x31e0
movq %rbp, %rbx
addq 0xb0(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x31c0
movq %rax, %rdi
leaq 0x3b938(%rip), %rsi     # 0x47b09
callq 0x31e0
movq %rax, %rdi
callq 0x3110
leaq 0x50(%rsp), %rdi
callq 0xd7fe
leaq 0x128(%rsp), %rdi
callq 0x3100
leaq 0x108(%rsp), %rdi
callq 0x3100
leaq 0x70(%rsp), %rdi
callq 0x47e2
leaq 0x90(%rsp), %rdi
callq 0x47e2
leaq 0xf0(%rsp), %rdi
callq 0x4632
leaq 0x30(%rsp), %rdi
callq 0x4710
movq 0x20(%rsp), %rbp
incq %rbp
xorps %xmm0, %xmm0
pushq $0xa
popq %r15
jmp 0xbe9f
movq 0xd6d85(%rip), %rdi     # 0xe2fd0
leaq 0x3b8a7(%rip), %rsi     # 0x47af9
callq 0x31e0
movq %rax, %rdi
callq 0x3110
leaq 0xb0(%rsp), %rdi
callq 0x4144
leaq 0xd0(%rsp), %rdi
callq 0x4144
addq $0x5e8, %rsp            # imm = 0x5E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x3f8a
jmp 0xc3a6
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x3100
jmp 0xc3a6
movq %rax, %rbx
jmp 0xc3b3
jmp 0xc2bf
movq %rax, %rbx
jmp 0xc3a6
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x3100
jmp 0xc2dc
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
jmp 0xc327
movq %rax, %rbx
leaq 0x2c8(%rsp), %rdi
jmp 0xc327
movq %rax, %rbx
leaq 0x368(%rsp), %rdi
jmp 0xc327
jmp 0xc345
movq %rax, %rbx
jmp 0xc39c
movq %rax, %rbx
leaq 0x4a8(%rsp), %rdi
jmp 0xc33e
movq %rax, %rbx
jmp 0xc36b
movq %rax, %rbx
leaq 0x408(%rsp), %rdi
callq 0x3f8a
jmp 0xc34f
movq %rax, %rbx
jmp 0xc382
movq %rax, %rbx
leaq 0x548(%rsp), %rdi
callq 0x3f8a
jmp 0xc35e
movq %rax, %rbx
jmp 0xc378
jmp 0xc34c
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xd7fe
jmp 0xc35e
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x3100
leaq 0x108(%rsp), %rdi
callq 0x3100
leaq 0x70(%rsp), %rdi
callq 0x47e2
leaq 0x90(%rsp), %rdi
callq 0x47e2
leaq 0xf0(%rsp), %rdi
callq 0x4632
leaq 0x30(%rsp), %rdi
callq 0x4710
leaq 0xb0(%rsp), %rdi
callq 0x4144
leaq 0xd0(%rsp), %rdi
callq 0x4144
movq %rbx, %rdi
callq 0x33a0