// File: /workspace/github_c_makefile_star2_O1/jiqingxiaoxi[P]RPA/RPA.c
// Function: END5_1
double END5_1(int i,int hs,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;

	max_tm=-1.0*INFINITY;
	H_max=1.0*INFINITY;
	S_max=-1.0;
	for(k=0;k<=i-5;++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+1]*5+numSeq1[i]]+enthalpyDPT[k*Initint[2]+i-1];
			S=send5[k]+atpS[numSeq1[k+1]*5+numSeq1[i]]+entropyDPT[k*Initint[2]+i-1];
			if(fabs(H)>999999999||H>0||S>0)  // H and S must be greater than 0 to avoid BS
			{
				H=1.0*INFINITY;
				S=-1.0;
			}
			T1=(H+Initdouble[0])/(S+Initdouble[1]+Initdouble[2]);
		}
		else
		{
			H=atpH[numSeq1[k+1]*5+numSeq1[i]]+enthalpyDPT[k*Initint[2]+i-1];
			S=atpS[numSeq1[k+1]*5+numSeq1[i]]+entropyDPT[k*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
movl %esi, -0x2c(%rbp)
cmpl $0x5, %edi
jge 0x4781
movsd 0x98c4(%rip), %xmm14    # 0xe038
movsd 0x98ac(%rip), %xmm0     # 0xe028
jmp 0x4955
movq 0x30(%rbp), %rax
movq 0x20(%rbp), %r11
movq 0x18(%rbp), %rbx
movq 0x10(%rbp), %r14
movsd (%r8), %xmm1
movsd 0x8(%r8), %xmm2
movsd 0x10(%r8), %xmm3
movapd %xmm2, %xmm0
addsd %xmm3, %xmm0
movapd %xmm1, %xmm4
divsd %xmm0, %xmm4
movl %edi, %r8d
leal -0x1(%rdi), %r15d
addl $-0x4, %edi
movsd 0x989b(%rip), %xmm11    # 0xe060
movsd 0x985b(%rip), %xmm5     # 0xe028
movsd 0x9863(%rip), %xmm6     # 0xe038
xorl %r12d, %r12d
movsd 0x984f(%rip), %xmm9     # 0xe030
movsd 0x985e(%rip), %xmm8     # 0xe048
movapd %xmm6, %xmm12
movapd %xmm5, %xmm13
movq 0x28(%rbp), %rsi
movsd (%rsi,%r12,8), %xmm14
movapd %xmm14, %xmm0
addsd %xmm1, %xmm0
movsd (%r11,%r12,8), %xmm7
movapd %xmm7, %xmm15
addsd %xmm2, %xmm15
addsd %xmm3, %xmm15
divsd %xmm15, %xmm0
ucomisd %xmm4, %xmm0
jae 0x485a
movsbq 0x1(%rax,%r12), %r10
leaq (%r10,%r10,4), %r10
movsbq (%rax,%r8), %rsi
addq %r10, %rsi
movsd (%rcx,%rsi,8), %xmm14
movl 0x8(%r9), %r10d
imull %r12d, %r10d
addl %r15d, %r10d
movslq %r10d, %r13
addsd (%r14,%r13,8), %xmm14
movsd (%rdx,%rsi,8), %xmm7
jmp 0x488d
movsbq 0x1(%rax,%r12), %r13
leaq (%r13,%r13,4), %r13
movsbq (%rax,%r8), %r10
addq %r13, %r10
addsd (%rcx,%r10,8), %xmm14
movl 0x8(%r9), %r13d
imull %r12d, %r13d
addl %r15d, %r13d
movslq %r13d, %r13
addsd (%r14,%r13,8), %xmm14
addsd (%rdx,%r10,8), %xmm7
addsd (%rbx,%r13,8), %xmm7
movapd %xmm14, %xmm0
andpd 0x9810(%rip), %xmm0     # 0xe0b0
movapd %xmm9, %xmm15
cmpltpd %xmm0, %xmm15
xorpd %xmm0, %xmm0
cmpltpd %xmm14, %xmm0
orpd %xmm15, %xmm0
ucomisd 0x97a6(%rip), %xmm7     # 0xe068
seta %sil
movd %xmm0, %r10d
orb %r10b, %sil
movapd %xmm5, %xmm0
testb $0x1, %sil
jne 0x48dd
movapd %xmm14, %xmm0
movapd %xmm6, %xmm14
jne 0x48e9
movapd %xmm7, %xmm14
movapd %xmm1, %xmm15
addsd %xmm0, %xmm15
movapd %xmm14, %xmm7
addsd %xmm2, %xmm7
addsd %xmm3, %xmm7
divsd %xmm7, %xmm15
movapd %xmm11, %xmm7
cmpltpd %xmm15, %xmm7
movapd %xmm8, %xmm10
cmpltpd %xmm14, %xmm10
andpd %xmm7, %xmm10
movd %xmm10, %esi
testb $0x1, %sil
jne 0x493a
movapd %xmm11, %xmm15
movapd %xmm13, %xmm0
movapd %xmm12, %xmm14
incq %r12
movapd %xmm14, %xmm12
movapd %xmm0, %xmm13
movapd %xmm15, %xmm11
cmpq %r12, %rdi
jne 0x47f4
cmpl $0x1, -0x2c(%rbp)
je 0x4960
movapd %xmm14, %xmm0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq