// File: /workspace/github_c_makefile_star2_O1/fukunagatsu[P]RIblast/raccess.cpp
// Function: Raccess::LoopEnergy(int, int, int, int, int, int)
double Raccess::LoopEnergy(int type, int type2,int i,int j,int p,int q){
  double z=0;
  int u1 = p-i-1;
  int u2 = j-q-1;
  
  if ((u1==0) && (u2==0)){
    z = stack[type][type2];
  }else{
    if ((u1==0)||(u2==0)) {
      int u;
      u = u1 == 0 ? u2 : u1;
      z = u <=30 ? bulge[u] : bulge[30] - lxc37*log( u/30.)*10./kT;
      
      if (u == 1){
	z += stack[type][type2];
      }else {
	if (type>2){ z += TermAU;}
	if (type2>2){ z += TermAU;}
      }
    }else{     
      if (u1+u2==2) {
	z = int11[type][type2][_int_sequence[i+1]][_int_sequence[j-1]];
      }else if ((u1==1) && (u2==2)){
	z = int21[type][type2][_int_sequence[i+1]][_int_sequence[q+1]][_int_sequence[j-1]];
      }else if ((u1==2) && (u2==1)){
	z = int21[type2][type][_int_sequence[q+1]][_int_sequence[i+1]][_int_sequence[p-1]];
      }else if ((u1==2) && (u2==2)){
	z = int22[type][type2][_int_sequence[i+1]][_int_sequence[p-1]][_int_sequence[q+1]][_int_sequence[j-1]];
      }else{
	z = internal[u1+u2]+mismatchI[type][_int_sequence[i+1]][_int_sequence[j-1]]+mismatchI[type2][_int_sequence[q+1]][_int_sequence[p-1]];
	z += ninio[abs(u1-u2)];
      }
    }
  }
  return z;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movl 0x30(%rsp), %eax
movl %ecx, %edx
notl %edx
addl %r9d, %edx
movl %eax, %r15d
notl %r15d
addl %r8d, %r15d
movl %r15d, %esi
orl %edx, %esi
je 0xa913
testl %edx, %edx
setne %sil
testl %r15d, %r15d
setne %dil
testb %dil, %sil
jne 0xa92e
testl %edx, %edx
cmovnel %edx, %r15d
cmpl $0x1e, %r15d
jg 0xa982
movslq %r15d, %rax
movsd 0xd70(%rbx,%rax,8), %xmm0
jmp 0xa9c1
movslq %r14d, %rax
imulq $0x38, %rax, %rax
addq %rax, %rbx
movslq %ebp, %rax
movsd 0xbe8(%rbx,%rax,8), %xmm0
jmp 0xaac3
leal (%r15,%rdx), %esi
cmpl $0x2, %esi
jne 0xa9e2
movslq %r14d, %rax
imulq $0x640, %rax, %rax      # imm = 0x640
addq %rbx, %rax
movslq %ebp, %rdx
movq 0x620f8(%rbx), %rsi
movslq %ecx, %rcx
movslq 0x4(%rsi,%rcx,4), %rcx
movslq %r8d, %rdi
movslq -0x4(%rsi,%rdi,4), %rsi
imulq $0xc8, %rdx, %rdx
addq %rax, %rdx
leaq (%rcx,%rcx,4), %rax
leaq (%rdx,%rax,8), %rax
movsd 0xe70(%rax,%rsi,8), %xmm0
jmp 0xaac3
movsd 0xe60(%rbx), %xmm0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
divsd 0x41fb1(%rip), %xmm0    # 0x4c950
callq 0x31b0
mulsd 0x41fac(%rip), %xmm0    # 0x4c958
mulsd 0x10ea4(%rip), %xmm0    # 0x1b858
divsd 0xdb8ac(%rip), %xmm0    # 0xe6268
addsd (%rsp), %xmm0
cmpl $0x1, %r15d
jne 0xaa40
movslq %r14d, %rax
imulq $0x38, %rax, %rax
addq %rax, %rbx
movslq %ebp, %rax
addsd 0xbe8(%rbx,%rax,8), %xmm0
jmp 0xaac3
movl %edx, %r10d
xorl $0x1, %r10d
movl %r15d, %edi
xorl $0x2, %edi
orl %edi, %r10d
jne 0xaa5d
movslq %r14d, %rdx
imulq $0x1f40, %rdx, %rdx     # imm = 0x1F40
addq %rbx, %rdx
movslq %ebp, %rsi
movq 0x620f8(%rbx), %rdi
movslq %ecx, %rcx
movslq 0x4(%rdi,%rcx,4), %rcx
cltq
movslq 0x4(%rdi,%rax,4), %rax
movslq %r8d, %r8
movslq -0x4(%rdi,%r8,4), %rdi
imulq $0x3e8, %rsi, %rsi      # imm = 0x3E8
addq %rdx, %rsi
imulq $0xc8, %rcx, %rcx
addq %rsi, %rcx
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rax
jmp 0xaaba
movsd 0xe68(%rbx), %xmm1
cmpl $0x3, %r14d
jl 0xaa52
addsd %xmm1, %xmm0
cmpl $0x3, %ebp
jl 0xaac3
addsd %xmm1, %xmm0
jmp 0xaac3
movl %edx, %r10d
xorl $0x2, %r10d
movl %r15d, %r11d
xorl $0x1, %r11d
orl %r10d, %r11d
jne 0xaace
movslq %ebp, %rdx
imulq $0x1f40, %rdx, %rdx     # imm = 0x1F40
addq %rbx, %rdx
movslq %r14d, %rsi
movq 0x620f8(%rbx), %rdi
cltq
movslq 0x4(%rdi,%rax,4), %rax
movslq %ecx, %rcx
movslq 0x4(%rdi,%rcx,4), %rcx
movslq %r9d, %r8
movslq -0x4(%rdi,%r8,4), %rdi
imulq $0x3e8, %rsi, %rsi      # imm = 0x3E8
addq %rdx, %rsi
imulq $0xc8, %rax, %rax
addq %rsi, %rax
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rax
movsd 0x4070(%rax,%rdi,8), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
orl %edi, %r10d
jne 0xab3a
movslq %r14d, %rdx
imulq $0x9c40, %rdx, %rdx     # imm = 0x9C40
addq %rbx, %rdx
movslq %ebp, %rsi
movq 0x620f8(%rbx), %rdi
movslq %ecx, %rcx
movslq 0x4(%rdi,%rcx,4), %rcx
movslq %r9d, %r9
movslq -0x4(%rdi,%r9,4), %r9
cltq
movslq 0x4(%rdi,%rax,4), %rax
movslq %r8d, %r8
movslq -0x4(%rdi,%r8,4), %rdi
imulq $0x1388, %rsi, %rsi     # imm = 0x1388
addq %rdx, %rsi
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
addq %rsi, %rcx
imulq $0xc8, %r9, %rdx
addq %rcx, %rdx
leaq (%rax,%rax,4), %rax
leaq (%rdx,%rax,8), %rax
movsd 0x13a70(%rax,%rdi,8), %xmm0
jmp 0xaac3
movslq %esi, %rsi
movsd 0x61c70(%rbx,%rsi,8), %xmm0
movslq %r14d, %rsi
movq 0x620f8(%rbx), %rdi
movslq %ecx, %rcx
movslq 0x4(%rdi,%rcx,4), %rcx
movslq %r8d, %r8
movslq -0x4(%rdi,%r8,4), %r8
imulq $0xc8, %rsi, %rsi
addq %rbx, %rsi
addq $0x670, %rsi            # imm = 0x670
leaq (%rcx,%rcx,4), %rcx
leaq (%rsi,%rcx,8), %rcx
addsd (%rcx,%r8,8), %xmm0
movslq %ebp, %rcx
cltq
movslq 0x4(%rdi,%rax,4), %rax
movslq %r9d, %rsi
movslq -0x4(%rdi,%rsi,4), %rsi
imulq $0xc8, %rcx, %rcx
addq %rbx, %rcx
addq $0x670, %rcx            # imm = 0x670
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rax
addsd (%rax,%rsi,8), %xmm0
subl %r15d, %edx
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
addsd 0x62000(%rbx,%rax,8), %xmm0
jmp 0xaac3
nop