// File: /workspace/github_c_makefile_star2_O3/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, %r15
movsbl (%r11,%r15), %eax
movslq %esi, %r12
movsbl (%rbx,%r12), %r10d
leal (%r10,%rax), %r14d
cmpl $0x3, %r14d
jne 0x7151
leal (%rax,%rax,4), %r14d
movsbl -0x1(%rbx,%r12), %esi
imull $0x7d, %r10d, %edi
leal (%rsi,%rsi,4), %ebx
movsbl -0x1(%r11,%r15), %r11d
leal (%rbx,%rbx,4), %esi
addl %r14d, %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
addl %r10d, %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 0x700b(%rip), %xmm6     # 0xe0c0
movapd %xmm0, %xmm4
andpd %xmm6, %xmm4
movsd 0x6f5b(%rip), %xmm2     # 0xe020
ucomisd %xmm2, %xmm4
movapd %xmm2, %xmm1
cmpnltsd %xmm4, %xmm1
andpd %xmm1, %xmm7
movsd 0x6f51(%rip), %xmm8     # 0xe030
andnpd %xmm8, %xmm1
orpd %xmm7, %xmm1
jbe 0x70f2
movsd 0x6f26(%rip), %xmm0     # 0xe018
leal (%r10,%r10,4), %r15d
leal (%r15,%r15,4), %r15d
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 0x718b
ucomisd %xmm6, %xmm2
addsd (%rcx,%rbx,8), %xmm3
addsd %xmm7, %xmm5
ja 0x7195
movapd 0x6f7b(%rip), %xmm6     # 0xe0c0
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x71b4
jmp 0x71bc
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 0x7295
ucomisd %xmm6, %xmm2
jbe 0x7236
addsd %xmm8, %xmm5
movapd 0x6f1e(%rip), %xmm6     # 0xe0c0
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x71b4
addsd (%r9,%r11,8), %xmm3
jmp 0x71bc
movsd 0x6e74(%rip), %xmm3     # 0xe030
movapd %xmm2, %xmm7
cmpltsd %xmm6, %xmm7
movsd 0x6e4b(%rip), %xmm6     # 0xe018
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 0x7228
addsd %xmm0, %xmm5
movapd %xmm1, %xmm4
addsd %xmm8, %xmm4
addsd %xmm9, %xmm4
divsd %xmm4, %xmm5
ucomisd %xmm5, %xmm7
jbe 0x7236
movapd %xmm3, %xmm1
movapd %xmm6, %xmm0
movapd %xmm7, %xmm5
jmp 0x7236
cltq
leaq (%rax,%rax,4), %rax
movslq %r10d, %rcx
addq %rax, %rcx
movsd (%rdi,%rcx,8), %xmm4
movsd (%rsi,%rcx,8), %xmm3
movapd 0x6e6c(%rip), %xmm6     # 0xe0c0
andpd %xmm0, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x7281
movsd (%r8), %xmm2
movsd 0x8(%r8), %xmm6
addsd %xmm4, %xmm6
addsd 0x10(%r8), %xmm6
addsd %xmm3, %xmm2
divsd %xmm6, %xmm2
ucomisd %xmm5, %xmm2
jbe 0x728c
movsd %xmm4, (%rdx)
movsd %xmm3, 0x8(%rdx)
jmp 0x7295
movsd %xmm1, (%rdx)
movsd %xmm0, 0x8(%rdx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq