// File: /workspace/github_c_makefile_star2_O2/jiqingxiaoxi[P]RPA/RPA.c
// Function: LSH
void LSH(int i,int j,double *EntropyEnthalpy,double dangleEntropies3[],double dangleEnthalpies3[],double dangleEntropies5[],double dangleEnthalpies5[],double tstack2Entropies[],double tstack2Enthalpies[],double atpS[],double atpH[],double Initdouble[],int Initint[],double enthalpyDPT[],double entropyDPT[],char numSeq1[],char numSeq2[])
{
	double S1,H1,T1,S2,H2,T2;

	if(numSeq1[i]+numSeq2[j]!=3)
	{
		entropyDPT[(i-1)*Initint[2]+j-1]=-1.0;
		enthalpyDPT[(i-1)*Initint[2]+j-1]=1.0*INFINITY;
		return;
	}

	S1=atpS[numSeq1[i]*5+numSeq2[j]]+tstack2Entropies[numSeq2[j]*125+numSeq2[j-1]*25+numSeq1[i]*5+numSeq1[i-1]];
	H1=atpH[numSeq1[i]*5+numSeq2[j]]+tstack2Enthalpies[numSeq2[j]*125+numSeq2[j-1]*25+numSeq1[i]*5+numSeq1[i-1]];
	if(fabs(H1)>999999999)
	{
		H1=1.0*INFINITY;
		S1=-1.0;
	}
// If there is two dangling ends at the same end of duplex
	if(fabs(dangleEnthalpies3[numSeq2[j]*25+numSeq2[j-1]*5+numSeq1[i]])<999999999&&fabs(dangleEnthalpies5[numSeq2[j]*25+numSeq1[i]*5+numSeq1[i-1]])<999999999)
	{
		S2=atpS[numSeq1[i]*5+numSeq2[j]]+dangleEntropies3[numSeq2[j]*25+numSeq2[j-1]*5+numSeq1[i]]+dangleEntropies5[numSeq2[j]*25+numSeq1[i]*5+numSeq1[i-1]];
		H2=atpH[numSeq1[i]*5+numSeq2[j]]+dangleEnthalpies3[numSeq2[j]*25+numSeq2[j-1]*5+numSeq1[i]]+dangleEnthalpies5[numSeq2[j]*25+numSeq1[i]*5+numSeq1[i-1]];
		if(fabs(H2)>999999999)
		{
			H2=1.0*INFINITY;
			S2=-1.0;
		}
		T2=(H2+Initdouble[0])/(S2+Initdouble[1]+Initdouble[2]);
		if(fabs(H1)<999999999)
		{
			T1=(H1+Initdouble[0])/(S1+Initdouble[1]+Initdouble[2]);
			if(T1<T2)
			{
				S1=S2;
				H1=H2;
				T1=T2;
			}
		}
		else
		{
			S1=S2;
			H1=H2;
			T1=T2;
		}
	}
	else if(fabs(dangleEnthalpies3[numSeq2[j]*25+numSeq2[j-1]*5+numSeq1[i]])<999999999)
	{
		S2=atpS[numSeq1[i]*5+numSeq2[j]]+dangleEntropies3[numSeq2[j]*25+numSeq2[j-1]*5+numSeq1[i]];
		H2=atpH[numSeq1[i]*5+numSeq2[j]]+dangleEnthalpies3[numSeq2[j]*25+numSeq2[j-1]*5+numSeq1[i]];
		if(fabs(H2)>999999999)
		{
			H2=1.0*INFINITY;
			S2=-1.0;
		}
		T2=(H2+Initdouble[0])/(S2+Initdouble[1]+Initdouble[2]);
		if(fabs(H1)<999999999)
		{
			T1=(H1+Initdouble[0])/(S1+Initdouble[1]+Initdouble[2]);
			if(T1<T2)
			{
				S1=S2;
				H1=H2;
				T1=T2;
			}
		}
		else
		{
			S1=S2;
			H1=H2;
			T1=T2;
		}
	}
	else if(fabs(dangleEnthalpies5[numSeq2[j]*25+numSeq1[i]*5+numSeq1[i-1]])<999999999)
	{
		S2=atpS[numSeq1[i]*5+numSeq2[j]]+dangleEntropies5[numSeq2[j]*25+numSeq1[i]*5+numSeq1[i-1]];
		H2=atpH[numSeq1[i]*5+numSeq2[j]]+dangleEnthalpies5[numSeq2[j]*25+numSeq1[i]*5+numSeq1[i-1]];
		if(fabs(H2)>999999999)
		{
			H2=1.0*INFINITY;
			S2=-1.0;
		}
		T2=(H2+Initdouble[0])/(S2+Initdouble[1]+Initdouble[2]);
		if(fabs(H1)<999999999)
		{
			T1=(H1+Initdouble[0])/(S1+Initdouble[1]+Initdouble[2]);
			if(T1<T2)
			{
				S1=S2;
				H1=H2;
				T1=T2;
			}
		}
		else
		{
			S1=S2;
			H1=H2;
			T1=T2;
		}
	}

	S2=atpS[numSeq1[i]*5+numSeq2[j]];
	H2=atpH[numSeq1[i]*5+numSeq2[j]];
	T2=(H2+Initdouble[0])/(S2+Initdouble[1]+Initdouble[2]);
	if(fabs(H1)<999999999)
	{
		if(T1<T2)
		{
			EntropyEnthalpy[0]=S2;
			EntropyEnthalpy[1]=H2;
		}
		else
		{
			EntropyEnthalpy[0]=S1;
			EntropyEnthalpy[1]=H1;
		}
	}
	else
	{
		EntropyEnthalpy[0]=S2;
		EntropyEnthalpy[1]=H2;
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x60(%rbp), %rbx
movq 0x58(%rbp), %r11
movslq %edi, %r14
movsbl (%r11,%r14), %eax
movslq %esi, %r15
movsbl (%rbx,%r15), %r10d
leal (%r10,%rax), %r12d
cmpl $0x3, %r12d
jne 0x675f
leal (%rax,%rax,4), %r12d
movsbl -0x1(%rbx,%r15), %ebx
imull $0x7d, %r10d, %esi
movsbl -0x1(%r11,%r14), %r11d
imull $0x19, %ebx, %edi
addl %r12d, %r11d
addl %r11d, %esi
addl %edi, %esi
movq 0x18(%rbp), %rdi
movslq %esi, %rsi
movsd (%rdi,%rsi,8), %xmm7
movq 0x20(%rbp), %rdi
movsd (%rdi,%rsi,8), %xmm0
movq 0x30(%rbp), %rsi
movq 0x28(%rbp), %rdi
leal (%r12,%r10), %r14d
movslq %r14d, %r14
movsd (%rdi,%r14,8), %xmm3
movsd (%rsi,%r14,8), %xmm5
movq 0x10(%rbp), %r14
addsd %xmm3, %xmm7
addsd %xmm5, %xmm0
movapd 0x6a1c(%rip), %xmm6     # 0xd0e0
movapd %xmm0, %xmm4
andpd %xmm6, %xmm4
movsd 0x695c(%rip), %xmm2     # 0xd030
ucomisd %xmm2, %xmm4
movapd %xmm2, %xmm1
cmpnltsd %xmm4, %xmm1
andpd %xmm1, %xmm7
movsd 0x6952(%rip), %xmm8     # 0xd040
andnpd %xmm8, %xmm1
orpd %xmm7, %xmm1
jbe 0x6701
movsd 0x6927(%rip), %xmm0     # 0xd028
imull $0x19, %r10d, %r15d
leal (%rbx,%rbx,4), %ebx
addl %eax, %ebx
addl %r15d, %ebx
movslq %ebx, %rbx
movsd (%r8,%rbx,8), %xmm7
movapd %xmm7, %xmm8
andpd %xmm6, %xmm8
addl %r15d, %r11d
ucomisd %xmm8, %xmm2
movq 0x38(%rbp), %r8
movslq %r11d, %r11
movsd (%r14,%r11,8), %xmm8
andpd %xmm8, %xmm6
jbe 0x6799
ucomisd %xmm6, %xmm2
addsd (%rcx,%rbx,8), %xmm3
addsd %xmm7, %xmm5
ja 0x67a3
movapd 0x698d(%rip), %xmm6     # 0xd0e0
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x67c2
jmp 0x67ca
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rcx
movq 0x40(%rbp), %rdx
decl %edi
imull 0x8(%rdx), %edi
addl %esi, %edi
movslq %edi, %rdx
movabsq $-0x4010000000000000, %rsi # imm = 0xBFF0000000000000
movq %rsi, -0x8(%rax,%rdx,8)
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
movq %rax, -0x8(%rcx,%rdx,8)
jmp 0x68a3
ucomisd %xmm6, %xmm2
jbe 0x6844
addsd %xmm8, %xmm5
movapd 0x6930(%rip), %xmm6     # 0xd0e0
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x67c2
addsd (%r9,%r11,8), %xmm3
jmp 0x67ca
movsd 0x6876(%rip), %xmm3     # 0xd040
movapd %xmm2, %xmm7
cmpltsd %xmm6, %xmm7
movsd 0x684d(%rip), %xmm6     # 0xd028
andpd %xmm7, %xmm6
andnpd %xmm5, %xmm7
orpd %xmm7, %xmm6
movsd (%r8), %xmm5
movsd 0x8(%r8), %xmm8
movapd %xmm6, %xmm7
addsd %xmm5, %xmm7
movapd %xmm3, %xmm10
addsd %xmm8, %xmm10
movsd 0x10(%r8), %xmm9
addsd %xmm9, %xmm10
divsd %xmm10, %xmm7
ucomisd %xmm4, %xmm2
jbe 0x6836
addsd %xmm0, %xmm5
movapd %xmm1, %xmm4
addsd %xmm8, %xmm4
addsd %xmm9, %xmm4
divsd %xmm4, %xmm5
ucomisd %xmm5, %xmm7
jbe 0x6844
movapd %xmm3, %xmm1
movapd %xmm6, %xmm0
movapd %xmm7, %xmm5
jmp 0x6844
cltq
leaq (%rax,%rax,4), %rax
movslq %r10d, %rcx
addq %rax, %rcx
movsd (%rdi,%rcx,8), %xmm4
movsd (%rsi,%rcx,8), %xmm3
movapd 0x687e(%rip), %xmm6     # 0xd0e0
andpd %xmm0, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x688f
movsd (%r8), %xmm2
movsd 0x8(%r8), %xmm6
addsd %xmm4, %xmm6
addsd 0x10(%r8), %xmm6
addsd %xmm3, %xmm2
divsd %xmm6, %xmm2
ucomisd %xmm5, %xmm2
jbe 0x689a
movsd %xmm4, (%rdx)
movsd %xmm3, 0x8(%rdx)
jmp 0x68a3
movsd %xmm1, (%rdx)
movsd %xmm0, 0x8(%rdx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq