// File: /workspace/github_c_makefile_star2_O2/fukunagatsu[P]RIblast/raccess.cpp
// Function: Raccess::CalcAccessibility(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::vector<float, std::allocator<float>>&, std::vector<float, std::allocator<float>>&)
void Raccess::CalcAccessibility(string &sequence,vector<float> &accessibility, vector<float> &conditional_accessibility){
  double prob = 0.0;
  accessibility.resize(_seq_length, 0.0);
  conditional_accessibility.resize(_seq_length, 0.0);

  vector<double> biloop_probability; biloop_probability.resize(_seq_length, 0.0);
  vector<double> conditional_biloop_probability; conditional_biloop_probability.resize(_seq_length, 0.0);

  vector<double> hairpin_probability; hairpin_probability.resize(_seq_length, 0.0);
  vector<double> conditional_hairpin_probability; conditional_hairpin_probability.resize(_seq_length, 0.0);

  double pf = _Alpha_outer[_seq_length];
  if(pf >= -690 && pf <= 690){
    CalcBulgeAndInternalProbability(biloop_probability, conditional_biloop_probability);
  }else{
    CalcLogSumBulgeAndInternalProbability(biloop_probability, conditional_biloop_probability);
  }
  CalcHairpinProbability(hairpin_probability, conditional_hairpin_probability);

  for(int i = 1; i+_min_accessible_length-1 <=_seq_length;i++){
    prob += CalcExteriorProbability(i,_min_accessible_length);
    prob += hairpin_probability[i-1];
    prob += biloop_probability[i-1];
    prob += CalcMultiProbability(i,_min_accessible_length);
    accessibility[i-1] = (-fmath::log((float)prob)*kT)/1000;
    prob = 0.0;
  }
  
  for(int i = 1; i+_min_accessible_length-1 < _seq_length;i++){
    prob += CalcExteriorProbability(i,_min_accessible_length+1);
    prob += conditional_hairpin_probability[i-1];
    prob += conditional_biloop_probability[i-1];
    prob += CalcMultiProbability(i,_min_accessible_length+1);
    conditional_accessibility[i+_min_accessible_length-1] = (-fmath::log((float)prob)*kT)/1000 - accessibility[i-1];
    prob = 0.0;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movslq 0x62110(%rdi), %rsi
leaq 0x20(%rsp), %r12
andl $0x0, (%r12)
movq %rdx, %rdi
movq %r12, %rdx
callq 0xa916
movslq 0x62110(%r15), %rsi
andl $0x0, (%r12)
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0xa916
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
andq $0x0, 0x10(%r12)
movslq 0x62110(%r15), %rsi
leaq 0x40(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x20(%rsp), %rdi
callq 0xa746
leaq 0x40(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movslq 0x62110(%r15), %rsi
leaq 0x80(%rsp), %rdx
andq $0x0, (%rdx)
callq 0xa746
xorpd %xmm0, %xmm0
leaq 0x80(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movslq 0x62110(%r15), %rsi
leaq 0x60(%rsp), %rdx
andq $0x0, (%rdx)
callq 0xa746
leaq 0x60(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movslq 0x62110(%r15), %rsi
leaq 0x98(%rsp), %rdx
andq $0x0, (%rdx)
callq 0xa746
movslq 0x62110(%r15), %rax
movq 0x62140(%r15), %rcx
movsd (%rcx,%rax,8), %xmm0
andpd 0x3ea7e(%rip), %xmm0    # 0x479b0
movsd 0x3e9fe(%rip), %xmm1    # 0x47938
ucomisd %xmm0, %xmm1
jae 0x8f54
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %r15, %rdi
callq 0x9b7e
jmp 0x8f66
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %r15, %rdi
callq 0x9626
leaq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %r15, %rdi
callq 0xa2a6
xorl %r13d, %r13d
movl 0x62110(%r15), %eax
movl 0x62118(%r15), %edx
leal (%rdx,%r13), %ecx
cmpl %eax, %ecx
jg 0x9034
leaq 0x1(%r13), %r12
movq %r15, %rdi
movl %r12d, %esi
callq 0xa56c
movsd %xmm0, 0x18(%rsp)
movq 0x80(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x62118(%r15), %edx
movq %r15, %rdi
movl %r12d, %esi
callq 0xa59e
movsd 0x18(%rsp), %xmm1
addsd 0x3e956(%rip), %xmm1    # 0x47948
addsd 0x10(%rsp), %xmm1
addsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
callq 0xa80c
cvtss2sd %xmm0, %xmm0
mulsd 0xda251(%rip), %xmm0    # 0xe3268
divsd 0x3e921(%rip), %xmm0    # 0x47940
cvtsd2ss %xmm0, %xmm0
movq (%r14), %rax
movss %xmm0, (%rax,%r13,4)
movq %r12, %r13
jmp 0x8f7e
pushq $0x1
popq %r12
xorl %r13d, %r13d
leal (%rdx,%r12), %ecx
cmpl %eax, %ecx
jg 0x9107
incl %edx
movq %r15, %rdi
movl %r12d, %esi
callq 0xa56c
movsd %xmm0, 0x18(%rsp)
movq 0x60(%rsp), %rax
movsd (%rax,%r13,2), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x40(%rsp), %rax
movsd (%rax,%r13,2), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x62118(%r15), %edx
incl %edx
movq %r15, %rdi
movl %r12d, %esi
callq 0xa59e
movsd 0x18(%rsp), %xmm1
addsd 0x3e8aa(%rip), %xmm1    # 0x47948
addsd 0x10(%rsp), %xmm1
addsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
callq 0xa80c
cvtss2sd %xmm0, %xmm0
mulsd 0xda1a5(%rip), %xmm0    # 0xe3268
divsd 0x3e875(%rip), %xmm0    # 0x47940
movq (%r14), %rax
cvtss2sd (%rax,%r13), %xmm1
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movslq 0x62118(%r15), %rdx
movq %rdx, %rax
shlq $0x2, %rax
addq (%rbx), %rax
movss %xmm0, (%r13,%rax)
movl 0x62110(%r15), %eax
addq $0x4, %r13
incl %r12d
jmp 0x903b
leaq 0x60(%rsp), %rdi
callq 0x6a68
leaq 0x80(%rsp), %rdi
callq 0x6a68
leaq 0x40(%rsp), %rdi
callq 0x6a68
leaq 0x20(%rsp), %rdi
callq 0x6a68
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x9158
movq %rax, %rbx
jmp 0x9165
movq %rax, %rbx
jmp 0x9172
movq %rax, %rbx
jmp 0x917c
jmp 0x9158
jmp 0x9158
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x6a68
leaq 0x80(%rsp), %rdi
callq 0x6a68
leaq 0x40(%rsp), %rdi
callq 0x6a68
leaq 0x20(%rsp), %rdi
callq 0x6a68
movq %rbx, %rdi
callq 0x33a0