// File: /workspace/github_c_makefile_star2_O3/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 0x3546
movsd 0xaadf(%rip), %xmm1     # 0xe018
movsd 0xaaef(%rip), %xmm0     # 0xe030
jmp 0x3c3d
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 0x3583
testl %r13d, %r13d
setne %al
testl %r15d, %r15d
setle %r11b
orb %al, %r11b
jne 0x366c
movq 0x48(%rbp), %rbx
cmpl $0x1, %r13d
setne %r11b
cmpl $0x1, %r15d
setne %al
testb %r11b, %al
jne 0x35d2
movl %r15d, %eax
xorl $0x1, %eax
movl %r13d, %r14d
xorl $0x1, %r14d
orl %r13d, %eax
sete %r11b
orl %r15d, %r14d
je 0x374d
testb %r11b, %r11b
jne 0x374d
xorpd %xmm2, %xmm2
movsd 0xaa5b(%rip), %xmm0     # 0xe028
jmp 0x37ad
movq 0x68(%rbp), %rax
movq 0x60(%rbp), %r11
movslq %r10d, %r15
movsd (%rbx,%r15,8), %xmm2
movslq %edi, %r10
movsbq (%r9,%r10), %r10
movslq %esi, %rbx
movsbq (%r12,%rbx), %rbx
shlq $0x3, %r10
leaq (%r10,%r10,4), %r13
leaq (%rax,%r13), %r10
addsd (%r10,%rbx,8), %xmm2
movslq %edx, %r10
movsbq (%r9,%r10), %r9
movslq %ecx, %r10
movsbq (%r12,%r10), %r14
shlq $0x3, %r9
leaq (%r9,%r9,4), %r12
addq %r12, %rax
addsd (%rax,%r14,8), %xmm2
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x37d5
movq 0x38(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
addq %r11, %r13
addsd (%r13,%rbx,8), %xmm0
addq %r11, %r12
addsd (%r12,%r14,8), %xmm0
movq 0x78(%rbp), %rax
movl 0x8(%rax), %r10d
movq 0x88(%rbp), %rcx
movq 0x80(%rbp), %rdx
jmp 0x381f
movl %r15d, %eax
xorl $0x1, %eax
movl %r13d, %r11d
xorl $0x1, %r11d
orl %eax, %r11d
jne 0x3942
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
shlq $0x3, %r15
leaq (%r15,%r15,4), %r11
addq %r14, %r11
addq %r11, %r13
movsd (%r13,%r10,8), %xmm0
movslq %ecx, %r14
movsbq (%r12,%r14), %r13
movsbq 0x1(%r12,%r14), %r14
movslq %edx, %r12
movsbq (%r9,%r12), %rdx
imulq $0xc8, %r14, %r14
shlq $0x3, %rdx
leaq (%rdx,%rdx,4), %r15
addq %r14, %r15
movsbq -0x1(%r9,%r12), %rdx
imulq $0x3e8, %r13, %r14      # imm = 0x3E8
addq %r14, %rax
addq %r15, %rax
addsd (%rax,%rdx,8), %xmm0
movq 0x28(%rbp), %r13
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x3a08
addq %r13, %rbx
addq %r11, %rbx
movsd (%rbx,%r10,8), %xmm2
addq %r13, %r14
addq %r15, %r14
addsd (%r14,%rdx,8), %xmm2
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
movq 0x88(%rbp), %r12
movq 0x80(%rbp), %rdx
jmp 0x3a4f
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), %r10
movq 0x78(%rbp), %rax
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x38a1
movl 0x8(%rax), %eax
movq 0x80(%rbp), %rdx
jmp 0x38c2
decl %edx
movq 0x78(%rbp), %rax
movl 0x8(%rax), %r10d
imull %r10d, %edx
addl %ecx, %edx
movslq %edx, %rax
movq 0x80(%rbp), %rdx
addsd -0x8(%rdx,%rax,8), %xmm2
movq 0x38(%rbp), %rcx
movsd (%rcx,%r15,8), %xmm0
addq %r11, %r13
addsd (%r13,%rbx,8), %xmm0
addq %r11, %r12
addsd (%r12,%r14,8), %xmm0
movq 0x88(%rbp), %rcx
addsd -0x8(%rcx,%rax,8), %xmm0
movapd 0xa899(%rip), %xmm3     # 0xe0c0
andpd %xmm2, %xmm3
movsd 0xa7ed(%rip), %xmm1     # 0xe020
ucomisd %xmm1, %xmm3
jbe 0x3841
movsd 0xa7ef(%rip), %xmm0     # 0xe030
cmpltsd %xmm3, %xmm1
movsd 0xa7ca(%rip), %xmm3     # 0xe018
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 %edi, %r10d
leal (%rsi,%r10), %eax
decl %eax
cltq
addsd (%rdx,%rax,8), %xmm2
addsd (%rcx,%rax,8), %xmm4
jmp 0x3c18
decl %edx
movl 0x8(%rax), %eax
imull %eax, %edx
addl %edx, %ecx
decl %ecx
movslq %ecx, %rcx
movq 0x80(%rbp), %rdx
addsd (%rdx,%rcx,8), %xmm2
addsd (%r10,%rcx,8), %xmm0
movapd 0xa7f6(%rip), %xmm3     # 0xe0c0
andpd %xmm2, %xmm3
movsd 0xa74a(%rip), %xmm1     # 0xe020
ucomisd %xmm1, %xmm3
jbe 0x38e4
movsd 0xa74c(%rip), %xmm0     # 0xe030
cmpltsd %xmm3, %xmm1
movsd 0xa727(%rip), %xmm3     # 0xe018
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 (%rdx,%rax,8), %xmm2
addsd (%r10,%rax,8), %xmm4
jmp 0x3c18
movq %r8, -0x38(%rbp)
movq 0x58(%rbp), %rax
movq 0x40(%rbp), %r11
movslq %r10d, %r8
movq %r8, -0x58(%rbp)
movsd (%r11,%r8,8), %xmm2
movslq %edi, %r10
movsbq (%r9,%r10), %r11
movsbq 0x1(%r9,%r10), %r10
movslq %esi, %rbx
movsbq (%r12,%rbx), %r14
movsbq -0x1(%r12,%rbx), %r8
imulq $0x3e8, %r11, %rbx      # imm = 0x3E8
leaq (%rax,%rbx), %r11
imulq $0xc8, %r10, %r10
shlq $0x3, %r14
leaq (%r14,%r14,4), %r14
addq %r10, %r14
movq %r14, -0x40(%rbp)
addq %r14, %r11
movq %r8, -0x50(%rbp)
addsd (%r11,%r8,8), %xmm2
movslq %ecx, %r10
movsbq (%r12,%r10), %r11
movsbq 0x1(%r12,%r10), %r10
movslq %edx, %rdx
movsbq (%r9,%rdx), %r14
movsbq -0x1(%r9,%rdx), %r8
imulq $0x3e8, %r11, %r12      # imm = 0x3E8
addq %r12, %rax
imulq $0xc8, %r10, %r11
shlq $0x3, %r14
leaq (%r14,%r14,4), %r10
addq %r11, %r10
addq %r10, %rax
movq %r8, -0x48(%rbp)
addsd (%rax,%r8,8), %xmm2
movq 0x50(%rbp), %rax
movq 0x30(%rbp), %r11
decq %rdx
cmpl $0x1, -0x2c(%rbp)
jne 0x3af6
movq 0x78(%rbp), %r9
jmp 0x3b1c
decq %r12
movq 0x78(%rbp), %rax
movl 0x8(%rax), %eax
imull %eax, %r12d
addl %ecx, %r12d
movslq %r12d, %rcx
movq 0x88(%rbp), %r12
addsd -0x8(%r12,%rcx,8), %xmm0
addq %r13, %rbx
addq %r11, %rbx
movsd (%rbx,%r10,8), %xmm2
addq %r13, %r14
addq %r15, %r14
addsd (%r14,%rdx,8), %xmm2
movq 0x80(%rbp), %rdx
addsd -0x8(%rdx,%rcx,8), %xmm2
movapd 0xa669(%rip), %xmm3     # 0xe0c0
andpd %xmm2, %xmm3
movsd 0xa5bd(%rip), %xmm1     # 0xe020
ucomisd %xmm1, %xmm3
jbe 0x3a71
movsd 0xa5bf(%rip), %xmm0     # 0xe030
cmpltsd %xmm3, %xmm1
movsd 0xa59a(%rip), %xmm3     # 0xe018
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 (%r12,%rax,8), %xmm4
divsd %xmm5, %xmm3
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
testl %r9d, %r9d
jne 0x3c20
movapd %xmm3, %xmm4
subsd %xmm2, %xmm4
ucomisd 0xa55d(%rip), %xmm4     # 0xe048
jb 0x3c48
jmp 0x3c20
movq 0x78(%rbp), %r9
movq %r11, %r8
movl 0x8(%r9), %r11d
imull %edx, %r11d
addl %ecx, %r11d
movslq %r11d, %r11
movq 0x80(%rbp), %r14
addsd -0x8(%r14,%r11,8), %xmm2
movq %r8, %r11
addq %rax, %rbx
addq -0x40(%rbp), %rbx
addq %rax, %r12
addq %r10, %r12
subl %r13d, %r15d
movl %r15d, %eax
negl %eax
cmovsl %r15d, %eax
movq -0x58(%rbp), %r8
movsd (%r11,%r8,8), %xmm1
movq -0x50(%rbp), %r8
addsd (%rbx,%r8,8), %xmm1
movq -0x48(%rbp), %r8
addsd (%r12,%r8,8), %xmm1
cvtsi2sd %eax, %xmm0
mulsd 0xa4e1(%rip), %xmm0     # 0xe040
addsd %xmm1, %xmm0
movl 0x8(%r9), %eax
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
jne 0x3b7e
movq -0x38(%rbp), %r8
movq 0x88(%rbp), %rdx
jmp 0x3b97
imull %eax, %edx
addl %ecx, %edx
movslq %edx, %rcx
movq 0x88(%rbp), %rdx
addsd -0x8(%rdx,%rcx,8), %xmm0
movq -0x38(%rbp), %r8
movapd 0xa521(%rip), %xmm3     # 0xe0c0
andpd %xmm2, %xmm3
movsd 0xa475(%rip), %xmm1     # 0xe020
ucomisd %xmm1, %xmm3
jbe 0x3bb9
movsd 0xa477(%rip), %xmm0     # 0xe030
cmpltsd %xmm3, %xmm1
movsd 0xa452(%rip), %xmm3     # 0xe018
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
movq 0x80(%rbp), %rcx
addsd (%rcx,%rax,8), %xmm2
addsd (%rdx,%rax,8), %xmm4
addsd %xmm6, %xmm4
divsd %xmm4, %xmm2
ucomisd %xmm2, %xmm3
ja 0x3c3d
cmpl $0x1, %r9d
sete %al
ucomisd %xmm2, %xmm3
setae %cl
testl %r9d, %r9d
je 0x3c48
orb %cl, %al
je 0x3c48
movsd %xmm0, (%r8)
movsd %xmm1, 0x8(%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq