// File: /workspace/github_c_makefile_star2_O0/fukunagatsu[P]RIblast/ungapped_extension.cpp
// Function: UngappedExtension::LoopEnergy(int, int, int, int, int, int, std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>>&)
double UngappedExtension::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{
    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 $0x50, %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 0x295e9
cmpl $0x0, -0x30(%rbp)
jne 0x295e9
movslq -0xc(%rbp), %rcx
leaq 0x84f11(%rip), %rax     # 0xae4e0
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x29911
movq 0x18(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x29620
movq 0x18(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2963b
movq 0x18(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x34(%rbp)
movq 0x20(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x29678
movq 0x20(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x29693
movq 0x20(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x38(%rbp)
movq 0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x296d0
movq 0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x296eb
movq 0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq 0x20(%rbp), %rdi
movl 0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
cmpl $0x5, %eax
jg 0x29728
movq 0x20(%rbp), %rdi
movl 0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x29743
movq 0x20(%rbp), %rdi
movl 0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbaa0
movzbl (%rax), %eax
subl $0x5, %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
cmpl $0x2, %eax
jne 0x29792
movslq -0xc(%rbp), %rcx
leaq 0x84e51(%rip), %rax     # 0xae5b0
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2990f
cmpl $0x1, -0x2c(%rbp)
jne 0x297ea
cmpl $0x2, -0x30(%rbp)
jne 0x297ea
movslq -0xc(%rbp), %rcx
leaq 0x86707(%rip), %rax     # 0xafeb0
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x1f4, %rcx, %rcx      # imm = 0x1F4
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2990d
cmpl $0x2, -0x2c(%rbp)
jne 0x29842
cmpl $0x1, -0x30(%rbp)
jne 0x29842
movslq -0x10(%rbp), %rcx
leaq 0x866af(%rip), %rax     # 0xafeb0
imulq $0xfa0, %rcx, %rcx      # imm = 0xFA0
addq %rcx, %rax
movslq -0xc(%rbp), %rcx
imulq $0x1f4, %rcx, %rcx      # imm = 0x1F4
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2990b
cmpl $0x2, -0x2c(%rbp)
jne 0x298a5
cmpl $0x2, -0x30(%rbp)
jne 0x298a5
movslq -0xc(%rbp), %rcx
leaq 0x8e357(%rip), %rax     # 0xb7bb0
imulq $0x4e20, %rcx, %rcx     # imm = 0x4E20
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x9c4, %rcx, %rcx      # imm = 0x9C4
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
imulq $0x1f4, %rcx, %rcx      # imm = 0x1F4
addq %rcx, %rax
movslq -0x3c(%rbp), %rcx
imulq $0x64, %rcx, %rcx
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x29909
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movslq %eax, %rcx
leaq 0xb53fb(%rip), %rax     # 0xdecb0
movl (%rax,%rcx,4), %eax
movslq -0xc(%rbp), %rdx
leaq 0xb546d(%rip), %rcx     # 0xded30
imulq $0x64, %rdx, %rdx
addq %rdx, %rcx
movslq -0x34(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movslq -0x38(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
movslq -0x10(%rbp), %rdx
leaq 0xb5449(%rip), %rcx     # 0xded30
imulq $0x64, %rdx, %rdx
addq %rdx, %rcx
movslq -0x40(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movslq -0x3c(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x2990b
jmp 0x2990d
jmp 0x2990f
jmp 0x29911
movsd -0x28(%rbp), %xmm0
movsd 0xf3da(%rip), %xmm1     # 0x38cf8
divsd %xmm1, %xmm0
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)