// File: /workspace/github_c_makefile_star2_O0/jiqingxiaoxi[P]RPA/RPA.c
// Function: calc_terminal_bp
void calc_terminal_bp(double temp,double dangleEntropies3[],double dangleEnthalpies3[],double dangleEntropies5[],double dangleEnthalpies5[],double tstack2Entropies[],double tstack2Enthalpies[],double atpS[],double atpH[],double Initdouble[],int Initint[],double enthalpyDPT[],double entropyDPT[],double send5[],double hend5[],char numSeq1[])
{
	int i,max;
	double T1,T2,T3,T4,T5,G,end5_11,end5_12,end5_21,end5_22,end5_31,end5_32,end5_41,end5_42;
	
	send5[0]=send5[1]= -1.0;
	hend5[0]=hend5[1]=1.0*INFINITY;

	for(i=2;i<=Initint[0];i++)
	{
		send5[i]=-3224.0;
		hend5[i]=0;
	}

// adding terminal penalties to 3' end and to 5' end 
	for(i=2;i<=Initint[0];++i)
	{
		max=0;
		T1=(hend5[i-1]+Initdouble[0])/(send5[i-1]+Initdouble[1]+Initdouble[2]);
		end5_11=END5_1(i,1,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		end5_12=END5_1(i,2,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		T2=(end5_11+Initdouble[0])/(end5_12+Initdouble[1]+Initdouble[2]);
		end5_21=END5_2(i,1,dangleEntropies5,dangleEnthalpies5,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		end5_22=END5_2(i,2,dangleEntropies5,dangleEnthalpies5,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		T3=(end5_21+Initdouble[0])/(end5_22+Initdouble[1]+Initdouble[2]);
		end5_31=END5_3(i,1,dangleEntropies3,dangleEnthalpies3,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		end5_32=END5_3(i,2,dangleEntropies3,dangleEnthalpies3,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		T4=(end5_31+Initdouble[0])/(end5_32+Initdouble[1]+Initdouble[2]);
		end5_41=END5_4(i,1,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		end5_42=END5_4(i,2,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		T5=(end5_41+Initdouble[0])/(end5_42+Initdouble[1]+Initdouble[2]);

		max=max5(T1,T2,T3,T4,T5);
		switch(max)
		{
			case 1:
				send5[i]=send5[i-1];
				hend5[i]=hend5[i-1];
				break;
			case 2:
				G=end5_11-temp*end5_12;
				if(G<0.0)
				{
					send5[i]=end5_12;
					hend5[i]=end5_11;
				}
				else
				{
					send5[i]=send5[i-1];
					hend5[i]=hend5[i-1];
				}
				break;
			case 3:
				G=end5_21-temp*end5_22;
				if(G<0.0)
				{
					send5[i]=end5_22;
					hend5[i]=end5_21;
				}
				else
				{
					send5[i]=send5[i-1];
					hend5[i]=hend5[i-1];
				}
				break;
			case 4:
				G=end5_31-temp*end5_32;
				if(G<0.0)
				{
					send5[i]=end5_32;
					hend5[i]=end5_31;
				}
				else
				{
					send5[i]=send5[i-1];
					hend5[i]=hend5[i-1];
				}
				break;
			case 5:
				G=end5_41-temp*end5_42;
				if(G<0.0)
				{
					send5[i]=end5_42;
					hend5[i]=end5_41;
				}
				else
				{
					send5[i]=send5[i-1];
					hend5[i]=hend5[i-1];
				}
				break;
			default:
				break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movsd %xmm0, -0x30(%rbp)
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
movq %r8, -0x58(%rbp)
movq %r9, -0x60(%rbp)
movq 0x40(%rbp), %rax
movsd 0xffff(%rip), %xmm0     # 0x17140
movsd %xmm0, 0x8(%rax)
movq 0x40(%rbp), %rax
movsd 0xffee(%rip), %xmm0     # 0x17140
movsd %xmm0, (%rax)
movq 0x48(%rbp), %rax
movsd 0xffce(%rip), %xmm0     # 0x17130
movsd %xmm0, 0x8(%rax)
movq 0x48(%rbp), %rax
movsd 0xffbd(%rip), %xmm0     # 0x17130
movsd %xmm0, (%rax)
movl $0x2, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq 0x28(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x71b9
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd 0xffb7(%rip), %xmm0     # 0x17150
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x717e
movl $0x2, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq 0x28(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x796a
movl $0x0, -0x68(%rbp)
movq 0x48(%rbp), %rax
movl -0x64(%rbp), %ecx
decl %ecx
movslq %ecx, %rdx
movsd (%rax,%rdx,8), %xmm0
movq 0x20(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm2
addsd %xmm1, %xmm0
movq 0x40(%rbp), %rcx
movsd (%rcx,%rdx,8), %xmm1
addsd %xmm2, %xmm1
movsd 0x10(%rax), %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x64(%rbp), %edi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq 0x30(%rbp), %rsi
movq 0x38(%rbp), %r10
movq 0x40(%rbp), %r11
movq 0x48(%rbp), %rbx
movq 0x50(%rbp), %r14
movq %rsp, %rax
movq %r14, 0x20(%rax)
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
movl $0x1, %esi
movl %esi, -0xe8(%rbp)
callq 0x5f60
movsd %xmm0, -0xa0(%rbp)
movl -0x64(%rbp), %edi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movq 0x28(%rbp), %r9
movq 0x30(%rbp), %rsi
movq 0x38(%rbp), %r10
movq 0x40(%rbp), %r11
movq 0x48(%rbp), %rbx
movq 0x50(%rbp), %r14
movq %rsp, %rax
movq %r14, 0x20(%rax)
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
movl $0x2, %esi
movl %esi, -0xe4(%rbp)
callq 0x5f60
movl -0xe8(%rbp), %esi
movsd %xmm0, -0xa8(%rbp)
movsd -0xa0(%rbp), %xmm0
movq 0x20(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm2
addsd %xmm1, %xmm0
movsd -0xa8(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd 0x10(%rax), %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movl -0x64(%rbp), %edi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %r15
movq 0x48(%rbp), %r12
movq 0x50(%rbp), %r13
movq %rsp, %rax
movq %r13, 0x30(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x6320
movl -0xe4(%rbp), %esi
movsd %xmm0, -0xb0(%rbp)
movl -0x64(%rbp), %edi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %r15
movq 0x48(%rbp), %r12
movq 0x50(%rbp), %r13
movq %rsp, %rax
movq %r13, 0x30(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x6320
movl -0xe8(%rbp), %esi
movsd %xmm0, -0xb8(%rbp)
movsd -0xb0(%rbp), %xmm0
movq 0x20(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm2
addsd %xmm1, %xmm0
movsd -0xb8(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd 0x10(%rax), %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x64(%rbp), %edi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %r15
movq 0x48(%rbp), %r12
movq 0x50(%rbp), %r13
movq %rsp, %rax
movq %r13, 0x30(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x67a0
movl -0xe4(%rbp), %esi
movsd %xmm0, -0xc0(%rbp)
movl -0x64(%rbp), %edi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %r15
movq 0x48(%rbp), %r12
movq 0x50(%rbp), %r13
movq %rsp, %rax
movq %r13, 0x30(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x67a0
movl -0xe8(%rbp), %esi
movsd %xmm0, -0xc8(%rbp)
movsd -0xc0(%rbp), %xmm0
movq 0x20(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm2
addsd %xmm1, %xmm0
movsd -0xc8(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd 0x10(%rax), %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x64(%rbp), %edi
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %r15
movq 0x48(%rbp), %r12
movq 0x50(%rbp), %r13
movq %rsp, %rax
movq %r13, 0x30(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x6c40
movl -0xe4(%rbp), %esi
movsd %xmm0, -0xd0(%rbp)
movl -0x64(%rbp), %edi
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r11
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %r15
movq 0x48(%rbp), %r12
movq 0x50(%rbp), %r13
movq %rsp, %rax
movq %r13, 0x30(%rax)
movq %r12, 0x28(%rax)
movq %r15, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x6c40
movsd %xmm0, -0xd8(%rbp)
movsd -0xd0(%rbp), %xmm0
movq 0x20(%rbp), %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm2
addsd %xmm1, %xmm0
movsd -0xd8(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd 0x10(%rax), %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x70(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movsd -0x80(%rbp), %xmm2
movsd -0x88(%rbp), %xmm3
movsd -0x90(%rbp), %xmm4
callq 0x5c30
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xe0(%rbp)
subl $0x4, %eax
ja 0x7958
movq -0xe0(%rbp), %rax
leaq 0xfae9(%rip), %rcx      # 0x17118
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x795a
movsd -0xa0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movsd -0xa8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x98(%rbp), %xmm0
jbe 0x76f0
movsd -0xa8(%rbp), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa0(%rbp), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x772e
movq 0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x795a
movsd -0xb0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movsd -0xb8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x98(%rbp), %xmm0
jbe 0x77a8
movsd -0xb8(%rbp), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xb0(%rbp), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x77e6
movq 0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x795a
movsd -0xc0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x98(%rbp), %xmm0
jbe 0x7860
movsd -0xc8(%rbp), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xc0(%rbp), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x789e
movq 0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x795a
movsd -0xd0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x98(%rbp), %xmm0
jbe 0x7918
movsd -0xd8(%rbp), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xd0(%rbp), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x7956
movq 0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x40(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x48(%rbp), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x795a
jmp 0x795a
jmp 0x795c
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x71c0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)