// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rcx, %r15
movq %rdi, %rbx
movslq 0x62110(%rdi), %rsi
xorl %r14d, %r14d
leaq 0x40(%rsp), %r12
movl %r14d, (%r12)
movq %rdx, 0x8(%rsp)
movq %rdx, %rdi
movq %r12, %rdx
callq 0xcb34
movslq 0x62110(%rbx), %rsi
movl %r14d, (%r12)
leaq 0x40(%rsp), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0xcb34
movq %r14, 0x10(%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
movslq 0x62110(%rbx), %rsi
leaq 0x60(%rsp), %rdx
movq %r14, (%rdx)
leaq 0x40(%rsp), %rdi
callq 0xca3c
xorl %eax, %eax
leaq 0x60(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movslq 0x62110(%rbx), %rsi
leaq 0xa0(%rsp), %rdx
movq %rax, (%rdx)
callq 0xca3c
xorl %eax, %eax
leaq 0xa0(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movslq 0x62110(%rbx), %rsi
leaq 0x80(%rsp), %rdx
movq %rax, (%rdx)
callq 0xca3c
xorl %eax, %eax
leaq 0x80(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movslq 0x62110(%rbx), %rsi
leaq 0xc0(%rsp), %rdx
movq %rax, (%rdx)
callq 0xca3c
movq %r15, 0x10(%rsp)
movslq 0x62110(%rbx), %rax
movq 0x62140(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
andpd 0x424b1(%rip), %xmm0    # 0x4c9b0
movsd 0x42431(%rip), %xmm1    # 0x4c938
ucomisd %xmm0, %xmm1
jae 0xa521
leaq 0x40(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0xb80a
jmp 0xa533
leaq 0x40(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0xae7e
leaq 0xa0(%rsp), %rsi
leaq 0x80(%rsp), %rdx
movq %rbx, %rdi
callq 0xc22c
movslq 0x62118(%rbx), %r12
movl %r12d, %r13d
movslq 0x62110(%rbx), %rcx
cmpl %ecx, %r12d
movq %rcx, 0x78(%rsp)
jg 0xa66f
movq 0xa0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movsd 0xdbcdf(%rip), %xmm0    # 0xe6268
movsd %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
xorl %ebp, %ebp
leaq 0xe0e5b(%rip), %r15     # 0xeb400
leaq 0x1(%rbp), %r14
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0xc6ae
addsd 0x42389(%rip), %xmm0    # 0x4c948
movq 0x30(%rsp), %rax
addsd (%rax,%rbp,8), %xmm0
movq 0x28(%rsp), %rax
addsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xc796
addsd 0x38(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movd %xmm0, %eax
movl %eax, %ecx
andl $0x7f800000, %ecx       # imm = 0x7F800000
movl %eax, %edx
addl $0xc0800000, %ecx       # imm = 0xC0800000
andl $0xfff, %edx            # imm = 0xFFF
shrl $0x9, %eax
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
andl $0x3ff8, %eax           # imm = 0x3FF8
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
movq 0x78(%rsp), %rcx
mulss 0xe4e22(%rip), %xmm1    # 0xef450
addss 0x50(%rax,%r15), %xmm1
mulss 0x54(%rax,%r15), %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x20(%rsp), %xmm0
divsd 0x422ee(%rip), %xmm0    # 0x4c940
cvtsd2ss %xmm0, %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, (%rax,%rbp,4)
leal (%r14,%r13), %eax
movq %r14, %rbp
cmpl %ecx, %eax
jle 0xa5a5
cmpl %ecx, %r12d
jge 0xa7b8
incl %r13d
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x28(%rsp)
movsd 0xdbbce(%rip), %xmm0    # 0xe6268
movsd %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl %r12d, %eax
movq %rax, 0x10(%rsp)
movl $0x1, %r14d
leaq 0xe0d31(%rip), %rbp     # 0xeb400
movq 0x10(%rsp), %rax
leal (%rax,%r14), %r15d
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xc6ae
addsd 0x4225a(%rip), %xmm0    # 0x4c948
movq 0x30(%rsp), %rax
addsd -0x8(%rax,%r14,8), %xmm0
movq 0x28(%rsp), %rax
addsd -0x8(%rax,%r14,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xc796
addsd 0x38(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movd %xmm0, %eax
movl %eax, %ecx
andl $0x7f800000, %ecx       # imm = 0x7F800000
movl %eax, %edx
addl $0xc0800000, %ecx       # imm = 0xC0800000
andl $0xfff, %edx            # imm = 0xFFF
shrl $0x9, %eax
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
andl $0x3ff8, %eax           # imm = 0x3FF8
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss 0xe4cf4(%rip), %xmm1    # 0xef450
addss 0x50(%rax,%rbp), %xmm1
mulss 0x54(%rax,%rbp), %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x20(%rsp), %xmm0
divsd 0x421c2(%rip), %xmm0    # 0x4c940
movq 0x18(%rsp), %rax
xorps %xmm1, %xmm1
cvtss2sd -0x4(%rax,%r14,4), %xmm1
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movslq %r15d, %rax
movq 0x8(%rsp), %rcx
movss %xmm0, -0x4(%rcx,%rax,4)
leaq (%r12,%r14), %rax
incq %rax
incq %r14
cmpq 0x78(%rsp), %rax
jle 0xa6cf
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0xa7d5
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xa7f2
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xa809
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xa820
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa834
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0xa859
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xa859
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xa87b
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xa87b
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xa897
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xa897
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xa8ae
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33e0