// File: /workspace/github_c_makefile_star2_O3/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 $0xb8, %rsp
movq %rcx, %r15
movq %rdi, %rbx
movslq 0x62110(%rdi), %rsi
xorl %r14d, %r14d
leaq 0x30(%rsp), %r12
movl %r14d, (%r12)
movq %rdx, (%rsp)
movq %rdx, %rdi
movq %r12, %rdx
callq 0xdbee
movslq 0x62110(%rbx), %rsi
movl %r14d, (%r12)
leaq 0x30(%rsp), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0xdbee
movq %r14, 0x10(%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
movslq 0x62110(%rbx), %rsi
leaq 0x50(%rsp), %rdx
movq %r14, (%rdx)
leaq 0x30(%rsp), %rdi
callq 0xda56
xorl %eax, %eax
leaq 0x50(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movslq 0x62110(%rbx), %rsi
leaq 0x70(%rsp), %rdx
movq %rax, (%rdx)
callq 0xda56
xorl %eax, %eax
leaq 0x70(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movslq 0x62110(%rbx), %rsi
leaq 0x90(%rsp), %rdx
movq %rax, (%rdx)
callq 0xda56
xorl %eax, %eax
leaq 0x90(%rsp), %rdi
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movslq 0x62110(%rbx), %rsi
leaq 0xb0(%rsp), %rdx
movq %rax, (%rdx)
callq 0xda56
movq %r15, 0xa8(%rsp)
movslq 0x62110(%rbx), %rax
movq 0x62140(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
andpd 0x424bd(%rip), %xmm0    # 0x4da90
movsd 0x4243d(%rip), %xmm1    # 0x4da18
ucomisd %xmm0, %xmm1
jae 0xb5f5
leaq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0xc800
jmp 0xb607
leaq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0xbf22
leaq 0x70(%rsp), %rsi
leaq 0x90(%rsp), %rdx
movq %rbx, %rdi
callq 0xd242
movslq 0x62118(%rbx), %r12
movl %r12d, %r13d
movslq 0x62110(%rbx), %rcx
cmpl %ecx, %r12d
movq %rcx, 0x68(%rsp)
jg 0xb73c
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
movsd 0xdbc11(%rip), %xmm0    # 0xe7268
movsd %xmm0, 0x10(%rsp)
movq (%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
xorl %ebp, %ebp
leaq 0xe0d8e(%rip), %r15     # 0xec400
leaq 0x1(%rbp), %r14
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0xd6c8
addsd 0x4239c(%rip), %xmm0    # 0x4da28
movq 0x20(%rsp), %rax
addsd (%rax,%rbp,8), %xmm0
movq 0x18(%rsp), %rax
addsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xd7b0
addsd 0x28(%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 0x68(%rsp), %rcx
mulss 0xe4d55(%rip), %xmm1    # 0xf0450
addss 0x50(%rax,%r15), %xmm1
mulss 0x54(%rax,%r15), %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x10(%rsp), %xmm0
divsd 0x42301(%rip), %xmm0    # 0x4da20
cvtsd2ss %xmm0, %xmm0
movq 0x8(%rsp), %rax
movss %xmm0, (%rax,%rbp,4)
leal (%r14,%r13), %eax
movq %r14, %rbp
cmpl %ecx, %eax
jle 0xb672
movq 0x90(%rsp), %rbp
cmpl %ecx, %r12d
jge 0xb87d
incl %r13d
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movsd 0xdbb06(%rip), %xmm0    # 0xe7268
movsd %xmm0, 0x18(%rsp)
movq (%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl %r12d, %eax
movq %rax, (%rsp)
movl $0x1, %r14d
movq (%rsp), %rax
leal (%rax,%r14), %r15d
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xd6c8
addsd 0x42279(%rip), %xmm0    # 0x4da28
addsd -0x8(%rbp,%r14,8), %xmm0
movq 0x20(%rsp), %rax
addsd -0x8(%rax,%r14,8), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xd7b0
addsd 0x28(%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 0xe4c38(%rip), %xmm1    # 0xf0450
leaq 0xe0be1(%rip), %rcx     # 0xec400
addss 0x50(%rax,%rcx), %xmm1
mulss 0x54(%rax,%rcx), %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x18(%rsp), %xmm0
divsd 0x421df(%rip), %xmm0    # 0x4da20
movq 0x10(%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 0x68(%rsp), %rax
jle 0xb791
jmp 0xb882
testq %rbp, %rbp
je 0xb895
movq 0xa0(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0x3230
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xb8af
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xb8c6
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb8dd
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb8f1
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0xb916
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xb916
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xb935
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xb935
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xb951
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xb951
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb968
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33e0