// File: /workspace/github_c_makefile_star2_O2/jiqingxiaoxi[P]RPA/RPA.c
// Function: END5_4
double END5_4(int i,int hs,double tstack2Entropies[],double tstack2Enthalpies[],double atpS[],double atpH[],double Initdouble[],int Initint[],double enthalpyDPT[],double entropyDPT[],double send5[],double hend5[],char numSeq1[])
{
	int k;
	double max_tm,T1,T2,H,S,H_max,S_max;

	H_max=1.0*INFINITY;
	max_tm=-1.0*INFINITY;
	S_max=-1.0;
	for(k=0;k<=i-7;++k)
	{
		T1=(hend5[k]+Initdouble[0])/(send5[k]+Initdouble[1]+Initdouble[2]);
		T2=Initdouble[0]/(Initdouble[1]+Initdouble[2]);
		if(T1>=T2)
		{
			H=hend5[k]+atpH[numSeq1[k+2]*5+numSeq1[i-1]]+Htstack(i-1,k+2,tstack2Enthalpies,numSeq1)+enthalpyDPT[(k+1)*Initint[2]+i-2];
			S=send5[k]+atpS[numSeq1[k+2]*5+numSeq1[i-1]]+Ststack(i-1,k+2,tstack2Entropies,numSeq1)+entropyDPT[(k+1)*Initint[2]+i-2];
			if(fabs(H)>999999999||H>0||S>0)
			{
				H=1.0*INFINITY;
				S=-1.0;
			}
			T1=(H+Initdouble[0])/(S+Initdouble[1]+Initdouble[2]);
		}
		else
		{
			H=atpH[numSeq1[k+2]*5+numSeq1[i-1]]+Htstack(i-1,k+2,tstack2Enthalpies,numSeq1)+enthalpyDPT[(k+1)*Initint[2]+i-2];
			S=atpS[numSeq1[k+2]*5+numSeq1[i-1]]+Ststack(i-1,k+2,tstack2Entropies,numSeq1)+entropyDPT[(k+1)*Initint[2]+i-2];
			if(fabs(H)>999999999||H>0||S>0)
			{
				H=1.0*INFINITY;
				S=-1.0;
			}
			T1=(H+Initdouble[0])/(S+Initdouble[1]+Initdouble[2]);
 		}

		if(max_tm<T1)
		{
			if(S>-2500.0)
			{
				H_max=H;
				S_max=S;
				max_tm=T1;
			}
		}
	}
	if(hs==1)
		return H_max;
	return S_max;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x38(%rbp)
movl %esi, -0x2c(%rbp)
movq 0x40(%rbp), %rax
movslq %edi, %rdi
cmpl $0x7, %edi
movl $0x6, %r9d
cmovgel %edi, %r9d
addl $-0x6, %r9d
movsd 0x8488(%rip), %xmm1     # 0xd040
movsd 0x8468(%rip), %xmm2     # 0xd028
movsd 0x8498(%rip), %xmm3     # 0xd060
xorpd %xmm4, %xmm4
movsd 0x845c(%rip), %xmm5     # 0xd030
movsd 0x846c(%rip), %xmm6     # 0xd048
movapd %xmm2, %xmm0
movapd %xmm1, %xmm8
movq 0x10(%rbp), %r13
xorl %r10d, %r10d
cmpq %r9, %r10
je 0x4dee
movq 0x38(%rbp), %rsi
movsd (%rsi,%r10,8), %xmm13
movsd (%r13), %xmm7
movsd 0x8(%r13), %xmm10
movapd %xmm13, %xmm14
addsd %xmm7, %xmm14
movq 0x30(%rbp), %rsi
movsd (%rsi,%r10,8), %xmm12
movapd %xmm12, %xmm15
addsd %xmm10, %xmm15
movsd 0x10(%r13), %xmm11
addsd %xmm11, %xmm15
divsd %xmm15, %xmm14
movapd %xmm10, %xmm15
addsd %xmm11, %xmm15
movapd %xmm7, %xmm9
divsd %xmm15, %xmm9
movsbq 0x2(%rax,%r10), %rsi
imulq $0x28, %rsi, %rsi
movq -0x38(%rbp), %r11
addq %rsi, %r11
ucomisd %xmm9, %xmm14
movsbq -0x1(%rax,%rdi), %rbx
movsd (%r11,%rbx,8), %xmm14
jae 0x4ccb
movsbq (%rax,%rdi), %r14
imulq $0x3e8, %rbx, %r11      # imm = 0x3E8
leaq (%r8,%rsi), %r15
movsd (%r15,%rbx,8), %xmm12
imulq $0xc8, %r14, %rbx
leaq (%rbx,%rsi), %r12
addq %rcx, %r12
addq %r11, %r12
movsbq 0x1(%rax,%r10), %r14
addsd (%r12,%r14,8), %xmm14
incq %r10
movq 0x18(%rbp), %r15
movl 0x8(%r15), %r15d
imull %r10d, %r15d
addl %edi, %r15d
movslq %r15d, %r15
movq 0x20(%rbp), %r12
addsd -0x10(%r12,%r15,8), %xmm14
movapd %xmm14, %xmm13
jmp 0x4d23
addsd %xmm14, %xmm13
movsbq (%rax,%rdi), %r14
leaq (%r8,%rsi), %r11
addsd (%r11,%rbx,8), %xmm12
imulq $0x3e8, %rbx, %r11      # imm = 0x3E8
imulq $0xc8, %r14, %rbx
leaq (%rbx,%rsi), %r12
addq %rcx, %r12
addq %r11, %r12
movsbq 0x1(%rax,%r10), %r14
addsd (%r12,%r14,8), %xmm13
incq %r10
movq 0x18(%rbp), %r15
movl 0x8(%r15), %r15d
imull %r10d, %r15d
addl %edi, %r15d
movslq %r15d, %r15
movq 0x20(%rbp), %r12
addsd -0x10(%r12,%r15,8), %xmm13
addq %rdx, %r11
addq %rsi, %rbx
addq %r11, %rbx
addsd (%rbx,%r14,8), %xmm12
movq 0x28(%rbp), %rsi
addsd -0x10(%rsi,%r15,8), %xmm12
movapd %xmm13, %xmm9
andpd 0x8395(%rip), %xmm9     # 0xd0e0
movapd %xmm5, %xmm14
cmpltpd %xmm9, %xmm14
xorpd %xmm9, %xmm9
cmpltpd %xmm13, %xmm9
orpd %xmm14, %xmm9
ucomisd %xmm4, %xmm12
seta %sil
movd %xmm9, %r11d
orb %r11b, %sil
movapd %xmm2, %xmm14
testb $0x1, %sil
jne 0x4d87
movapd %xmm13, %xmm14
movapd %xmm1, %xmm13
jne 0x4d93
movapd %xmm12, %xmm13
addsd %xmm14, %xmm7
addsd %xmm13, %xmm10
addsd %xmm10, %xmm11
divsd %xmm11, %xmm7
movapd %xmm3, %xmm9
cmpltpd %xmm7, %xmm9
movapd %xmm6, %xmm10
cmpltpd %xmm13, %xmm10
andpd %xmm9, %xmm10
movd %xmm10, %esi
testb $0x1, %sil
jne 0x4ddb
movapd %xmm3, %xmm7
movapd %xmm0, %xmm14
movapd %xmm8, %xmm13
movapd %xmm7, %xmm3
movapd %xmm14, %xmm0
movapd %xmm13, %xmm8
jmp 0x4bec
cmpl $0x1, -0x2c(%rbp)
je 0x4df9
movapd %xmm8, %xmm0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq