// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
movq 0x60(%rbp), %r14
movq 0x58(%rbp), %r11
movslq %edi, %rbx
movsbl (%r11,%rbx), %eax
movslq %esi, %r15
movsbl (%r14,%r15), %r10d
leal (%r10,%rax), %r12d
cmpl $0x3, %r12d
jne 0x7478
movq %rcx, -0x38(%rbp)
movq %r9, %rcx
movq %rdx, -0x40(%rbp)
movq 0x30(%rbp), %r9
movq 0x28(%rbp), %rdx
movq 0x20(%rbp), %r12
movq 0x18(%rbp), %r13
movq %rax, -0x30(%rbp)
leal (%rax,%rax,4), %esi
leal (%rsi,%r10), %edi
movslq %edi, %rdi
movsd (%rdx,%rdi,8), %xmm3
imull $0x7d, %r10d, %eax
movsbl -0x1(%r14,%r15), %r14d
leal (%r14,%r14,4), %r14d
leal (%r14,%r14,4), %r15d
movsbl -0x1(%r11,%rbx), %ebx
addl %esi, %ebx
addl %ebx, %r15d
addl %eax, %r15d
movslq %r15d, %rax
movsd (%r13,%rax,8), %xmm7
addsd %xmm3, %xmm7
movsd (%r9,%rdi,8), %xmm5
movsd (%r12,%rax,8), %xmm1
addsd %xmm5, %xmm1
movapd 0x6cfe(%rip), %xmm6     # 0xe0b0
movapd %xmm1, %xmm4
andpd %xmm6, %xmm4
movsd 0x6c6e(%rip), %xmm2     # 0xe030
ucomisd %xmm2, %xmm4
movapd %xmm2, %xmm0
cmpnltsd %xmm4, %xmm0
andpd %xmm0, %xmm7
movsd 0x6c5c(%rip), %xmm8     # 0xe038
andnpd %xmm8, %xmm0
orpd %xmm7, %xmm0
jbe 0x73ef
movsd 0x6c39(%rip), %xmm1     # 0xe028
movq 0x38(%rbp), %r11
movq 0x10(%rbp), %r15
leal (%r10,%r10,4), %eax
leal (%rax,%rax,4), %r12d
movq -0x30(%rbp), %rax
addl %eax, %r14d
addl %r12d, %r14d
movslq %r14d, %r14
movsd (%r8,%r14,8), %xmm7
movapd %xmm7, %xmm8
andpd %xmm6, %xmm8
ucomisd %xmm8, %xmm2
movq %rcx, %rdx
jbe 0x74d7
leal (%rbx,%r12), %eax
movslq %eax, %r8
movsd (%r15,%r8,8), %xmm9
movapd 0x6c70(%rip), %xmm10    # 0xe0b0
andpd %xmm9, %xmm10
ucomisd %xmm10, %xmm2
jbe 0x74b2
addsd %xmm7, %xmm5
addsd %xmm9, %xmm5
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x751c
movq -0x38(%rbp), %rax
addsd (%rax,%r14,8), %xmm3
addsd (%rdx,%r8,8), %xmm3
jmp 0x7524
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 0x7612
ucomisd %xmm8, %xmm2
movq -0x30(%rbp), %rax
jbe 0x74d7
addsd %xmm7, %xmm5
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x7512
movq -0x38(%rbp), %rcx
addsd (%rcx,%r14,8), %xmm3
jmp 0x7528
addl %r12d, %ebx
movslq %ebx, %rcx
movsd (%r15,%rcx,8), %xmm7
movapd 0x6bc4(%rip), %xmm8     # 0xe0b0
andpd %xmm7, %xmm8
ucomisd %xmm8, %xmm2
jbe 0x750d
addsd %xmm7, %xmm5
andpd %xmm5, %xmm6
ucomisd %xmm2, %xmm6
ja 0x7512
addsd (%rdx,%rcx,8), %xmm3
jmp 0x7528
jmp 0x75a6
movsd 0x6b1e(%rip), %xmm3     # 0xe038
jmp 0x7528
movsd 0x6b14(%rip), %xmm3     # 0xe038
movq -0x30(%rbp), %rax
ucomisd %xmm2, %xmm4
movapd %xmm2, %xmm7
cmpltsd %xmm6, %xmm7
movsd 0x6aeb(%rip), %xmm6     # 0xe028
andpd %xmm7, %xmm6
andnpd %xmm5, %xmm7
orpd %xmm7, %xmm6
movsd (%r11), %xmm5
movsd 0x8(%r11), %xmm8
movapd %xmm6, %xmm7
addsd %xmm5, %xmm7
movapd %xmm3, %xmm10
addsd %xmm8, %xmm10
movsd 0x10(%r11), %xmm9
addsd %xmm9, %xmm10
divsd %xmm10, %xmm7
ja 0x759a
ucomisd %xmm4, %xmm2
jbe 0x759a
addsd %xmm1, %xmm5
movapd %xmm0, %xmm4
addsd %xmm8, %xmm4
addsd %xmm9, %xmm4
divsd %xmm4, %xmm5
ucomisd %xmm5, %xmm7
jbe 0x75a6
movapd %xmm3, %xmm0
movapd %xmm6, %xmm1
movapd %xmm7, %xmm5
cltq
leaq (%rax,%rax,4), %rax
movslq %r10d, %rcx
addq %rax, %rcx
movq 0x28(%rbp), %rax
movsd (%rax,%rcx,8), %xmm4
movsd (%r9,%rcx,8), %xmm3
movapd 0x6ae7(%rip), %xmm6     # 0xe0b0
andpd %xmm1, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x7605
movsd (%r11), %xmm2
movsd 0x8(%r11), %xmm6
addsd %xmm4, %xmm6
addsd 0x10(%r11), %xmm6
addsd %xmm3, %xmm2
divsd %xmm6, %xmm2
ucomisd %xmm5, %xmm2
movq -0x40(%rbp), %rdx
ja 0x7609
movsd %xmm0, (%rdx)
movsd %xmm1, 0x8(%rdx)
jmp 0x7612
movq -0x40(%rbp), %rdx
movsd %xmm4, (%rdx)
movsd %xmm3, 0x8(%rdx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq