// File: /workspace/github_c_makefile_star2_O2/jiqingxiaoxi[P]RPA/RPA.c
// Function: END5_2
double END5_2(int i,int hs,double dangleEntropies5[],double dangleEnthalpies5[],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-6;++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]]+Hd5(i,k+2,dangleEnthalpies5,numSeq1)+enthalpyDPT[(k+1)*Initint[2]+i-1];
			S=send5[k]+atpS[numSeq1[k+2]*5+numSeq1[i]]+Sd5(i,k+2,dangleEntropies5,numSeq1)+entropyDPT[(k+1)*Initint[2]+i-1];
			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]]+Hd5(i,k+2,dangleEnthalpies5,numSeq1)+enthalpyDPT[(k+1)*Initint[2]+i-1];
			S=atpS[numSeq1[k+2]*5+numSeq1[i]]+Sd5(i,k+2,dangleEntropies5,numSeq1)+entropyDPT[(k+1)*Initint[2]+i-1];
			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, -0x40(%rbp)
movq %r8, -0x38(%rbp)
movl %esi, -0x2c(%rbp)
movq 0x40(%rbp), %rax
movslq %edi, %r8
cmpl $0x6, %r8d
movl $0x5, %r12d
cmovgel %r8d, %r12d
addl $-0x5, %r12d
movsd 0x8951(%rip), %xmm1     # 0xd040
movsd 0x8931(%rip), %xmm2     # 0xd028
movsd 0x8961(%rip), %xmm3     # 0xd060
xorpd %xmm4, %xmm4
movsd 0x8925(%rip), %xmm5     # 0xd030
movsd 0x8935(%rip), %xmm6     # 0xd048
movapd %xmm2, %xmm0
movapd %xmm1, %xmm8
movq 0x10(%rbp), %r10
xorl %esi, %esi
cmpq %r12, %rsi
je 0x4908
movq 0x38(%rbp), %r9
movsd (%r9,%rsi,8), %xmm13
movsd (%r10), %xmm7
movsd 0x8(%r10), %xmm10
movapd %xmm13, %xmm14
addsd %xmm7, %xmm14
movq 0x30(%rbp), %r9
movsd (%r9,%rsi,8), %xmm12
movapd %xmm12, %xmm15
addsd %xmm10, %xmm15
movsd 0x10(%r10), %xmm11
addsd %xmm11, %xmm15
divsd %xmm15, %xmm14
movapd %xmm10, %xmm15
addsd %xmm11, %xmm15
movapd %xmm7, %xmm9
divsd %xmm15, %xmm9
movsbq 0x2(%rax,%rsi), %r11
imulq $0x28, %r11, %r11
movq -0x40(%rbp), %r9
leaq (%r9,%r11), %rbx
ucomisd %xmm9, %xmm14
movsbq (%rax,%r8), %r13
movsd (%rbx,%r13,8), %xmm14
jae 0x47f4
movsbq 0x1(%rax,%rsi), %rbx
imulq $0xc8, %r13, %r14
leaq (%rcx,%r14), %r9
addq %r11, %r9
addsd (%r9,%rbx,8), %xmm14
incq %rsi
movq 0x18(%rbp), %r9
movl 0x8(%r9), %r9d
imull %esi, %r9d
addl %edi, %r9d
movslq %r9d, %r15
movq 0x20(%rbp), %r9
addsd -0x8(%r9,%r15,8), %xmm14
movq -0x38(%rbp), %r9
addq %r11, %r9
movsd (%r9,%r13,8), %xmm12
movapd %xmm14, %xmm13
jmp 0x4840
addsd %xmm14, %xmm13
movsbq 0x1(%rax,%rsi), %rbx
imulq $0xc8, %r13, %r14
leaq (%rcx,%r14), %r15
addq %r11, %r15
addsd (%r15,%rbx,8), %xmm13
incq %rsi
movq 0x18(%rbp), %r9
movl 0x8(%r9), %r15d
imull %esi, %r15d
addl %edi, %r15d
movslq %r15d, %r15
movq 0x20(%rbp), %r9
addsd -0x8(%r9,%r15,8), %xmm13
movq -0x38(%rbp), %r9
addq %r11, %r9
addsd (%r9,%r13,8), %xmm12
addq %rdx, %r14
addq %r11, %r14
addsd (%r14,%rbx,8), %xmm12
movq 0x28(%rbp), %r9
addsd -0x8(%r9,%r15,8), %xmm12
movapd %xmm13, %xmm9
andpd 0x887b(%rip), %xmm9     # 0xd0e0
movapd %xmm5, %xmm14
cmpltpd %xmm9, %xmm14
xorpd %xmm9, %xmm9
cmpltpd %xmm13, %xmm9
orpd %xmm14, %xmm9
ucomisd %xmm4, %xmm12
seta %r9b
movd %xmm9, %r11d
orb %r11b, %r9b
movapd %xmm2, %xmm14
testb $0x1, %r9b
jne 0x48a1
movapd %xmm13, %xmm14
movapd %xmm1, %xmm13
jne 0x48ad
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, %r9d
testb $0x1, %r9b
jne 0x48f5
movapd %xmm3, %xmm7
movapd %xmm0, %xmm14
movapd %xmm8, %xmm13
movapd %xmm7, %xmm3
movapd %xmm14, %xmm0
movapd %xmm13, %xmm8
jmp 0x4722
cmpl $0x1, -0x2c(%rbp)
je 0x4913
movapd %xmm8, %xmm0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq