// File: /workspace/github_c_makefile_star2_O0/fukunagatsu[P]RIblast/gapped_extension.cpp
// Function: GappedExtension::LoopEnergy(int, int, int, int, int, int, std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>>&)
double GappedExtension::LoopEnergy(int type, int type2,int i,int j,int p,int q, vector<unsigned char> &query_seq, vector<unsigned char> &db_seq){
  double z = 0;
  int u1 = p-i-1;
  int u2 = q-j-1;
  if ((u1==0) && (u2==0)){
    z = stack37[type][type2];
  }else{
    if ((u1==0)||(u2==0)) {
      int u;
      u = u1 == 0 ? u2 : u1;
      z = u <=30 ? bulge37[u] : bulge37[30] + lxc37*log( u/30.);
      
      if (u == 1){
	z += stack37[type][type2];
      }else {
	if (type>2){ z += TerminalAU;}
	if (type2>2){ z += TerminalAU;}
      }
    }else{     
      int a = query_seq[i+1] <=5 ? query_seq[i+1]-1 : query_seq[i+1]-5;
      int b = db_seq[j+1] <=5 ? db_seq[j+1]-1 : db_seq[j+1]-5;
      int c = query_seq[p-1] <=5 ? query_seq[p-1]-1 : query_seq[p-1]-5;
      int d = db_seq[q-1] <=5 ? db_seq[q-1]-1 : db_seq[q-1]-5;
      if (u1+u2==2) {
	z = int11_37[type][type2][a][b];
      }else if ((u1==1) && (u2==2)){
	z = int21_37[type][type2][a][d][b];
      }else if ((u1==2) && (u2==1)){
	z = int21_37[type2][type][d][a][c];
      }else if ((u1==2) && (u2==2)){
	z = int22_37[type][type2][a][c][d][b];
      }else{
	z = internal_loop37[u1+u2]+mismatchI37[type][a][b]+mismatchI37[type2][d][c];
      }
    }
  }
  return double(z)/100;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x1c(%rbp), %eax
subl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl 0x10(%rbp), %eax
subl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x2e509
cmpl $0x0, -0x30(%rbp)
jne 0x2e509
movslq -0xc(%rbp), %rcx
leaq 0xb0e41(%rip), %rax     # 0xdf330
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e932
cmpl $0x0, -0x2c(%rbp)
je 0x2e519
cmpl $0x0, -0x30(%rbp)
jne 0x2e608
cmpl $0x0, -0x2c(%rbp)
jne 0x2e527
movl -0x30(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x2e52d
movl -0x2c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x34(%rbp)
cmpl $0x1e, -0x34(%rbp)
jg 0x2e550
movslq -0x34(%rbp), %rcx
leaq 0xb0ebc(%rip), %rax     # 0xdf400
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x2e59a
cvtsi2sdl 0xb0f20(%rip), %xmm0 # 0xdf478
movsd %xmm0, -0x60(%rbp)
movsd 0xb0f1b(%rip), %xmm0    # 0xdf480
movsd %xmm0, -0x58(%rbp)
cvtsi2sdl -0x34(%rbp), %xmm0
movsd 0xa3d1(%rip), %xmm1     # 0x38948
divsd %xmm1, %xmm0
callq 0x3220
movsd -0x60(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x58(%rbp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
cmpl $0x1, -0x34(%rbp)
jne 0x2e5d1
movslq -0xc(%rbp), %rcx
leaq 0xb0d7b(%rip), %rax     # 0xdf330
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e603
cmpl $0x2, -0xc(%rbp)
jle 0x2e5e9
cvtsi2sdl 0xb0d41(%rip), %xmm0 # 0xdf320
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
cmpl $0x2, -0x10(%rbp)
jle 0x2e601
cvtsi2sdl 0xb0d29(%rip), %xmm0 # 0xdf320
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e603
jmp 0x2e930
movq 0x18(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x2e63f
movq 0x18(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2e65a
movq 0x18(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x38(%rbp)
movq 0x20(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x2e697
movq 0x20(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x2e6b2
movq 0x20(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq 0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x2e6ef
movq 0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x2e70a
movq 0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x40(%rbp)
movq 0x20(%rbp), %rdi
movl 0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x2e747
movq 0x20(%rbp), %rdi
movl 0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x2e762
movq 0x20(%rbp), %rdi
movl 0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
cmpl $0x2, %eax
jne 0x2e7b1
movslq -0xc(%rbp), %rcx
leaq 0xb0d12(%rip), %rax     # 0xdf490
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e92e
cmpl $0x1, -0x2c(%rbp)
jne 0x2e809
cmpl $0x2, -0x30(%rbp)
jne 0x2e809
movslq -0xc(%rbp), %rcx
leaq 0xb25c8(%rip), %rax     # 0xe0d90
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x1f4, %rcx, %rcx      # imm = 0x1F4
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x44(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e92c
cmpl $0x2, -0x2c(%rbp)
jne 0x2e861
cmpl $0x1, -0x30(%rbp)
jne 0x2e861
movslq -0x10(%rbp), %rcx
leaq 0xb2570(%rip), %rax     # 0xe0d90
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq -0xc(%rbp), %rcx
imulq $0x1f4, %rcx, %rcx      # imm = 0x1F4
addq %rcx, %rax
movslq -0x44(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e92a
cmpl $0x2, -0x2c(%rbp)
jne 0x2e8c4
cmpl $0x2, -0x30(%rbp)
jne 0x2e8c4
movslq -0xc(%rbp), %rcx
leaq 0xba218(%rip), %rax     # 0xe8a90
imulq $0x4e20, %rcx, %rcx     # imm = 0x4E20
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x9c4, %rcx, %rcx      # imm = 0x9C4
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
imulq $0x1f4, %rcx, %rcx      # imm = 0x1F4
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x44(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e928
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movslq %eax, %rcx
leaq 0xe12bc(%rip), %rax     # 0x10fb90
movl (%rax,%rcx,4), %eax
movslq -0xc(%rbp), %rdx
leaq 0xe132e(%rip), %rcx     # 0x10fc10
imulq $0x64, %rdx, %rdx
addq %rdx, %rcx
movslq -0x38(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
movslq -0x10(%rbp), %rdx
leaq 0xe130a(%rip), %rcx     # 0x10fc10
imulq $0x64, %rdx, %rdx
addq %rdx, %rcx
movslq -0x44(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movslq -0x40(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2e92a
jmp 0x2e92c
jmp 0x2e92e
jmp 0x2e930
jmp 0x2e932
movsd -0x28(%rbp), %xmm0
movsd 0xa3b9(%rip), %xmm1     # 0x38cf8
divsd %xmm1, %xmm0
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)