// File: /workspace/github_c_makefile_star2_O3/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, %esi
notl %esi
addl %r9d, %esi
movl %eax, %edx
notl %edx
addl %r8d, %edx
movl %edx, %edi
orl %esi, %edi
je 0xb9e6
testl %esi, %esi
setne %dil
testl %edx, %edx
setne %r10b
testb %r10b, %dil
jne 0xba01
testl %esi, %esi
cmovnel %esi, %edx
cmpl $0x1f, %edx
jge 0xba54
movslq %edx, %rax
movsd 0xd70(%rbx,%rax,8), %xmm0
cmpl $0x1, %edx
jne 0xba92
movslq %r14d, %rax
imulq $0x38, %rax, %rax
addq %rax, %rbx
movslq %ebp, %rax
addsd 0xbe8(%rbx,%rax,8), %xmm0
jmp 0xbb7b
movslq %r14d, %rax
imulq $0x38, %rax, %rax
addq %rax, %rbx
movslq %ebp, %rax
movsd 0xbe8(%rbx,%rax,8), %xmm0
jmp 0xbb7b
leal (%rdx,%rsi), %edi
cmpl $0x2, %edi
jne 0xbab6
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 0xbb7b
movsd 0xe60(%rbx), %xmm0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
divsd 0x41fc0(%rip), %xmm0    # 0x4da30
callq 0x31b0
mulsd 0x41fbb(%rip), %xmm0    # 0x4da38
mulsd 0x10ebb(%rip), %xmm0    # 0x1c940
divsd 0xdb7db(%rip), %xmm0    # 0xe7268
addsd (%rsp), %xmm0
movsd 0xe68(%rbx), %xmm1
cmpl $0x3, %r14d
jl 0xbaa4
addsd %xmm1, %xmm0
cmpl $0x3, %ebp
jl 0xbb7b
addsd %xmm1, %xmm0
jmp 0xbb7b
movl %esi, %r11d
xorl $0x1, %r11d
movl %edx, %r10d
xorl $0x2, %r10d
orl %r10d, %r11d
jne 0xbb15
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 0xbb72
movl %esi, %r11d
xorl $0x2, %r11d
movl %edx, %r15d
xorl $0x1, %r15d
orl %r11d, %r15d
jne 0xbb86
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 %r10d, %r11d
jne 0xbbf2
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 0xbb7b
movslq %edi, %rdi
movsd 0x61c70(%rbx,%rdi,8), %xmm0
movslq %r14d, %rdi
movq 0x620f8(%rbx), %r10
movslq %ecx, %rcx
movslq 0x4(%r10,%rcx,4), %rcx
movslq %r8d, %r8
movslq -0x4(%r10,%r8,4), %r8
imulq $0xc8, %rdi, %rdi
addq %rbx, %rdi
addq $0x670, %rdi            # imm = 0x670
leaq (%rcx,%rcx,4), %rcx
leaq (%rdi,%rcx,8), %rcx
addsd (%rcx,%r8,8), %xmm0
movslq %ebp, %rcx
cltq
movslq 0x4(%r10,%rax,4), %rax
movslq %r9d, %rdi
movslq -0x4(%r10,%rdi,4), %rdi
imulq $0xc8, %rcx, %rcx
addq %rbx, %rcx
addq $0x670, %rcx            # imm = 0x670
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rax
addsd (%rax,%rdi,8), %xmm0
subl %edx, %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
addsd 0x62000(%rbx,%rax,8), %xmm0
jmp 0xbb7b