// File: /workspace/github_c_makefile_star2_O1/jiqingxiaoxi[P]RPA/RPA.c
// Function: calc_bulge_internal2
void calc_bulge_internal2(int i,int j,int ii,int jj,double *EntropyEnthalpy,int traceback,double stackEntropies[],double stackEnthalpies[],double stackint2Entropies[],double stackint2Enthalpies[],double interiorLoopEntropies[],double bulgeLoopEntropies[],double interiorLoopEnthalpies[],double bulgeLoopEnthalpies[],double tstackEntropies[],double tstackEnthalpies[],double atpS[],double atpH[],double Initdouble[0],int Initint[],double enthalpyDPT[],double entropyDPT[],char numSeq1[],char numSeq2[])
{
	int loopSize1,loopSize2,loopSize;
	double T1,T2,S,H;

	S=-3224.0;
	H=0.0;
	loopSize1=ii-i-1;
	loopSize2=j-jj-1;
	if(loopSize1+loopSize2>30)
	{
		EntropyEnthalpy[0]=-1.0;
		EntropyEnthalpy[1]=1.0*INFINITY;
		return;
	}

	loopSize=loopSize1+loopSize2-1;
	if((loopSize1==0&&loopSize2>0)||(loopSize2==0&&loopSize1>0))
	{
		if(loopSize2==1||loopSize1==1)
		{ 
			if((loopSize2==1&&loopSize1==0)||(loopSize2==0&&loopSize1==1))
			{
				H=bulgeLoopEnthalpies[loopSize]+stackEnthalpies[numSeq1[i]*125+numSeq1[ii]*25+numSeq2[j]*5+numSeq2[jj]];
				S=bulgeLoopEntropies[loopSize]+stackEntropies[numSeq1[i]*125+numSeq1[ii]*25+numSeq2[j]*5+numSeq2[jj]];
 			}
			if(traceback!=1)
			{
				H+=enthalpyDPT[(ii-1)*Initint[2]+jj-1];
				S+=entropyDPT[(ii-1)*Initint[2]+jj-1];
			}

			if(fabs(H)>999999999)
			{
				H=1.0*INFINITY;
				S=-1.0;
			}
			T1=(H+Initdouble[0])/((S+Initdouble[1])+Initdouble[2]);
			T2=(enthalpyDPT[(i-1)*Initint[2]+j-1]+Initdouble[0])/((entropyDPT[(i-1)*Initint[2]+j-1])+Initdouble[1]+Initdouble[2]);
			if((T1>T2)||((traceback&&T1>=T2)||traceback==1))
			{
				EntropyEnthalpy[0]=S;
				EntropyEnthalpy[1]=H;
			}
		}
		else
		{
			H=bulgeLoopEnthalpies[loopSize]+atpH[numSeq1[i]*5+numSeq2[j]]+atpH[numSeq1[ii]*5+numSeq2[jj]];
			if(traceback!=1)
				H+=enthalpyDPT[(ii-1)*Initint[2]+jj-1];

			S=bulgeLoopEntropies[loopSize]+atpS[numSeq1[i]*5+numSeq2[j]]+atpS[numSeq1[ii]*5+numSeq2[jj]];
			if(traceback!=1)
				S+=entropyDPT[(ii-1)*Initint[2]+jj-1];
			if(fabs(H)>999999999)
			{
				H=1.0*INFINITY;
				S=-1.0;
			}
			T1=(H+Initdouble[0])/((S+Initdouble[1])+Initdouble[2]);
			T2=(enthalpyDPT[(i-1)*Initint[2]+j-1]+Initdouble[0])/(entropyDPT[(i-1)*Initint[2]+j-1]+Initdouble[1]+Initdouble[2]);
			if((T1>T2)||((traceback&&T1>=T2)||(traceback==1)))
			{
				EntropyEnthalpy[0]=S;
				EntropyEnthalpy[1]=H;
			}
		}
	}
	else if(loopSize1==1&&loopSize2==1)
	{
		S=stackint2Entropies[numSeq1[i]*125+numSeq1[i+1]*25+numSeq2[j]*5+numSeq2[j-1]]+stackint2Entropies[numSeq2[jj]*125+numSeq2[jj+1]*25+numSeq1[ii]*5+numSeq1[ii-1]];
		if(traceback!=1)
			S+=entropyDPT[(ii-1)*Initint[2]+jj-1];

		H=stackint2Enthalpies[numSeq1[i]*125+numSeq1[i+1]*25+numSeq2[j]*5+numSeq2[j-1]]+stackint2Enthalpies[numSeq2[jj]*125+numSeq2[jj+1]*25+numSeq1[ii]*5+numSeq1[ii-1]];
		if(traceback!=1)
			H+=enthalpyDPT[(ii-1)*Initint[2]+jj-1];
		if(fabs(H)>999999999)
		{
			H=1.0*INFINITY;
			S=-1.0;
		}
		T1=(H+Initdouble[0])/((S+Initdouble[1])+Initdouble[2]);
		T2=(enthalpyDPT[(i-1)*Initint[2]+j-1]+Initdouble[0])/(entropyDPT[(i-1)*Initint[2]+j-1]+Initdouble[1]+Initdouble[2]);
		if((T1-T2>=0.000001)||traceback)
		{
			if((T1>T2)||((traceback&&T1>= T2)||traceback==1))
			{
				EntropyEnthalpy[0]=S;
				EntropyEnthalpy[1]=H;
			}
		}
		return;
	}
	else
	{
		H=interiorLoopEnthalpies[loopSize]+tstackEnthalpies[numSeq1[i]*125+numSeq1[i+1]*25+numSeq2[j]*5+numSeq2[j-1]]+tstackEnthalpies[numSeq2[jj]*125+numSeq2[jj+1]*25+numSeq1[ii]*5+numSeq1[ii-1]];
		if(traceback!=1)
			H+=enthalpyDPT[(ii-1)*Initint[2]+jj-1];

		S=interiorLoopEntropies[loopSize]+tstackEntropies[numSeq1[i]*125+numSeq1[i+1]*25+numSeq2[j]*5+numSeq2[j-1]]+tstackEntropies[numSeq2[jj]*125+numSeq2[jj+1]*25+numSeq1[ii]*5+numSeq1[ii-1]]+(-300/310.15*abs(loopSize1-loopSize2));
		if(traceback!=1)
			S+=entropyDPT[(ii-1)*Initint[2]+jj-1];
		if(fabs(H)>999999999)
		{
			H=1.0*INFINITY;
			S=-1.0;
		}

		T1=(H+Initdouble[0])/((S+Initdouble[1])+Initdouble[2]);
		T2=(enthalpyDPT[(i-1)*Initint[2]+j-1]+Initdouble[0])/((entropyDPT[(i-1)*Initint[2]+j-1])+Initdouble[1]+Initdouble[2]);
		if((T1>T2)||((traceback&&T1>=T2)||(traceback==1)))
		{
			EntropyEnthalpy[0]=S;
			EntropyEnthalpy[1]=H;
		}
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edi, %r15d
notl %r15d
addl %edx, %r15d
movl %ecx, %r13d
notl %r13d
addl %esi, %r13d
leal (%r15,%r13), %r10d
cmpl $0x1e, %r10d
jle 0x35e3
movsd 0xaa52(%rip), %xmm1     # 0xe028
movsd 0xaa5a(%rip), %xmm0     # 0xe038
jmp 0x39ca
movq %r8, -0x38(%rbp)
movl %r9d, -0x2c(%rbp)
movq 0x98(%rbp), %r12
movq 0x90(%rbp), %r9
decl %r10d
testl %r15d, %r15d
sete %al
testl %r13d, %r13d
setg %r11b
testb %r11b, %al
jne 0x3624
testl %r13d, %r13d
setne %al
testl %r15d, %r15d
setle %r11b
orb %al, %r11b
jne 0x36e8
movq 0x48(%rbp), %rbx
cmpl $0x1, %r13d
setne %r11b
cmpl $0x1, %r15d
setne %al
testb %r11b, %al
jne 0x3673
movl %r15d, %eax
xorl $0x1, %eax
movl %r13d, %r14d
xorl $0x1, %r14d
orl %r13d, %eax
sete %r11b
orl %r15d, %r14d
je 0x37aa
testb %r11b, %r11b
jne 0x37aa
xorpd %xmm2, %xmm2
movsd 0xa9d2(%rip), %xmm0     # 0xe040
jmp 0x380a
movq 0x68(%rbp), %rax
movq 0x60(%rbp), %r11
movslq %r10d, %r10
movsd (%rbx,%r10,8), %xmm2
movslq %edi, %rbx
movsbq (%r9,%rbx), %r14
movslq %esi, %rbx
movsbq (%r12,%rbx), %rbx
shlq $0x3, %r14
leaq (%r14,%r14,4), %r15
leaq (%rax,%r15), %r14
addsd (%r14,%rbx,8), %xmm2
movslq %edx, %r14
movsbq (%r9,%r14), %r9
movslq %ecx, %r14
movsbq (%r12,%r14), %r14
shlq $0x3, %r9
leaq (%r9,%r9,4), %r12
addq %r12, %rax
addsd (%rax,%r14,8), %xmm2
movl -0x2c(%rbp), %r8d
cmpl $0x1, %r8d
movq 0x88(%rbp), %r9
jne 0x38be
movq 0x80(%rbp), %r13
jmp 0x38dc
movl %r15d, %eax
xorl $0x1, %eax
movl %r13d, %r11d
xorl $0x1, %r11d
orl %eax, %r11d
jne 0x39e0
movq 0x20(%rbp), %rbx
movslq %edi, %rax
movsbq (%r9,%rax), %r10
movsbq 0x1(%r9,%rax), %r11
movslq %esi, %rax
movsbq (%r12,%rax), %r14
movsbq -0x1(%r12,%rax), %rax
imulq $0x3e8, %r10, %r10      # imm = 0x3E8
leaq (%rbx,%r10), %r15
imulq $0xc8, %r11, %r13
shlq $0x3, %r14
leaq (%r14,%r14,4), %r11
addq %r13, %r11
addq %r11, %r15
movsd (%r15,%rax,8), %xmm0
movslq %ecx, %r14
movsbq (%r12,%r14), %r15
movsbq 0x1(%r12,%r14), %r14
movslq %edx, %rdx
movsbq (%r9,%rdx), %r12
imulq $0xc8, %r14, %r14
shlq $0x3, %r12
leaq (%r12,%r12,4), %r12
addq %r14, %r12
movsbq -0x1(%r9,%rdx), %r14
imulq $0x3e8, %r15, %r15      # imm = 0x3E8
addq %r15, %rbx
addq %r12, %rbx
addsd (%rbx,%r14,8), %xmm0
movq 0x28(%rbp), %rbx
decq %rdx
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x3b1a
movq -0x38(%rbp), %r8
movq 0x88(%rbp), %r13
jmp 0x3b42
movq 0x18(%rbp), %rax
movslq %r10d, %r10
movsd (%rbx,%r10,8), %xmm2
movslq %edi, %r11
movsbq (%r9,%r11), %r11
imulq $0x7d, %r11, %r11
movslq %edx, %rbx
movsbq (%r9,%rbx), %r9
leaq (%r9,%r9,4), %r9
leaq (%r9,%r9,4), %r9
movslq %esi, %rbx
movsbq (%r12,%rbx), %rbx
leaq (%rbx,%rbx,4), %rbx
addq %r9, %rbx
addq %r11, %rbx
movslq %ecx, %r9
movsbq (%r12,%r9), %r9
addq %rbx, %r9
addsd (%rax,%r9,8), %xmm2
movq 0x10(%rbp), %rax
movq 0x38(%rbp), %r11
movsd (%r11,%r10,8), %xmm0
addsd (%rax,%r9,8), %xmm0
movq 0x88(%rbp), %r9
movq 0x80(%rbp), %r10
movq 0x78(%rbp), %r11
movl -0x2c(%rbp), %r8d
cmpl $0x1, %r8d
je 0x3840
decl %edx
imull 0x8(%r11), %edx
leal (%rcx,%rdx), %eax
decl %eax
cltq
addsd (%r10,%rax,8), %xmm2
addsd (%r9,%rax,8), %xmm0
movapd 0xa868(%rip), %xmm3     # 0xe0b0
andpd %xmm2, %xmm3
movsd 0xa7dc(%rip), %xmm1     # 0xe030
ucomisd %xmm1, %xmm3
jbe 0x3862
movsd 0xa7d6(%rip), %xmm0     # 0xe038
cmpltsd %xmm3, %xmm1
movsd 0xa7b9(%rip), %xmm3     # 0xe028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm4
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm4, %xmm5
addsd %xmm0, %xmm5
movsd 0x10(%rax), %xmm6
addsd %xmm6, %xmm5
divsd %xmm5, %xmm3
decl %edi
imull 0x8(%r11), %edi
leal (%rsi,%rdi), %eax
decl %eax
cltq
addsd (%r10,%rax,8), %xmm2
jmp 0x3995
leal -0x1(%rdx), %eax
movq 0x78(%rbp), %r13
imull 0x8(%r13), %eax
addl %ecx, %eax
cltq
movq 0x80(%rbp), %r13
addsd -0x8(%r13,%rax,8), %xmm2
addq %r11, %r15
movq 0x38(%rbp), %rax
movsd (%rax,%r10,8), %xmm0
addsd (%r15,%rbx,8), %xmm0
addq %r11, %r12
addsd (%r12,%r14,8), %xmm0
cmpl $0x1, %r8d
jne 0x3904
movq 0x78(%rbp), %r10
jmp 0x391b
decl %edx
movq 0x78(%rbp), %r10
imull 0x8(%r10), %edx
addl %ecx, %edx
movslq %edx, %rax
addsd -0x8(%r9,%rax,8), %xmm0
movapd 0xa78d(%rip), %xmm3     # 0xe0b0
andpd %xmm2, %xmm3
movsd 0xa701(%rip), %xmm1     # 0xe030
ucomisd %xmm1, %xmm3
jbe 0x393d
movsd 0xa6fb(%rip), %xmm0     # 0xe038
cmpltsd %xmm3, %xmm1
movsd 0xa6de(%rip), %xmm3     # 0xe028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm4
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd 0x10(%rax), %xmm6
addsd %xmm6, %xmm5
divsd %xmm5, %xmm3
decl %edi
imull 0x8(%r10), %edi
leal (%rsi,%rdi), %eax
decl %eax
cltq
addsd (%r13,%rax,8), %xmm2
addsd (%r9,%rax,8), %xmm4
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
ucomisd %xmm2, %xmm3
jbe 0x39af
movq -0x38(%rbp), %r8
jmp 0x39ca
cmpl $0x1, %r8d
sete %al
ucomisd %xmm2, %xmm3
setae %cl
testl %r8d, %r8d
movq -0x38(%rbp), %r8
je 0x39d5
orb %cl, %al
je 0x39d5
movsd %xmm0, (%r8)
movsd %xmm1, 0x8(%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x58(%rbp), %rbx
movq 0x40(%rbp), %rax
movslq %r10d, %r10
movq %r10, -0x50(%rbp)
movsd (%rax,%r10,8), %xmm2
movslq %edi, %rax
movsbq (%r9,%rax), %r10
movsbq 0x1(%r9,%rax), %rax
movslq %esi, %r11
movsbq (%r12,%r11), %r14
movsbq -0x1(%r12,%r11), %r8
imulq $0x3e8, %r10, %r11      # imm = 0x3E8
leaq (%rbx,%r11), %r10
imulq $0xc8, %rax, %rax
shlq $0x3, %r14
leaq (%r14,%r14,4), %r14
addq %rax, %r14
addq %r14, %r10
movq %r8, -0x48(%rbp)
addsd (%r10,%r8,8), %xmm2
movslq %ecx, %rax
movsbq (%r12,%rax), %r10
movsbq 0x1(%r12,%rax), %rax
movq %rax, -0x40(%rbp)
movslq %edx, %rdx
movsbq (%r9,%rdx), %rax
movsbq -0x1(%r9,%rdx), %r8
imulq $0x3e8, %r10, %r12      # imm = 0x3E8
addq %r12, %rbx
imulq $0xc8, -0x40(%rbp), %r9
shlq $0x3, %rax
leaq (%rax,%rax,4), %r10
addq %r9, %r10
addq %r10, %rbx
movq %r8, -0x40(%rbp)
addsd (%rbx,%r8,8), %xmm2
movq 0x50(%rbp), %r8
decq %rdx
movl -0x2c(%rbp), %ebx
cmpl $0x1, %ebx
je 0x3ab0
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
imull %edx, %eax
addl %ecx, %eax
cltq
movq 0x80(%rbp), %r9
addsd -0x8(%r9,%rax,8), %xmm2
addq %r8, %r11
addq %r14, %r11
addq %r8, %r12
addq %r10, %r12
subl %r13d, %r15d
movl %r15d, %eax
negl %eax
cmovsl %r15d, %eax
movq -0x50(%rbp), %r9
movq 0x30(%rbp), %r8
movsd (%r8,%r9,8), %xmm1
movq -0x48(%rbp), %r9
addsd (%r11,%r9,8), %xmm1
movq -0x40(%rbp), %r8
addsd (%r12,%r8,8), %xmm1
cvtsi2sd %eax, %xmm0
mulsd 0xa55a(%rip), %xmm0     # 0xe050
addsd %xmm1, %xmm0
cmpl $0x1, %ebx
jne 0x3c4a
movq 0x88(%rbp), %rcx
movq 0x80(%rbp), %rdx
movq 0x78(%rbp), %r9
jmp 0x3c6c
movq 0x78(%rbp), %r9
movl 0x8(%r9), %r9d
imull %edx, %r9d
addl %ecx, %r9d
movslq %r9d, %r9
movq 0x88(%rbp), %r13
addsd -0x8(%r13,%r9,8), %xmm0
movl -0x2c(%rbp), %r9d
movq -0x38(%rbp), %r8
addq %rbx, %r10
addq %r11, %r10
addq %rbx, %r15
addq %r12, %r15
movsd (%r10,%rax,8), %xmm2
addsd (%r15,%r14,8), %xmm2
movq 0x78(%rbp), %r10
cmpl $0x1, %r9d
je 0x3b7b
imull 0x8(%r10), %edx
addl %ecx, %edx
movslq %edx, %rax
movq 0x80(%rbp), %rcx
addsd -0x8(%rcx,%rax,8), %xmm2
movapd 0xa52d(%rip), %xmm3     # 0xe0b0
andpd %xmm2, %xmm3
movsd 0xa4a1(%rip), %xmm1     # 0xe030
ucomisd %xmm1, %xmm3
jbe 0x3b9d
movsd 0xa49b(%rip), %xmm0     # 0xe038
cmpltsd %xmm3, %xmm1
movsd 0xa47e(%rip), %xmm3     # 0xe028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm4
movapd %xmm2, %xmm3
addsd %xmm1, %xmm3
movapd %xmm4, %xmm5
addsd %xmm0, %xmm5
movsd 0x10(%rax), %xmm6
addsd %xmm6, %xmm5
decl %edi
imull 0x8(%r10), %edi
leal (%rsi,%rdi), %eax
decl %eax
cltq
movq 0x80(%rbp), %rcx
addsd (%rcx,%rax,8), %xmm2
addsd (%r13,%rax,8), %xmm4
divsd %xmm5, %xmm3
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
testl %r9d, %r9d
jne 0x3c24
movapd %xmm3, %xmm4
subsd %xmm2, %xmm4
ucomisd 0xa43a(%rip), %xmm4     # 0xe058
jb 0x39d5
ucomisd %xmm2, %xmm3
ja 0x39ca
cmpl $0x1, %r9d
sete %al
ucomisd %xmm2, %xmm3
setae %cl
testl %r9d, %r9d
jne 0x39c6
jmp 0x39d5
movq 0x78(%rbp), %r9
imull 0x8(%r9), %edx
addl %ecx, %edx
movslq %edx, %rax
movq 0x88(%rbp), %rcx
addsd -0x8(%rcx,%rax,8), %xmm0
movq 0x80(%rbp), %rdx
movapd 0xa43c(%rip), %xmm3     # 0xe0b0
andpd %xmm2, %xmm3
movsd 0xa3b0(%rip), %xmm1     # 0xe030
ucomisd %xmm1, %xmm3
jbe 0x3c8e
movsd 0xa3aa(%rip), %xmm0     # 0xe038
cmpltsd %xmm3, %xmm1
movsd 0xa38d(%rip), %xmm3     # 0xe028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm4
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd 0x10(%rax), %xmm6
addsd %xmm6, %xmm5
divsd %xmm5, %xmm3
decl %edi
imull 0x8(%r9), %edi
leal (%rsi,%rdi), %eax
decl %eax
cltq
addsd (%rdx,%rax,8), %xmm2
addsd (%rcx,%rax,8), %xmm4
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
ucomisd %xmm2, %xmm3
ja 0x39a9
cmpl $0x1, %ebx
sete %al
ucomisd %xmm2, %xmm3
setae %cl
testl %ebx, %ebx
jmp 0x39c0