// File: /workspace/github_c_makefile_star2_O2/jiqingxiaoxi[P]RPA/RPA.c
// Function: thal
double thal(char oligo_f[],char oligo_r[],double stackEntropies[],double stackEnthalpies[],double stackint2Entropies[],double stackint2Enthalpies[],double dangleEntropies3[],double dangleEnthalpies3[],double dangleEntropies5[],double dangleEnthalpies5[],double hairpinLoopEntropies[],double interiorLoopEntropies[],double bulgeLoopEntropies[],double hairpinLoopEnthalpies[],double interiorLoopEnthalpies[],double bulgeLoopEnthalpies[],double tstackEntropies[],double tstackEnthalpies[],double tstack2Entropies[],double tstack2Enthalpies[],char *triloopEntropies1,char *triloopEnthalpies1,char *tetraloopEntropies1,char *tetraloopEnthalpies1,double *triloopEntropies2,double *triloopEnthalpies2,double *tetraloopEntropies2,double *tetraloopEnthalpies2,int numTriloops,int numTetraloops,double atpS[],double atpH[],int type)
{
	double SH[2],Initdouble[4];//0 is dplx_init_H, 1 is dplx_init_S, 2 is RC, 3 is SHleft
	int Initint[5]; //0 is len1, 1 is len2, 2 is len3, 3 is bestI, 4 is bestJ
	int i, j;
	double T1,enthalpyDPT[3600],entropyDPT[3600],send5[60],hend5[60],result_TH;
	int ps1[60],ps2[60];
	char numSeq1[60],numSeq2[60];
	double mh, ms;

/*** INIT values for unimolecular and bimolecular structures ***/
	if (type==4) /* unimolecular folding */
	{
		Initdouble[0]= 0.0;
		Initdouble[1] = -0.00000000001;
		Initdouble[2]=0;
	}
	else /* hybridization of two oligos */
	{
		Initdouble[0]= 200;
		Initdouble[1]= -5.7;
		if(symmetry_thermo(oligo_f) && symmetry_thermo(oligo_r))
			Initdouble[2]=1.9872* log(38/1000000000.0);
		else
			Initdouble[2]=1.9872* log(38/4000000000.0);
	}
/* convert nucleotides to numbers */
	if(type==1 || type==2)
	{
		Initint[0]=strlen(oligo_f);
		Initint[1]=strlen(oligo_r);
	 	for(i=1;i<=Initint[0];++i)
			numSeq1[i]=str2int(oligo_f[i-1]);
		for(i=1;i<=Initint[1];++i)
			numSeq2[i]=str2int(oligo_r[Initint[1]-i]);
	}
	else if(type==3)
	{
		Initint[0]=strlen(oligo_r);
		Initint[1]=strlen(oligo_f);
		for(i=1;i<=Initint[0];++i)
			numSeq1[i]=str2int(oligo_r[i-1]);
		for(i=1;i<=Initint[1];++i)
			numSeq2[i]=str2int(oligo_f[Initint[1]-i]);
	}
	else
	{
		Initint[0]=strlen(oligo_f);
                Initint[1]=strlen(oligo_r);
		Initint[2]=Initint[1]-1;
                for(i=1;i<=Initint[0];++i)      
                        numSeq1[i]=str2int(oligo_f[i-1]);   
                for(i=1;i<=Initint[1];++i)      
                        numSeq2[i]=str2int(oligo_r[i-1]);
	}
	numSeq1[0]=numSeq1[Initint[0]+1]=numSeq2[0]=numSeq2[Initint[1]+1]=4; /* mark as N-s */

	result_TH=0;
	if (type==4) /* calculate structure of monomer */
	{
		initMatrix2(Initint,enthalpyDPT,entropyDPT,numSeq1);
		fillMatrix2(stackEntropies,stackEnthalpies,stackint2Entropies,stackint2Enthalpies,hairpinLoopEntropies,interiorLoopEntropies,bulgeLoopEntropies,hairpinLoopEnthalpies,interiorLoopEnthalpies,bulgeLoopEnthalpies,tstackEntropies,tstackEnthalpies,tstack2Entropies,tstack2Enthalpies,triloopEntropies1,triloopEnthalpies1,tetraloopEntropies1,tetraloopEnthalpies1,triloopEntropies2,triloopEnthalpies2,tetraloopEntropies2,tetraloopEnthalpies2,numTriloops,numTetraloops,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,numSeq1,numSeq2);
		calc_terminal_bp(310.15,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1);
		mh=hend5[Initint[0]];
		ms=send5[Initint[0]];
		for (i=0;i<Initint[0];i++)
			ps1[i]=0;
		if(fabs(mh)<999999999)
		{
			tracebacku(ps1,stackEntropies,stackEnthalpies,stackint2Entropies,stackint2Enthalpies,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,hairpinLoopEntropies,interiorLoopEntropies,bulgeLoopEntropies,hairpinLoopEnthalpies,interiorLoopEnthalpies,bulgeLoopEnthalpies,tstackEntropies,tstackEnthalpies,tstack2Entropies,tstack2Enthalpies,triloopEntropies1,triloopEnthalpies1,tetraloopEntropies1,tetraloopEnthalpies1,triloopEntropies2,triloopEnthalpies2,tetraloopEntropies2,tetraloopEnthalpies2,numTriloops,numTetraloops,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,send5,hend5,numSeq1,numSeq2);
			result_TH=drawHairpin(ps1,mh,ms,Initint);
			result_TH=(int)(result_TH*100+0.5)/100.0;
		}
	}
	else if(type!=4) /* Hybridization of two moleculs */
	{
		Initint[2]=Initint[1];
		initMatrix(Initint,enthalpyDPT,entropyDPT,numSeq1,numSeq2);
		fillMatrix(stackEntropies,stackEnthalpies,stackint2Entropies,stackint2Enthalpies,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,interiorLoopEntropies,bulgeLoopEntropies,interiorLoopEnthalpies,bulgeLoopEnthalpies,tstackEntropies,tstackEnthalpies,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,numSeq1,numSeq2);

		Initdouble[3]=-1.0*INFINITY;
	/* calculate terminal basepairs */
		Initint[3]=Initint[4]=0;
		if(type==1)
			for (i=1;i<=Initint[0];i++)
			{
				for (j=1;j<=Initint[1];j++)
				{
					RSH(i,j,SH,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,numSeq1,numSeq2);
					SH[0]=SH[0]+0.000001; /* this adding is done for compiler, optimization -O2 vs -O0 */
					SH[1]=SH[1]+0.000001;
					T1=((enthalpyDPT[(i-1)*Initint[2]+j-1]+ SH[1] +Initdouble[0]) / ((entropyDPT[(i-1)*Initint[2]+j-1]) + SH[0] +Initdouble[1] + Initdouble[2])) -273.15;
					if(T1>Initdouble[3]&&((entropyDPT[(i-1)*Initint[2]+j-1]+SH[0])<0&&(SH[1]+enthalpyDPT[(i-1)*Initint[2]+j-1])<0))
					{
						Initdouble[3]=T1;
						Initint[3]=i;
						Initint[4]=j;
					}
				}
			}
		if(type==2||type==3)
		{
		 //THAL_END1
			Initint[4]=0;
			Initint[3]=Initint[0];
			i=Initint[0];
			Initdouble[3]=-1.0*INFINITY;
			for (j=1;j<=Initint[1];++j)
			{
				RSH(i,j,SH,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,numSeq1,numSeq2);
				SH[0]=SH[0]+0.000001; // this adding is done for compiler, optimization -O2 vs -O0,that compiler could understand that SH is changed in this cycle 
				SH[1]=SH[1]+0.000001;
				T1=((enthalpyDPT[(i-1)*Initint[2]+j-1]+SH[1]+Initdouble[0])/((entropyDPT[(i-1)*Initint[2]+j-1])+SH[0]+Initdouble[1]+Initdouble[2]))-273.15;
				if (T1>Initdouble[3]&&((SH[0]+entropyDPT[(i-1)*Initint[2]+j-1])<0&&(SH[1]+enthalpyDPT[(i-1)*Initint[2]+j-1])<0))
				{
					Initdouble[3]=T1;
					Initint[4]=j;
				}
			}
		}
		if(fabs(Initdouble[3])>999999999)
			Initint[3]=Initint[4]=1;
		RSH(Initint[3], Initint[4], SH,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,numSeq1,numSeq2);
	 // tracebacking 
		for (i=0;i<Initint[0];++i)
			ps1[i]=0;
		for (j=0;j<Initint[1];++j)
			ps2[j] = 0;
		if(fabs(enthalpyDPT[(Initint[3]-1)*Initint[2]+Initint[4]-1])<999999999)
		{
			traceback(Initint[3],Initint[4],ps1,ps2,stackEntropies,stackEnthalpies,stackint2Entropies,stackint2Enthalpies,dangleEntropies3,dangleEnthalpies3,dangleEntropies5,dangleEnthalpies5,interiorLoopEntropies,bulgeLoopEntropies,interiorLoopEnthalpies,bulgeLoopEnthalpies,tstackEntropies,tstackEnthalpies,tstack2Entropies,tstack2Enthalpies,atpS,atpH,Initdouble,Initint,enthalpyDPT,entropyDPT,numSeq1,numSeq2);
			result_TH=drawDimer(ps1,ps2,(enthalpyDPT[(Initint[3]-1)*Initint[2]+Initint[4]-1]+SH[1]+Initdouble[0]),(entropyDPT[(Initint[3]-1)*Initint[2]+Initint[4]-1]+SH[0]+Initdouble[1]),Initdouble,Initint);
			result_TH=(int)(result_TH*100+0.5)/100.0;
		}
	}
	return result_TH;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe708, %rsp           # imm = 0xE708
movq %r9, -0xa8(%rbp)
movq %r8, -0xa0(%rbp)
movq %rcx, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
movl 0xe0(%rbp), %r15d
cmpl $0x4, %r15d
jne 0x7e32
andq $0x0, -0xe0(%rbp)
movabsq $-0x425a02801e869b6b, %rax # imm = 0xBDA5FD7FE1796495
movq %rax, -0xd8(%rbp)
andq $0x0, -0xd0(%rbp)
movsd 0x5323(%rip), %xmm0     # 0xd0a8
movsd %xmm0, -0xc0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe8(%rbp)
movl $0x0, -0x60(%rbp)
movsd %xmm0, -0x88(%rbp)
movq %r14, %rdi
callq 0x10b0
movq %rax, %r15
movl %r15d, -0x80(%rbp)
movq %rbx, %rdi
callq 0x10b0
movl %eax, -0x7c(%rbp)
movq %rax, -0x30(%rbp)
decl %eax
movl %eax, -0x78(%rbp)
xorl %r12d, %r12d
testl %r15d, %r15d
movl $0x0, %r13d
movq %r15, -0x38(%rbp)
cmovgl %r15d, %r13d
cmpq %r12, %r13
je 0x7dfa
movsbl (%r14,%r12), %edi
callq 0x130c
movb %al, -0x13f(%rbp,%r12)
incq %r12
jmp 0x7dde
xorl %r14d, %r14d
movq -0x30(%rbp), %r15
testl %r15d, %r15d
movl $0x0, %r12d
cmovgl %r15d, %r12d
movq -0x38(%rbp), %r13
cmpq %r14, %r12
je 0x8031
movsbl (%rbx,%r14), %edi
callq 0x130c
movb %al, -0x17f(%rbp,%r14)
incq %r14
jmp 0x7e12
movabsq $0x4069000000000000, %rax # imm = 0x4069000000000000
movq %rax, -0xe0(%rbp)
movabsq $-0x3fe9333333333333, %rax # imm = 0xC016CCCCCCCCCCCD
movq %rax, -0xd8(%rbp)
movq %r14, %rdi
callq 0x7c20
testl %eax, %eax
je 0x7e76
movq %rbx, %rdi
callq 0x7c20
testl %eax, %eax
je 0x7e76
movsd 0x5214(%rip), %xmm0     # 0xd088
jmp 0x7e7e
movsd 0x5212(%rip), %xmm0     # 0xd090
movsd %xmm0, -0xd0(%rbp)
cmpl $0x1, %r15d
sete %cl
leal -0x1(%r15), %eax
cmpl $0x1, %eax
movsd %xmm0, -0xe8(%rbp)
ja 0x7eef
movl %ecx, -0x60(%rbp)
movq %r14, %rdi
callq 0x10b0
movq %rax, %r15
movl %r15d, -0x80(%rbp)
movq %rbx, %rdi
callq 0x10b0
movq %rax, -0x30(%rbp)
movl %eax, -0x7c(%rbp)
xorl %r12d, %r12d
testl %r15d, %r15d
movl $0x0, %r13d
movq %r15, -0x38(%rbp)
cmovgl %r15d, %r13d
cmpq %r12, %r13
je 0x7f47
movsbl (%r14,%r12), %edi
callq 0x130c
movb %al, -0x13f(%rbp,%r12)
incq %r12
jmp 0x7ed3
cmpl $0x3, %r15d
jne 0x7fa8
movq %rbx, %rdi
callq 0x10b0
movq %rax, %r13
movl %r13d, -0x80(%rbp)
movq %r14, %rdi
callq 0x10b0
movq %rax, -0x30(%rbp)
movl %eax, -0x7c(%rbp)
xorl %r15d, %r15d
testl %r13d, %r13d
movl $0x0, %r12d
cmovgl %r13d, %r12d
cmpq %r15, %r12
je 0x7fd0
movsbl (%rbx,%r15), %edi
callq 0x130c
movb %al, -0x13f(%rbp,%r15)
incq %r15
jmp 0x7f27
xorl %r14d, %r14d
movq -0x30(%rbp), %r15
testl %r15d, %r15d
movl $0x0, %r12d
cmovgl %r15d, %r12d
movslq %r15d, %rax
leaq -0x1(%rax,%rbx), %rbx
movsd 0x512d(%rip), %xmm0     # 0xd098
movsd %xmm0, -0x88(%rbp)
movsd 0x5125(%rip), %xmm0     # 0xd0a0
movsd %xmm0, -0xc0(%rbp)
movq -0x38(%rbp), %r13
cmpq %r14, %r12
je 0x8031
movsbl (%rbx), %edi
callq 0x130c
movb %al, -0x17f(%rbp,%r14)
incq %r14
decq %rbx
jmp 0x7f87
movl %ecx, -0x60(%rbp)
movsd 0x50e5(%rip), %xmm0     # 0xd098
movsd %xmm0, -0x88(%rbp)
movsd 0x50dd(%rip), %xmm0     # 0xd0a0
movsd %xmm0, -0xc0(%rbp)
jmp 0x7da7
xorl %ebx, %ebx
movq -0x30(%rbp), %rax
testl %eax, %eax
movl $0x0, %r15d
cmovgl %eax, %r15d
cltq
leaq -0x1(%rax,%r14), %r14
movsd 0x50a7(%rip), %xmm0     # 0xd098
movsd %xmm0, -0x88(%rbp)
movsd 0x509f(%rip), %xmm0     # 0xd0a0
movsd %xmm0, -0xc0(%rbp)
cmpq %rbx, %r15
je 0x8026
movsbl (%r14), %edi
callq 0x130c
movb %al, -0x17f(%rbp,%rbx)
incq %rbx
decq %r14
jmp 0x8009
movl $0x0, -0x60(%rbp)
movq -0x30(%rbp), %r15
movslq %r15d, %rax
movb $0x4, %dl
leaq -0x180(%rbp), %r8
movb %dl, 0x1(%rax,%r8)
movb %dl, -0x180(%rbp)
movslq %r13d, %r14
leaq -0x140(%rbp), %rcx
movb %dl, 0x1(%r14,%rcx)
movb %dl, -0x140(%rbp)
movl 0xe0(%rbp), %eax
cmpl $0x4, %eax
jne 0x81e0
leaq -0x80(%rbp), %rdi
leaq -0x76b0(%rbp), %rsi
leaq -0xe730(%rbp), %r12
movq %r12, %rdx
movq %r8, %rbx
movq %rcx, %r15
callq 0x2fc9
leaq -0xe0(%rbp), %r10
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
movq 0x30(%rbp), %r8
movq 0x38(%rbp), %r9
pushq %rbx
pushq %r15
pushq %r12
leaq -0x76b0(%rbp), %rax
pushq %rax
leaq -0x80(%rbp), %rax
pushq %rax
pushq %r10
movq 0xd8(%rbp), %rax
pushq %rax
movq 0xd0(%rbp), %r12
pushq %r12
movl 0xc8(%rbp), %eax
pushq %rax
movl 0xc0(%rbp), %eax
pushq %rax
pushq 0xb8(%rbp)
pushq 0xb0(%rbp)
pushq 0xa8(%rbp)
pushq 0xa0(%rbp)
pushq 0x98(%rbp)
pushq 0x90(%rbp)
pushq 0x88(%rbp)
pushq 0x80(%rbp)
movq 0x78(%rbp), %r15
pushq %r15
movq 0x70(%rbp), %rbx
pushq %rbx
pushq 0x68(%rbp)
pushq 0x60(%rbp)
pushq 0x58(%rbp)
pushq 0x50(%rbp)
pushq 0x48(%rbp)
pushq 0x40(%rbp)
callq 0x408e
addq $0xc8, %rsp
leaq -0x360(%rbp), %rax
leaq -0x630(%rbp), %r10
movsd 0x4f67(%rip), %xmm0     # 0xd0c0
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rcx
movq %rbx, %r8
movq %r15, %r9
leaq -0x140(%rbp), %r11
pushq %r11
pushq %rax
pushq %r10
leaq -0xe730(%rbp), %rax
pushq %rax
leaq -0xe0(%rbp), %r15
leaq -0x76b0(%rbp), %rax
pushq %rax
leaq -0x80(%rbp), %rax
movq %rax, %rbx
pushq %rax
pushq %r15
pushq 0xd8(%rbp)
pushq %r12
callq 0x4e04
addq $0x50, %rsp
movsd -0x360(%rbp,%r14,8), %xmm3
movsd -0x630(%rbp,%r14,8), %xmm4
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
cmpq %rax, %r13
je 0x8480
andl $0x0, -0x450(%rbp,%rax,4)
incq %rax
jmp 0x81ca
movq %r13, -0x38(%rbp)
leaq -0x80(%rbp), %rbx
movl %r15d, 0x8(%rbx)
leaq -0x76b0(%rbp), %r12
movq %r15, %r13
leaq -0xe730(%rbp), %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r8, %r14
callq 0x6572
leaq -0xe0(%rbp), %r10
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
pushq %r14
leaq -0x140(%rbp), %rax
pushq %rax
pushq %r15
pushq %r12
pushq %rbx
pushq %r10
movq %r10, %r12
pushq 0xd8(%rbp)
pushq 0xd0(%rbp)
pushq 0x78(%rbp)
movq 0x70(%rbp), %r14
pushq %r14
movq 0x68(%rbp), %rax
pushq %rax
movq 0x60(%rbp), %r15
pushq %r15
pushq 0x58(%rbp)
pushq 0x50(%rbp)
pushq 0x40(%rbp)
pushq 0x38(%rbp)
pushq 0x28(%rbp)
pushq 0x20(%rbp)
callq 0x7077
addq $0x90, %rsp
movabsq $-0x10000000000000, %rax # imm = 0xFFF0000000000000
movq %rax, 0x18(%r12)
andq $0x0, 0xc(%rbx)
cmpb $0x0, -0x60(%rbp)
movq 0x18(%rbp), %r12
movq %r13, -0x30(%rbp)
je 0x85b9
movq $0x0, -0xf8(%rbp)
testl %r13d, %r13d
movl $0x0, %ebx
cmovgl %r13d, %ebx
movq -0x38(%rbp), %rax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
incl %ecx
movl %ecx, -0xec(%rbp)
movl %r13d, %eax
movq %rax, -0x100(%rbp)
pushq $0x1
popq %r15
movsd 0x4d6c(%rip), %xmm0     # 0xd060
movapd %xmm0, -0x60(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq 0x20(%rbp), %r9
movq 0x28(%rbp), %r10
movq 0xd0(%rbp), %r11
movq 0xd8(%rbp), %rax
movq 0x10(%rbp), %rcx
cmpl -0xec(%rbp), %r15d
je 0x85fc
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x846a
movq %r12, %r14
incq %r12
movl %r15d, %edi
movl %r12d, %esi
leaq -0x360(%rbp), %rdx
movq 0x18(%rbp), %r8
leaq -0x180(%rbp), %r13
pushq %r13
leaq -0x140(%rbp), %r13
pushq %r13
leaq -0xe0(%rbp), %r13
pushq %r13
pushq %rax
pushq %r11
pushq 0x78(%rbp)
pushq 0x70(%rbp)
pushq %r10
callq 0x73ea
xorpd %xmm3, %xmm3
addq $0x40, %rsp
movsd -0x360(%rbp), %xmm0
movsd 0x4cc2(%rip), %xmm2     # 0xd058
addsd %xmm2, %xmm0
movsd %xmm0, -0x360(%rbp)
movsd -0x358(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, -0x358(%rbp)
addl -0xf8(%rbp), %r14d
movslq %r14d, %rax
addsd -0x76b0(%rbp,%rax,8), %xmm1
ucomisd %xmm1, %xmm3
addsd -0x88(%rbp), %xmm1
addsd -0xe730(%rbp,%rax,8), %xmm0
movapd %xmm0, %xmm2
addsd -0xc0(%rbp), %xmm2
addsd -0xe8(%rbp), %xmm2
divsd %xmm2, %xmm1
addsd 0x4c82(%rip), %xmm1     # 0xd080
jbe 0x844b
ucomisd %xmm0, %xmm3
jbe 0x844b
ucomisd -0x60(%rbp), %xmm1
movq 0x20(%rbp), %r9
movq 0x28(%rbp), %r10
movq 0xd0(%rbp), %r11
movq 0xd8(%rbp), %rax
movq 0x10(%rbp), %rcx
jbe 0x8333
movsd %xmm1, -0xc8(%rbp)
movapd %xmm1, -0x60(%rbp)
movl %r12d, %edx
movq %rdx, -0x40(%rbp)
movl %r15d, %edx
movq %rdx, -0x48(%rbp)
jmp 0x8333
movq 0x20(%rbp), %r9
movq 0x28(%rbp), %r10
movq 0xd0(%rbp), %r11
movq 0xd8(%rbp), %rax
movq 0x10(%rbp), %rcx
jmp 0x8333
incl %r15d
movq -0x100(%rbp), %rdx
addq %rdx, -0xf8(%rbp)
jmp 0x8323
movapd 0x4c58(%rip), %xmm1     # 0xd0e0
andpd %xmm3, %xmm1
xorpd %xmm0, %xmm0
movsd 0x4b98(%rip), %xmm2     # 0xd030
ucomisd %xmm1, %xmm2
movq 0x50(%rbp), %rax
movq 0x58(%rbp), %r10
jbe 0x89b4
subq $0x8, %rsp
leaq -0x450(%rbp), %r13
movq %r13, %rdi
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0xa0(%rbp), %rcx
movq -0xa8(%rbp), %r8
movq 0x10(%rbp), %r9
leaq -0x180(%rbp), %r11
pushq %r11
leaq -0x140(%rbp), %r11
pushq %r11
leaq -0x360(%rbp), %r11
pushq %r11
leaq -0x630(%rbp), %r11
pushq %r11
leaq -0xe730(%rbp), %r11
pushq %r11
leaq -0x76b0(%rbp), %r11
pushq %r11
pushq %rbx
pushq %r15
pushq 0xd8(%rbp)
pushq 0xd0(%rbp)
movl 0xc8(%rbp), %r11d
pushq %r11
movl 0xc0(%rbp), %r11d
pushq %r11
pushq 0xb8(%rbp)
pushq 0xb0(%rbp)
pushq 0xa8(%rbp)
pushq 0xa0(%rbp)
pushq 0x98(%rbp)
pushq 0x90(%rbp)
pushq 0x88(%rbp)
pushq 0x80(%rbp)
pushq 0x78(%rbp)
pushq 0x70(%rbp)
pushq 0x68(%rbp)
pushq 0x60(%rbp)
pushq %r10
pushq %rax
pushq 0x48(%rbp)
pushq 0x40(%rbp)
pushq 0x38(%rbp)
pushq 0x30(%rbp)
pushq 0x28(%rbp)
pushq 0x20(%rbp)
pushq 0x18(%rbp)
movapd %xmm3, -0xc0(%rbp)
movsd %xmm4, -0x60(%rbp)
callq 0x534c
addq $0x110, %rsp            # imm = 0x110
movq %r13, %rdi
movapd -0xc0(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movq %rbx, %rsi
callq 0x64f2
jmp 0x8994
movq %r15, %rsi
movq %r14, %r15
movsd 0x4a99(%rip), %xmm0     # 0xd060
movapd %xmm0, -0x60(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rbx
movq 0x20(%rbp), %r9
movq 0x28(%rbp), %r10
movq 0xd0(%rbp), %r11
movq 0xd8(%rbp), %rax
movq 0x10(%rbp), %rcx
jmp 0x861a
movq -0x48(%rbp), %rdx
movl %edx, -0x74(%rbp)
movq -0x40(%rbp), %rdx
movl %edx, -0x70(%rbp)
movq -0x38(%rbp), %rbx
movq 0x60(%rbp), %rsi
movq 0x70(%rbp), %r15
movq 0x18(%rbp), %r12
movl 0xe0(%rbp), %edx
andl $-0x2, %edx
cmpl $0x2, %edx
jne 0x87b7
movl %ebx, -0x74(%rbp)
movabsq $-0x10000000000000, %rdx # imm = 0xFFF0000000000000
movq %rdx, -0xc8(%rbp)
leal -0x1(%rbx), %r15d
movq -0x30(%rbp), %rdx
imull %edx, %r15d
xorl %r14d, %r14d
testl %edx, %edx
movl $0x0, %r12d
cmovgl %edx, %r12d
movsd 0x49fd(%rip), %xmm0     # 0xd060
movapd %xmm0, -0x60(%rbp)
movq $0x0, -0x40(%rbp)
cmpq %r14, %r12
je 0x879a
movq %r14, %r13
incq %r14
movq -0x38(%rbp), %rdi
movl %r14d, %esi
leaq -0x360(%rbp), %rdx
movq 0x18(%rbp), %r8
leaq -0x180(%rbp), %rbx
pushq %rbx
leaq -0x140(%rbp), %rbx
pushq %rbx
leaq -0xe0(%rbp), %rbx
pushq %rbx
pushq %rax
pushq %r11
pushq 0x78(%rbp)
pushq 0x70(%rbp)
pushq %r10
callq 0x73ea
xorpd %xmm3, %xmm3
addq $0x40, %rsp
movsd -0x360(%rbp), %xmm0
movsd 0x4987(%rip), %xmm2     # 0xd058
addsd %xmm2, %xmm0
movsd %xmm0, -0x360(%rbp)
movsd -0x358(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, -0x358(%rbp)
addl %r15d, %r13d
movslq %r13d, %rax
addsd -0x76b0(%rbp,%rax,8), %xmm1
ucomisd %xmm1, %xmm3
addsd -0x88(%rbp), %xmm1
addsd -0xe730(%rbp,%rax,8), %xmm0
movapd %xmm0, %xmm2
addsd -0xc0(%rbp), %xmm2
addsd -0xe8(%rbp), %xmm2
divsd %xmm2, %xmm1
addsd 0x494b(%rip), %xmm1     # 0xd080
jbe 0x877b
ucomisd %xmm0, %xmm3
jbe 0x877b
ucomisd -0x60(%rbp), %xmm1
movq 0x20(%rbp), %r9
movq 0x28(%rbp), %r10
movq 0xd0(%rbp), %r11
movq 0xd8(%rbp), %rax
movq 0x10(%rbp), %rcx
jbe 0x8670
movsd %xmm1, -0xc8(%rbp)
movl %r14d, %edx
movq %rdx, -0x40(%rbp)
movapd %xmm1, -0x60(%rbp)
jmp 0x8670
movq 0x20(%rbp), %r9
movq 0x28(%rbp), %r10
movq 0xd0(%rbp), %r11
movq 0xd8(%rbp), %rax
movq 0x10(%rbp), %rcx
jmp 0x8670
movq -0x40(%rbp), %rdx
movl %edx, -0x70(%rbp)
movq -0x38(%rbp), %rbx
movl %ebx, %edx
movq %rdx, -0x48(%rbp)
movq 0x60(%rbp), %rsi
movq 0x70(%rbp), %r15
movq 0x18(%rbp), %r12
movq %rsi, %r13
movapd -0x60(%rbp), %xmm0
andpd 0x4919(%rip), %xmm0     # 0xd0e0
ucomisd 0x4861(%rip), %xmm0     # 0xd030
jbe 0x87f1
pushq $0x1
popq %rdx
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, -0x74(%rbp)
movq 0xd8(%rbp), %rax
movq %rdx, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
leaq -0x360(%rbp), %rdx
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r12, %r8
leaq -0x180(%rbp), %r14
pushq %r14
leaq -0x140(%rbp), %r14
pushq %r14
leaq -0xe0(%rbp), %r14
pushq %r14
pushq %rax
pushq %r11
pushq 0x78(%rbp)
pushq %r15
pushq %r10
callq 0x73ea
addq $0x40, %rsp
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
movq 0x58(%rbp), %r11
cmpq %rax, %rbx
je 0x884e
andl $0x0, -0x450(%rbp,%rax,4)
incq %rax
jmp 0x883c
xorl %eax, %eax
movq -0x30(%rbp), %rdx
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
movq %r13, %rdx
movq 0x68(%rbp), %r13
cmpq %rax, %rcx
je 0x8877
andl $0x0, -0x630(%rbp,%rax,4)
incq %rax
jmp 0x8865
movq -0x48(%rbp), %rdi
leal -0x1(%rdi), %eax
imull -0x30(%rbp), %eax
movq -0x40(%rbp), %rsi
addl %esi, %eax
decl %eax
movslq %eax, %rbx
movsd -0x76b0(%rbp,%rbx,8), %xmm1
andpd 0x4842(%rip), %xmm1     # 0xd0e0
xorpd %xmm0, %xmm0
movsd 0x4786(%rip), %xmm2     # 0xd030
ucomisd %xmm1, %xmm2
jbe 0x89b4
movq %r12, %r10
movq %rdx, %r12
leaq -0x450(%rbp), %rdx
leaq -0x630(%rbp), %rcx
movq -0x90(%rbp), %r8
movq -0x98(%rbp), %r9
leaq -0x180(%rbp), %rax
pushq %rax
leaq -0x140(%rbp), %rax
pushq %rax
leaq -0xe730(%rbp), %rax
pushq %rax
leaq -0x76b0(%rbp), %rax
pushq %rax
leaq -0x80(%rbp), %r14
pushq %r14
leaq -0xe0(%rbp), %r14
pushq %r14
pushq 0xd8(%rbp)
pushq 0xd0(%rbp)
pushq 0x78(%rbp)
pushq %r15
pushq %r13
pushq %r12
pushq %r11
pushq 0x50(%rbp)
pushq 0x40(%rbp)
pushq 0x38(%rbp)
pushq 0x28(%rbp)
pushq 0x20(%rbp)
pushq %r10
pushq 0x10(%rbp)
pushq -0xa8(%rbp)
pushq -0xa0(%rbp)
callq 0x77fb
addq $0xb0, %rsp
movsd -0x76b0(%rbp,%rbx,8), %xmm0
addsd -0x358(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd -0xe730(%rbp,%rbx,8), %xmm1
addsd -0x360(%rbp), %xmm1
addsd -0xc0(%rbp), %xmm1
leaq -0x450(%rbp), %rdi
leaq -0x630(%rbp), %rsi
movq %r14, %rdx
leaq -0x80(%rbp), %rcx
callq 0x7b88
movsd 0x4714(%rip), %xmm1     # 0xd0b0
mulsd %xmm1, %xmm0
addsd 0x4710(%rip), %xmm0     # 0xd0b8
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
divsd %xmm1, %xmm0
addq $0xe708, %rsp           # imm = 0xE708
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq