// File: /workspace/github_c_makefile_star2_O1/jiqingxiaoxi[P]RPA/RPA.c
// Function: maxTM
void maxTM(int i,int j,double stackEntropies[],double stackEnthalpies[],double Initdouble[],int Initint[],double enthalpyDPT[],double entropyDPT[],char numSeq1[],char numSeq2[])
{
	double T0,T1,S0,S1,H0,H1;

	S0=entropyDPT[(i-1)*Initint[2]+j-1];
	H0=enthalpyDPT[(i-1)*Initint[2]+j-1];
	T0=(H0+Initdouble[0])/(S0+Initdouble[1]+Initdouble[2]); // at current position 
	if(fabs(enthalpyDPT[(i-2)*Initint[2]+j-2])<999999999&&fabs(Hs(i-1,j-1,1,stackEnthalpies,Initint,numSeq1,numSeq2))<999999999)
	{
		S1=(entropyDPT[(i-2)*Initint[2]+j-2]+Ss(i-1,j-1,1,stackEntropies,Initint,numSeq1,numSeq2));
		H1=(enthalpyDPT[(i-2)*Initint[2]+j-2]+Hs(i-1,j-1,1,stackEnthalpies,Initint,numSeq1,numSeq2));
	}
	else
	{
		S1=-1.0;
		H1=1.0*INFINITY;
	}
	T1=(H1+Initdouble[0])/(S1+Initdouble[1]+Initdouble[2]);

	if(S1<-2500.0)
	{
// to not give dH any value if dS is unreasonable
		S1=-3224.0;
		H1=0.0;
	}
	if(S0<-2500.0)
	{
// to not give dH any value if dS is unreasonable
		S0=-3224.0;
		H0=0.0;
	}
	if((T1>T0)||(S0>0&&H0>0)) // T1 on suurem 
	{
		entropyDPT[(i-1)*Initint[2]+j-1]=S1;
		enthalpyDPT[(i-1)*Initint[2]+j-1]=H1;
	}
	else if(T0>=T1)
	{
		entropyDPT[(i-1)*Initint[2]+j-1]=S0;
		enthalpyDPT[(i-1)*Initint[2]+j-1]=H0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x18(%rbp), %r10
movq 0x10(%rbp), %rax
movslq %edi, %rbx
leaq -0x1(%rbx), %r11
movl 0x8(%r9), %edi
addl $-0x2, %ebx
imull %edi, %ebx
imull %r11d, %edi
addl %esi, %edi
movslq %edi, %rdi
movsd -0x8(%r10,%rdi,8), %xmm1
movsd -0x8(%rax,%rdi,8), %xmm2
movsd (%r8), %xmm0
movsd 0x8(%r8), %xmm3
movapd %xmm1, %xmm4
addsd %xmm3, %xmm4
movsd 0x10(%r8), %xmm5
addl %esi, %ebx
movslq %ebx, %r8
movsd -0x10(%rax,%r8,8), %xmm8
movapd 0x6a2f(%rip), %xmm10    # 0xe0b0
andpd %xmm8, %xmm10
movsd 0x699a(%rip), %xmm7     # 0xe028
movsd 0x69a2(%rip), %xmm6     # 0xe038
movsd 0x6991(%rip), %xmm9     # 0xe030
ucomisd %xmm10, %xmm9
jbe 0x771d
movq 0x28(%rbp), %r9
movq 0x20(%rbp), %rbx
movsbq (%rbx,%r11), %r14
movsbq 0x1(%rbx,%r11), %r11
movslq %esi, %rsi
movsbq -0x1(%r9,%rsi), %rbx
movsbq (%r9,%rsi), %rsi
imulq $0x3e8, %r14, %r9       # imm = 0x3E8
addq %r9, %rcx
imulq $0xc8, %r11, %r14
shlq $0x3, %rbx
leaq (%rbx,%rbx,4), %r11
addq %r14, %r11
addq %r11, %rcx
movsd (%rcx,%rsi,8), %xmm10
movapd 0x69bb(%rip), %xmm11    # 0xe0b0
andpd %xmm10, %xmm11
ucomisd %xmm11, %xmm9
jbe 0x771d
movsd -0x10(%r10,%r8,8), %xmm6
addq %r9, %rdx
addq %r11, %rdx
addsd (%rdx,%rsi,8), %xmm6
addsd %xmm10, %xmm8
movapd %xmm8, %xmm7
movapd %xmm2, %xmm8
addsd %xmm0, %xmm8
addsd %xmm5, %xmm4
addsd %xmm7, %xmm0
addsd %xmm6, %xmm3
addsd %xmm5, %xmm3
movsd 0x6908(%rip), %xmm11    # 0xe048
ucomisd %xmm6, %xmm11
movapd %xmm6, %xmm5
cmpltsd %xmm11, %xmm5
movsd 0x68e8(%rip), %xmm10    # 0xe040
movapd %xmm5, %xmm9
andpd %xmm10, %xmm9
andnpd %xmm6, %xmm5
orpd %xmm9, %xmm5
xorpd %xmm9, %xmm9
xorpd %xmm6, %xmm6
ja 0x777a
movapd %xmm7, %xmm6
divsd %xmm4, %xmm8
divsd %xmm3, %xmm0
ucomisd %xmm1, %xmm11
ja 0x778f
movapd %xmm2, %xmm9
ucomisd %xmm8, %xmm0
ja 0x77cf
movapd %xmm1, %xmm2
cmpltsd %xmm11, %xmm2
andpd %xmm2, %xmm10
andnpd %xmm1, %xmm2
orpd %xmm10, %xmm2
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm2
jbe 0x77bf
ucomisd %xmm1, %xmm9
ja 0x77cf
ucomisd %xmm0, %xmm8
movapd %xmm2, %xmm5
movapd %xmm9, %xmm6
jb 0x77dc
movsd %xmm5, -0x8(%r10,%rdi,8)
movsd %xmm6, -0x8(%rax,%rdi,8)
popq %rbx
popq %r14
popq %rbp
retq