// File: /workspace/github_c_makefile_star2_O2/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 0x9204
testl %esi, %esi
setne %dil
testl %edx, %edx
setne %r10b
testb %r10b, %dil
jne 0x921f
testl %esi, %esi
cmovnel %esi, %edx
cmpl $0x1f, %edx
jge 0x9271
movslq %edx, %rax
movsd 0xd70(%rbx,%rax,8), %xmm0
cmpl $0x1, %edx
jne 0x92ac
movslq %r14d, %rax
imulq $0x38, %rax, %rax
addq %rax, %rbx
movslq %ebp, %rax
addsd 0xbe8(%rbx,%rax,8), %xmm0
jmp 0x9497
movslq %r14d, %rax
imulq $0x38, %rax, %rax
addq %rax, %rbx
movslq %ebp, %rax
movsd 0xbe8(%rbx,%rax,8), %xmm0
jmp 0x9497
leal (%rdx,%rsi), %edi
cmpl $0x2, %edi
jne 0x92d0
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
imulq $0x28, %rcx, %rax
addq %rdx, %rax
movsd 0xe70(%rax,%rsi,8), %xmm0
jmp 0x9497
movsd 0xe60(%rbx), %xmm0
movsd %xmm0, (%rsp)
cvtsi2sd %edx, %xmm0
divsd 0x3e6c6(%rip), %xmm0    # 0x47950
callq 0x3190
mulsd 0x3e6c1(%rip), %xmm0    # 0x47958
mulsd 0xd5c1(%rip), %xmm0     # 0x16860
divsd 0xd9fc1(%rip), %xmm0    # 0xe3268
addsd (%rsp), %xmm0
movsd 0xe68(%rbx), %xmm1
cmpl $0x3, %r14d
jl 0x92be
addsd %xmm1, %xmm0
cmpl $0x3, %ebp
jl 0x9497
addsd %xmm1, %xmm0
jmp 0x9497
movl %esi, %r11d
xorl $0x1, %r11d
movl %edx, %r10d
xorl $0x2, %r10d
orl %r10d, %r11d
jne 0x933a
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
imulq $0x28, %rax, %rax
addq %rcx, %rax
movsd 0x4070(%rax,%rdi,8), %xmm0
jmp 0x9497
movl %esi, %r11d
xorl $0x2, %r11d
movl %edx, %r15d
xorl $0x1, %r15d
orl %r11d, %r15d
jne 0x93a4
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
imulq $0x28, %rcx, %rcx
addq %rsi, %rcx
addq %rax, %rcx
movsd 0x4070(%rcx,%rdi,8), %xmm0
jmp 0x9497
orl %r10d, %r11d
jne 0x9412
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
imulq $0x28, %rax, %rax
addq %rdx, %rax
movsd 0x13a70(%rax,%rdi,8), %xmm0
jmp 0x9497
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
imulq $0x28, %rcx, %rcx
addq %rdi, %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
imulq $0x28, %rax, %rax
addq %rcx, %rax
addsd (%rax,%rdi,8), %xmm0
subl %edx, %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
addsd 0x62000(%rbx,%rax,8), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq