// File: /workspace/github_c_makefile_star2_O2/jiqingxiaoxi[P]RPA/RPA.c
// Function: END5_3
double END5_3(int i,int hs,double dangleEntropies3[],double dangleEnthalpies3[],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+1]*5+numSeq1[i-1]]+Hd3(i-1,k+1,dangleEnthalpies3,numSeq1)+enthalpyDPT[k*Initint[2]+i-2];
			S=send5[k]+atpS[numSeq1[k+1]*5+numSeq1[i-1]]+Sd3(i-1,k+1,dangleEntropies3,numSeq1)+entropyDPT[k*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+1]*5+numSeq1[i-1]]+Hd3(i-1,k+1,dangleEnthalpies3,numSeq1)+enthalpyDPT[k*Initint[2]+i-2];
			S=atpS[numSeq1[k+1]*5+numSeq1[i-1]]+Sd3(i-1,k+1,dangleEntropies3,numSeq1)+entropyDPT[k*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, -0x40(%rbp)
movq %r8, -0x38(%rbp)
movl %esi, -0x2c(%rbp)
movq 0x40(%rbp), %rax
movslq %edi, %rdi
cmpl $0x6, %edi
movl $0x5, %r8d
cmovgel %edi, %r8d
addl $-0x5, %r8d
movsd 0x86ea(%rip), %xmm1     # 0xd040
movsd 0x86ca(%rip), %xmm2     # 0xd028
movsd 0x86fa(%rip), %xmm3     # 0xd060
xorpd %xmm4, %xmm4
movsd 0x86be(%rip), %xmm5     # 0xd030
movsd 0x86ce(%rip), %xmm6     # 0xd048
movapd %xmm2, %xmm0
movapd %xmm1, %xmm8
movq 0x10(%rbp), %r13
xorl %r10d, %r10d
cmpq %r10, %r8
je 0x4b6e
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 0x1(%rax,%r10), %rsi
imulq $0x28, %rsi, %r14
movq -0x40(%rbp), %r11
addq %r14, %r11
ucomisd %xmm9, %xmm14
movsbq -0x1(%rax,%rdi), %r15
movsd (%r11,%r15,8), %xmm14
jae 0x4a5a
movsbq (%rax,%rdi), %rbx
imulq $0xc8, %r15, %r11
leaq (%rcx,%r11), %r12
imulq $0x28, %rbx, %rbx
addq %rbx, %r12
addsd (%r12,%rsi,8), %xmm14
movq 0x18(%rbp), %r9
movl 0x8(%r9), %r12d
imull %r10d, %r12d
addl %edi, %r12d
movslq %r12d, %r12
movq 0x20(%rbp), %r9
addsd -0x10(%r9,%r12,8), %xmm14
addq -0x38(%rbp), %r14
movsd (%r14,%r15,8), %xmm12
movapd %xmm14, %xmm13
jmp 0x4aa3
addsd %xmm14, %xmm13
movsbq (%rax,%rdi), %rbx
imulq $0xc8, %r15, %r11
leaq (%rcx,%r11), %r12
imulq $0x28, %rbx, %rbx
addq %rbx, %r12
addsd (%r12,%rsi,8), %xmm13
movq 0x18(%rbp), %r9
movl 0x8(%r9), %r12d
imull %r10d, %r12d
addl %edi, %r12d
movslq %r12d, %r12
movq 0x20(%rbp), %r9
addsd -0x10(%r9,%r12,8), %xmm13
addq -0x38(%rbp), %r14
addsd (%r14,%r15,8), %xmm12
addq %rdx, %r11
addq %rbx, %r11
addsd (%r11,%rsi,8), %xmm12
movq 0x28(%rbp), %rsi
addsd -0x10(%rsi,%r12,8), %xmm12
movapd %xmm13, %xmm9
andpd 0x8618(%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 0x4b04
movapd %xmm13, %xmm14
movapd %xmm1, %xmm13
jne 0x4b10
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 0x4b58
movapd %xmm3, %xmm7
movapd %xmm0, %xmm14
movapd %xmm8, %xmm13
incq %r10
movapd %xmm7, %xmm3
movapd %xmm14, %xmm0
movapd %xmm13, %xmm8
jmp 0x498a
cmpl $0x1, -0x2c(%rbp)
je 0x4b79
movapd %xmm8, %xmm0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq