// File: /workspace/github_c_makefile_star2_O2/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, %r14d
notl %r14d
addl %edx, %r14d
movl %ecx, %r13d
notl %r13d
addl %esi, %r13d
leal (%r14,%r13), %r10d
cmpl $0x1e, %r10d
jle 0x342e
movsd 0x9c07(%rip), %xmm1     # 0xd028
movsd 0x9c17(%rip), %xmm0     # 0xd040
jmp 0x3aeb
movl %r9d, -0x2c(%rbp)
movq 0x98(%rbp), %r12
movq 0x90(%rbp), %r9
decl %r10d
testl %r14d, %r14d
sete %al
testl %r13d, %r13d
setg %r11b
testb %r11b, %al
jne 0x346b
testl %r13d, %r13d
setne %al
testl %r14d, %r14d
setle %r11b
orb %al, %r11b
jne 0x356e
movq 0x48(%rbp), %rbx
cmpl $0x1, %r13d
setne %r11b
cmpl $0x1, %r14d
setne %al
testb %r11b, %al
jne 0x34ba
movl %r14d, %eax
xorl $0x1, %eax
movl %r13d, %r15d
xorl $0x1, %r15d
orl %r13d, %eax
sete %r11b
orl %r14d, %r15d
je 0x3647
testb %r11b, %r11b
jne 0x3647
xorpd %xmm2, %xmm2
movsd 0x9b83(%rip), %xmm0     # 0xd038
jmp 0x36a1
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
imulq $0x28, %r14, %r14
leaq (%rax,%r14), %r15
addsd (%r15,%rbx,8), %xmm2
movslq %edx, %r15
movsbq (%r9,%r15), %r9
movslq %ecx, %r15
movsbq (%r12,%r15), %r15
imulq $0x28, %r9, %r12
addq %r12, %rax
addsd (%rax,%r15,8), %xmm2
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
movq 0x88(%rbp), %r13
je 0x353c
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
movq 0x88(%rbp), %r13
addq %r11, %r14
movq 0x38(%rbp), %rax
movsd (%rax,%r10,8), %xmm0
addsd (%r14,%rbx,8), %xmm0
addq %r11, %r12
addsd (%r12,%r15,8), %xmm0
cmpl $0x1, %r9d
jne 0x36c9
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
jmp 0x36e1
movl %r14d, %eax
xorl $0x1, %eax
movl %r13d, %r11d
xorl $0x1, %r11d
orl %eax, %r11d
jne 0x3805
movq 0x20(%rbp), %rax
movslq %edi, %r10
movsbq (%r9,%r10), %r11
movsbq 0x1(%r9,%r10), %r14
movslq %esi, %r10
movsbq (%r12,%r10), %r15
movsbq -0x1(%r12,%r10), %r10
imulq $0x3e8, %r11, %rbx      # imm = 0x3E8
leaq (%rax,%rbx), %r13
imulq $0xc8, %r14, %r14
imulq $0x28, %r15, %r11
addq %r14, %r11
addq %r11, %r13
movsd (%r13,%r10,8), %xmm0
movslq %ecx, %r14
movsbq (%r12,%r14), %r15
movsbq 0x1(%r12,%r14), %r14
movslq %edx, %r13
movsbq (%r9,%r13), %rdx
imulq $0xc8, %r14, %r14
imulq $0x28, %rdx, %r12
addq %r14, %r12
movsbq -0x1(%r9,%r13), %rdx
imulq $0x3e8, %r15, %r14      # imm = 0x3E8
addq %r14, %rax
addq %r12, %rax
addsd (%rax,%rdx,8), %xmm0
movq 0x28(%rbp), %r15
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x38c2
addq %r15, %rbx
addq %r11, %rbx
movsd (%rbx,%r10,8), %xmm2
addq %r15, %r14
addq %r12, %r14
addsd (%r14,%rdx,8), %xmm2
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
movq 0x88(%rbp), %r13
movq 0x80(%rbp), %rdx
jmp 0x3909
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
imulq $0x19, %r9, %r9
addq %r11, %r9
movslq %esi, %r11
movsbq (%r12,%r11), %r11
leaq (%r11,%r11,4), %r11
movslq %ecx, %rbx
movsbq (%r12,%rbx), %rbx
addq %r11, %rbx
addq %r9, %rbx
addsd (%rax,%rbx,8), %xmm2
movq 0x10(%rbp), %rax
movq 0x38(%rbp), %r9
movsd (%r9,%r10,8), %xmm0
addsd (%rax,%rbx,8), %xmm0
movq 0x88(%rbp), %r10
movq 0x80(%rbp), %r11
movq 0x78(%rbp), %rax
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x3769
movl 0x8(%rax), %eax
jmp 0x3784
decl %edx
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
imull %eax, %edx
addl %ecx, %edx
movslq %edx, %rcx
addsd -0x8(%r13,%rcx,8), %xmm0
movq 0x80(%rbp), %rcx
movapd 0x99f0(%rip), %xmm3     # 0xd0e0
andpd %xmm2, %xmm3
movsd 0x9934(%rip), %xmm1     # 0xd030
ucomisd %xmm1, %xmm3
jbe 0x370a
movsd 0x9936(%rip), %xmm0     # 0xd040
cmpltsd %xmm3, %xmm1
movsd 0x9911(%rip), %xmm3     # 0xd028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rdx
movsd (%rdx), %xmm2
movsd 0x8(%rdx), %xmm4
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd 0x10(%rdx), %xmm6
addsd %xmm6, %xmm5
divsd %xmm5, %xmm3
decl %edi
imull %edi, %eax
addl %esi, %eax
decl %eax
cltq
addsd (%rcx,%rax,8), %xmm2
addsd (%r13,%rax,8), %xmm4
jmp 0x3ac6
decl %edx
movl 0x8(%rax), %eax
imull %eax, %edx
addl %edx, %ecx
decl %ecx
movslq %ecx, %rcx
addsd (%r11,%rcx,8), %xmm2
addsd (%r10,%rcx,8), %xmm0
movapd 0x9954(%rip), %xmm3     # 0xd0e0
andpd %xmm2, %xmm3
movsd 0x9898(%rip), %xmm1     # 0xd030
ucomisd %xmm1, %xmm3
jbe 0x37a6
movsd 0x989a(%rip), %xmm0     # 0xd040
cmpltsd %xmm3, %xmm1
movsd 0x9875(%rip), %xmm3     # 0xd028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rcx
movsd (%rcx), %xmm2
movsd 0x8(%rcx), %xmm4
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm4, %xmm5
addsd %xmm0, %xmm5
movsd 0x10(%rcx), %xmm6
addsd %xmm6, %xmm5
divsd %xmm5, %xmm3
decl %edi
imull %edi, %eax
addl %esi, %eax
decl %eax
cltq
addsd (%r11,%rax,8), %xmm2
addsd (%r10,%rax,8), %xmm4
jmp 0x3ac6
movq %r8, -0x50(%rbp)
movq 0x58(%rbp), %rax
movq 0x40(%rbp), %r11
movslq %r10d, %r8
movq %r8, -0x48(%rbp)
movsd (%r11,%r8,8), %xmm2
movslq %edi, %r10
movsbq (%r9,%r10), %r11
movsbq 0x1(%r9,%r10), %r10
movslq %esi, %rbx
movsbq (%r12,%rbx), %r15
movsbq -0x1(%r12,%rbx), %r8
imulq $0x3e8, %r11, %rbx      # imm = 0x3E8
leaq (%rax,%rbx), %r11
imulq $0xc8, %r10, %r10
imulq $0x28, %r15, %r15
addq %r10, %r15
addq %r15, %r11
movq %r8, -0x40(%rbp)
addsd (%r11,%r8,8), %xmm2
movslq %ecx, %r10
movsbq (%r12,%r10), %r11
movsbq 0x1(%r12,%r10), %r10
movslq %edx, %rdx
movsbq (%r9,%rdx), %r8
movsbq -0x1(%r9,%rdx), %r9
imulq $0x3e8, %r11, %r12      # imm = 0x3E8
addq %r12, %rax
imulq $0xc8, %r10, %r11
imulq $0x28, %r8, %r10
addq %r11, %r10
addq %r10, %rax
movq %r9, -0x38(%rbp)
addsd (%rax,%r9,8), %xmm2
movq 0x50(%rbp), %rax
decq %rdx
cmpl $0x1, -0x2c(%rbp)
jne 0x39b1
movq 0x80(%rbp), %r11
movq 0x78(%rbp), %r9
jmp 0x39d1
decq %r13
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
imull %eax, %r13d
addl %ecx, %r13d
movslq %r13d, %rcx
movq 0x88(%rbp), %r13
addsd -0x8(%r13,%rcx,8), %xmm0
addq %r15, %rbx
addq %r11, %rbx
movsd (%rbx,%r10,8), %xmm2
addq %r15, %r14
addq %r12, %r14
addsd (%r14,%rdx,8), %xmm2
movq 0x80(%rbp), %rdx
addsd -0x8(%rdx,%rcx,8), %xmm2
movapd 0x97cf(%rip), %xmm3     # 0xd0e0
andpd %xmm2, %xmm3
movsd 0x9713(%rip), %xmm1     # 0xd030
ucomisd %xmm1, %xmm3
jbe 0x392b
movsd 0x9715(%rip), %xmm0     # 0xd040
cmpltsd %xmm3, %xmm1
movsd 0x96f0(%rip), %xmm3     # 0xd028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rcx
movsd (%rcx), %xmm2
movsd 0x8(%rcx), %xmm4
movapd %xmm2, %xmm3
addsd %xmm1, %xmm3
movapd %xmm4, %xmm5
addsd %xmm0, %xmm5
movsd 0x10(%rcx), %xmm6
addsd %xmm6, %xmm5
decl %edi
imull %edi, %eax
addl %esi, %eax
decl %eax
cltq
addsd (%rdx,%rax,8), %xmm2
addsd (%r13,%rax,8), %xmm4
divsd %xmm5, %xmm3
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
testl %r9d, %r9d
jne 0x3ace
movapd %xmm3, %xmm4
subsd %xmm2, %xmm4
ucomisd 0x96b2(%rip), %xmm4     # 0xd058
jb 0x3af6
jmp 0x3ace
movq 0x78(%rbp), %r9
movl 0x8(%r9), %r8d
imull %edx, %r8d
addl %ecx, %r8d
movslq %r8d, %r8
movq 0x80(%rbp), %r11
addsd -0x8(%r11,%r8,8), %xmm2
addq %rax, %rbx
addq %r15, %rbx
addq %rax, %r12
addq %r10, %r12
subl %r13d, %r14d
movl %r14d, %eax
negl %eax
cmovsl %r14d, %eax
movq -0x48(%rbp), %r8
movq 0x30(%rbp), %r10
movsd (%r10,%r8,8), %xmm1
movq -0x40(%rbp), %r8
addsd (%rbx,%r8,8), %xmm1
movq -0x38(%rbp), %r8
addsd (%r12,%r8,8), %xmm1
cvtsi2sd %eax, %xmm0
mulsd 0x9639(%rip), %xmm0     # 0xd050
addsd %xmm1, %xmm0
movl 0x8(%r9), %eax
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
movq -0x50(%rbp), %r8
jne 0x3a36
movq 0x88(%rbp), %rdx
jmp 0x3a4b
imull %eax, %edx
addl %ecx, %edx
movslq %edx, %rcx
movq 0x88(%rbp), %rdx
addsd -0x8(%rdx,%rcx,8), %xmm0
movapd 0x968d(%rip), %xmm3     # 0xd0e0
andpd %xmm2, %xmm3
movsd 0x95d1(%rip), %xmm1     # 0xd030
ucomisd %xmm1, %xmm3
jbe 0x3a6d
movsd 0x95d3(%rip), %xmm0     # 0xd040
cmpltsd %xmm3, %xmm1
movsd 0x95ae(%rip), %xmm3     # 0xd028
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movq 0x70(%rbp), %rcx
movsd (%rcx), %xmm2
movsd 0x8(%rcx), %xmm4
movapd %xmm1, %xmm3
addsd %xmm2, %xmm3
movapd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd 0x10(%rcx), %xmm6
addsd %xmm6, %xmm5
divsd %xmm5, %xmm3
decl %edi
imull %edi, %eax
addl %esi, %eax
decl %eax
cltq
addsd (%r11,%rax,8), %xmm2
addsd (%rdx,%rax,8), %xmm4
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
ucomisd %xmm2, %xmm3
ja 0x3aeb
cmpl $0x1, %r9d
sete %al
ucomisd %xmm2, %xmm3
setae %cl
testl %r9d, %r9d
je 0x3af6
orb %cl, %al
je 0x3af6
movsd %xmm0, (%r8)
movsd %xmm1, 0x8(%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq