// File: /workspace/github_c_makefile_star2_O1/genevalab[P]msmove/streec.c
// Function: segtre_mig
struct segl *segtre_mig(struct c_params *cp, int *pnsegs, int *migflag) 
{
	int i, j, k, dec, pop, pop2, c1, c2, ind, rchrom;
	int migrant, source_pop, *config, flagint;
	int eflag, cpop, ic, nsam, npop, nsites, *inconfig;
	double sum, x, ttemp, rft, clefta, tmin, p;
	double prec, cin, prect, mig, ran, coal_prob, rdum, arg;
	double r, f, rf, track_len, **migm;
	double *size, *alphag, *tlast;
	char ev;
	struct devent *nextevent;
	
	nsam = cp->nsam;
	npop = cp->npop;
	nsites = cp->nsites;
	inconfig = cp->config;
	r = cp->r;
	f = cp->f;
	track_len = cp->track_len;
	migm = (double**)malloc((size_t)npop*sizeof(double*));
	for (i=0; i < npop; i++)
	{
		migm[i] = (double*)malloc((size_t)npop*sizeof(double));
		for (j=0; j < npop; j++)
			migm[i][j] = (cp->mig_mat)[i][j];
	}
	nextevent = cp->deventlist;
	
	if (chrom == NULL)
	{
		maxchr = nsam+20;
		chrom = (struct chromo*)malloc((size_t)maxchr*sizeof(struct chromo));
		if (chrom == NULL)
			perror("malloc error. segtre");
	}
	if (nnodes == NULL)
	{
		nnodes = (int*)malloc((size_t)seglimit*sizeof(int));
		if (nnodes == NULL)
			perror("malloc error. segtre_mig");
	}
	if (seglst == NULL)
	{
		seglst = (struct segl*)malloc((size_t)seglimit*sizeof(struct segl));
		if (seglst == NULL)
			perror("malloc error. segtre_mig.c 2");
	}
	config = (int*)malloc((size_t)(npop+1)*sizeof(int));
	if (config == NULL)
		perror("malloc error. segtre.");
	size = (double*)malloc((size_t)npop*sizeof(double));
	if (size == NULL)
		perror("malloc error. segtre.");
	alphag = (double*)malloc((size_t)npop*sizeof(double));
	if (alphag == NULL)
		perror("malloc error. segtre.");
	tlast = (double*)malloc((size_t)npop*sizeof(double));
	if (tlast == NULL)
		perror("malloc error. segtre.");
	for (pop=0; pop < npop; pop++)
	{
		config[pop] = inconfig[pop];
		size[pop] = (cp->size)[pop];
		alphag[pop] = (cp->alphag)[pop];
		tlast[pop] = 0;
	}
	for (pop=ind=0; pop < npop; pop++)
		for (j=0; j < inconfig[pop]; j++, ind++)
		{
			chrom[ind].nseg = 1;
			if (!(chrom[ind].pseg = (struct seg*)malloc(sizeof(struct seg))))
				perror("calloc error. se1");
			(chrom[ind].pseg)->beg = 0;
			(chrom[ind].pseg)->end = nsites-1;
			(chrom[ind].pseg)->desc = ind;
			chrom[ind].pop = pop;
		}
	seglst[0].beg = 0;
	if (!(seglst[0].ptree = (struct node*)calloc((size_t)(2*nsam), sizeof(struct node))))
		perror("calloc error. se2");
	nnodes[0] = nsam-1;
	nchrom = nsam;
	nlinks = (long int)(nsam*(nsites-1));
	nsegs = 1;
	t = 0;
	r /= nsites-1;
	if (f > 0)
		pc = (track_len-1.0)/track_len;
	else
		pc = 1.0;
	lnpc = log(pc);
	cleft = nsam * (1.0-pow(pc, (double)(nsites-1)));
	if (r > 0)
		rf = r*f;
	else
		rf = f/(nsites-1);
	rft = rf*track_len;
	flagint = 0;

	while (nchrom > 1)
	{
		prec = nlinks*r;
		cin = nlinks*rf;
		clefta = cleft*rft;
		prect = prec+cin+clefta;
		mig = 0;
		for (i=0; i < npop; i++)
			mig += config[i]*migm[i][i];
		if ((npop > 1) && (mig == 0) && (nextevent == 0))
		{
			i = 0;
			for (j=0; j < npop; j++) 
				if (config[j] > 0)
					i++;
			if (i > 1)
			{
				fprintf(stderr, " Infinite coalescent time. No migration.\n");
				exit(EXIT_FAILURE);
		   }
		}
		eflag = 0;
		if (prect > 0)
		{
			while ((rdum = genrand_real3()) == 0);
			ttemp = -1.0*log(rdum)/prect;
			if ((eflag == 0) || (ttemp < tmin))
			{
				tmin = ttemp;
				ev = 'r';
				eflag = 1;
			}
		}
		if (mig > 0)
		{
			while ((rdum = genrand_real3()) == 0);
			ttemp = -1.0*log(rdum)/mig;
			if ((eflag == 0) || (ttemp < tmin))
			{
				tmin = ttemp;
				ev = 'm';
				eflag = 1;
			}
		}
		for (pop=0; pop < npop; pop++)
		{
			coal_prob = (double)config[pop]*(config[pop]-1);
			if (coal_prob > 0)
			{
				while ((rdum = genrand_real3()) == 0);
				if (alphag[pop] == 0)
				{
					ttemp = -1.0*log(rdum)*size[pop]/coal_prob;
					if ((eflag == 0) || (ttemp < tmin))
					{
						tmin = ttemp;
						ev = 'c';
						eflag = 1;
						cpop = pop;
					}
				}
				else
				{
					arg = 1.0-alphag[pop]*size[pop]*exp(-1.0*alphag[pop]*(t-tlast[pop]))*log(rdum)/coal_prob;
					if (arg > 0)
					{
						ttemp = log(arg)/alphag[pop];
						if ((eflag == 0) || (ttemp < tmin))
						{
							tmin = ttemp;
							ev = 'c';
							eflag = 1;
							cpop = pop;
						}
					}
				}
			}
		}
		if ((eflag == 0) && (nextevent == 0))
		{
			fprintf(stderr, " Infinite time to next event. Negative growth rate in last time interval or non-communicating subpops.\n");
			exit(EXIT_FAILURE);
		}
		if (((eflag == 0) && (nextevent != 0)) || ((nextevent != 0) && ((t+tmin) >= nextevent->time)))
		{
			t = nextevent->time;
			switch (nextevent->detype)
			{
				case 'N' :
					for (pop=0; pop < npop; pop++)
					{
						size[pop]= nextevent->paramv;
						alphag[pop] = 0;
					}
					nextevent = nextevent->nextde;
					break;
				case 'n' :
					size[nextevent->popi] = nextevent->paramv;
					alphag[nextevent->popi] = 0;
					nextevent = nextevent->nextde;
					break;
				case 'G' :
					for (pop=0; pop < npop; pop++)
					{
						size[pop] = size[pop]*exp(-1.0*alphag[pop]*(t-tlast[pop]));
						alphag[pop]= nextevent->paramv;
						tlast[pop] = t;
					}
					nextevent = nextevent->nextde;
					break;
				case 'g' :
					pop = nextevent->popi;
					size[pop] = size[pop]*exp(-1.0*alphag[pop]*(t-tlast[pop]));
					alphag[pop]= nextevent->paramv;
					tlast[pop] = t;
					nextevent = nextevent->nextde;
					break;
				case 'M' :
					for (pop=0; pop < npop; pop++)
						for (pop2=0; pop2 < npop; pop2++)
							migm[pop][pop2] = (nextevent->paramv)/(npop-1.0);
					for (pop = 0; pop < npop; pop++)
						migm[pop][pop] = nextevent->paramv;
					nextevent = nextevent->nextde;
					break;
				case 'a' :
					for (pop=0; pop < npop; pop++)
						for (pop2=0; pop2 < npop; pop2++)
							migm[pop][pop2] = (nextevent->mat)[pop][pop2];
					nextevent = nextevent->nextde;
					break;
				case 'm' :
					i = nextevent->popi;
					j = nextevent->popj;
					migm[i][i] += nextevent->paramv - migm[i][j];
					migm[i][j]= nextevent->paramv;
					nextevent = nextevent->nextde;
					break;
				case 'j' :
					i = nextevent->popi;
					j = nextevent->popj;
					config[j] += config[i];
					config[i] = 0;
					for (ic=0; ic < nchrom; ic++)
						if (chrom[ic].pop == i)
							chrom[ic].pop = j;
					for (k=0; k < npop; k++)
					{
						if (k != i)
						{
							migm[k][k] -= migm[k][i];
							migm[k][i] = 0;
						}
					}
					nextevent = nextevent->nextde;
					break;
				case 'v' :
					i = nextevent->popi;
					j = nextevent->popj;
					/* start new code here-- old code below */
					config[i] = 0;
					for (ic=0; ic < nchrom; ic++)
					{
						if (chrom[ic].pop == i)
						{
							if (genrand_real3() > nextevent->pmove)
								config[i]++;
							else
							{
								chrom[ic].pop = j;
								config[j]++;
								*migflag = 1;
							}
						}
					}
					nextevent = nextevent->nextde;
					break;
				case 's' :
					i = nextevent->popi;
					p = nextevent->paramv;
					npop++;
					config = (int*)realloc(config, (size_t)npop*sizeof(int));
					size = (double*)realloc(size, (size_t)npop*sizeof(double));
					alphag = (double*)realloc(alphag, (size_t)npop*sizeof(double));
					tlast = (double*)realloc(tlast, (size_t)npop*sizeof(double));
					tlast[npop-1] = t;
					size[npop-1] = 1.0;
					alphag[npop-1] = 0;
					migm = (double**)realloc(migm, (size_t)npop*sizeof(double*));
					for (j=0; j < npop-1; j++)
						migm[j] = (double*)realloc(migm[j], (size_t)npop*sizeof(double));
					migm[npop-1] = (double*)malloc((size_t)npop * sizeof(double));
					for (j=0; j < npop; j++)
						migm[npop-1][j] = migm[j][npop-1] = 0;
					config[npop-1] = 0;
					config[i] = 0;
					for (ic=0; ic < nchrom; ic++)
					{
						if (chrom[ic].pop == i)
						{
							if (genrand_real3() < p)
								config[i]++;
							else
							{
								chrom[ic].pop = npop-1;
								config[npop-1]++;
							}
						}
					}
					nextevent = nextevent->nextde;
					break;
			}
		}
		else
		{
			t += tmin;
			if (ev == 'r')
			{
				if ((ran = genrand_real3()) < prec/prect)
				{
					rchrom = re(nsam);
					config[chrom[rchrom].pop] += 1;
				}
				else if (ran < (prec+clefta)/prect)
				{
					rchrom = cleftr(nsam);
					config[chrom[rchrom].pop] += 1;
				}
				else
				{
					rchrom = cinr(nsam, nsites);
					if (rchrom >= 0)
						config[chrom[rchrom].pop] += 1;
				}
			}
			else if (ev == 'm')
			{
				x = mig*genrand_real3();
				sum = 0;
				for (i=0; i < nchrom; i++)
				{
					sum += migm[chrom[i].pop][chrom[i].pop];
					if (x < sum)
						break;
				}
				migrant = i;
				x = genrand_real3()*migm[chrom[i].pop][chrom[i].pop];
				sum = 0;
				for (i=0; i < npop; i++)
				{
					if (i != chrom[migrant].pop)
					{
						sum += migm[chrom[migrant].pop][i];
						if (x < sum)
							break;
					}
				}
				source_pop = i;
				config[chrom[migrant].pop] -= 1;
				config[source_pop] += 1;
				chrom[migrant].pop = source_pop;
			}
			else
			{
				pick2_chrom(cpop, config, &c1, &c2);
				dec = ca(nsam, nsites, c1, c2);
				config[cpop] -= dec;
			}
		}
	}  
	*pnsegs = nsegs;
	free(config); 
	free(size);
	free(alphag);
	free(tlast);
	for (i=0; i < npop; i++)
		free(migm[i]);
	free(migm);
	return seglst;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, -0xe0(%rbp)
movq %rsi, -0xd8(%rbp)
movl 0x4(%rdi), %eax
movq %rax, -0x80(%rbp)
movslq (%rdi), %r12
movl 0x20(%rdi), %eax
movq %rax, -0x98(%rbp)
movq 0x8(%rdi), %rax
movq %rax, -0x60(%rbp)
movsd 0x18(%rdi), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd 0x28(%rdi), %xmm0
movaps %xmm0, -0xb0(%rbp)
movq %rdi, -0x40(%rbp)
movsd 0x30(%rdi), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq (,%r12,8), %r13
movq %r13, %rdi
callq 0x1120
movq %rax, %r15
testq %r12, %r12
jle 0x45cc
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rbx
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x1120
movq %rax, (%r15,%r14,8)
movq (%rbx,%r14,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %r12
jne 0x45b2
incq %r14
cmpq %r12, %r14
jne 0x45a0
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rbx
cmpq $0x0, 0x6f54(%rip)      # 0xb530
jne 0x4604
movq -0x80(%rbp), %rax
leal 0x14(%rax), %edi
movl %edi, 0x6f4d(%rip)      # 0xb538
shlq $0x4, %rdi
callq 0x1120
movq %rax, 0x6f35(%rip)      # 0xb530
testq %rax, %rax
je 0x55b8
cmpq $0x0, 0x6f34(%rip)      # 0xb540
jne 0x462d
movl 0x5aec(%rip), %edi      # 0xa100
shlq $0x2, %rdi
callq 0x1120
movq %rax, 0x6f1c(%rip)      # 0xb540
testq %rax, %rax
je 0x55c9
cmpq $0x0, 0x6f13(%rip)      # 0xb548
jne 0x465a
movl 0x5ac3(%rip), %eax      # 0xa100
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdi
callq 0x1120
movq %rax, 0x6ef7(%rip)      # 0xb548
testq %rax, %rax
je 0x55da
leaq 0x4(,%r12,4), %rdi
callq 0x1120
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x5563
movq %r13, %rdi
callq 0x1120
movq %rax, %r14
testq %rax, %rax
je 0x5574
movq %r13, %rdi
callq 0x1120
movq %rax, -0x78(%rbp)
testq %rax, %rax
je 0x5585
movq %rbx, -0x88(%rbp)
movq %r15, -0x48(%rbp)
movq %r13, %rdi
callq 0x1120
movq %rax, %rbx
testq %rax, %rax
je 0x5596
testl %r12d, %r12d
jle 0x4711
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rcx
movq %rcx, -0x70(%rbp)
movq 0x40(%rax), %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x1040
leaq (,%r12,4), %rdx
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1080
movq %r14, %rdi
movq -0x70(%rbp), %rsi
movq %r13, %rdx
callq 0x1080
movq -0x78(%rbp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x1080
movq %rbx, -0x68(%rbp)
movq %r14, -0x70(%rbp)
movslq -0x80(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq %r12, -0x50(%rbp)
testl %r12d, %r12d
movq -0x78(%rbp), %r14
jle 0x47db
movq -0x98(%rbp), %rax
decl %eax
movl %eax, -0x40(%rbp)
xorl %r13d, %r13d
xorl %r15d, %r15d
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax,%r13,4)
jle 0x47ce
movslq %r15d, %r14
shlq $0x4, %r14
orq $0x8, %r14
xorl %r12d, %r12d
movq 0x6dc9(%rip), %rbx      # 0xb530
movl $0x1, -0x8(%rbx,%r14)
movl $0xc, %edi
callq 0x1120
movq %rax, (%rbx,%r14)
testq %rax, %rax
je 0x47b9
movq 0x6da6(%rip), %rax      # 0xb530
movq (%rax,%r14), %rcx
movl $0x0, (%rcx)
movl -0x40(%rbp), %edx
movl %edx, 0x4(%rcx)
leal (%r15,%r12), %edx
movl %edx, 0x8(%rcx)
movl %r13d, -0x4(%rax,%r14)
incl %r12d
addq $0x10, %r14
movq -0x60(%rbp), %rax
cmpl (%rax,%r13,4), %r12d
jl 0x4760
jmp 0x47c7
leaq 0x35d1(%rip), %rdi      # 0x7d91
callq 0x1090
jmp 0x4783
addl %r12d, %r15d
movq -0x78(%rbp), %r14
incq %r13
cmpq -0x50(%rbp), %r13
jne 0x4747
movq 0x6d66(%rip), %rbx      # 0xb548
movl $0x0, (%rbx)
movq -0xa0(%rbp), %rdi
addq %rdi, %rdi
movl $0x10, %esi
callq 0x1050
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x55a7
movq -0x80(%rbp), %rbx
leal -0x1(%rbx), %eax
movq 0x6d29(%rip), %rcx      # 0xb540
movl %eax, (%rcx)
movl %ebx, 0x6d31(%rip)      # 0xb550
movq -0x98(%rbp), %rax
decl %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
imull %ebx, %eax
cltq
movq %rax, 0x6d1b(%rip)      # 0xb558
movl $0x1, 0x6d19(%rip)      # 0xb560
movq $0x0, 0x6d16(%rip) # 0xb568
movsd 0x27ce(%rip), %xmm1     # 0x7028
movsd -0x38(%rbp), %xmm0
addsd %xmm0, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
cmpltsd -0xb0(%rbp), %xmm0
andpd %xmm0, %xmm1
movsd 0x2788(%rip), %xmm2     # 0x7008
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movlpd %xmm0, 0x6ce0(%rip)     # 0xb570
callq 0x1070
movsd %xmm0, 0x6cdb(%rip)     # 0xb578
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x6cbf(%rip), %xmm0     # 0xb570
movsd -0x60(%rbp), %xmm1
callq 0x1190
movsd 0x2745(%rip), %xmm1     # 0x7008
subsd %xmm0, %xmm1
mulsd -0x40(%rbp), %xmm1
movsd %xmm1, 0x6cac(%rip)     # 0xb580
cmpl $0x2, 0x6c75(%rip)      # 0xb550
movq -0x48(%rbp), %rbx
movq -0x50(%rbp), %r9
movq -0x88(%rbp), %r13
movq -0x68(%rbp), %r15
jl 0x54e8
movsd -0xb8(%rbp), %xmm1
movsd -0x60(%rbp), %xmm2
divsd %xmm2, %xmm1
movapd %xmm1, %xmm0
movapd -0xb0(%rbp), %xmm3
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm3
xorpd %xmm2, %xmm2
movsd %xmm1, -0xb8(%rbp)
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm0
andnpd %xmm3, %xmm2
orpd %xmm0, %xmm2
movapd %xmm2, -0x100(%rbp)
movsd -0x38(%rbp), %xmm0
mulsd %xmm2, %xmm0
movapd 0x2701(%rip), %xmm4     # 0x7050
movapd %xmm0, %xmm2
movsd %xmm0, -0x38(%rbp)
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movl %r9d, %r12d
xorpd %xmm1, %xmm1
testl %r9d, %r9d
jle 0x498c
xorl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sdl (%r8,%rax,4), %xmm0
movq (%rbx,%rax,8), %rcx
mulsd (%rcx,%rax,8), %xmm0
addsd %xmm0, %xmm1
incq %rax
cmpq %rax, %r12
jne 0x496e
xorps %xmm0, %xmm0
cvtsi2sdq 0x6bc0(%rip), %xmm0 # 0xb558
movsd 0x6be0(%rip), %xmm6     # 0xb580
mulsd %xmm2, %xmm6
movsd %xmm6, -0xd0(%rbp)
cmpl $0x2, %r9d
jl 0x49e0
ucomisd %xmm3, %xmm1
jne 0x49e0
jp 0x49e0
testq %r13, %r13
jne 0x49e0
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
cmpl $0x0, (%r8,%rax,4)
setg %dl
addl %edx, %ecx
incq %rax
cmpq %rax, %r12
jne 0x49c3
cmpl $0x2, %ecx
jae 0x55f0
movq %rbx, -0x48(%rbp)
movsd -0xb8(%rbp), %xmm6
mulsd %xmm0, %xmm6
mulsd -0x100(%rbp), %xmm0
movsd %xmm6, -0xe8(%rbp)
addsd %xmm6, %xmm0
addsd -0xd0(%rbp), %xmm0
xorl %ebx, %ebx
movsd %xmm0, -0x90(%rbp)
ucomisd %xmm3, %xmm0
movq %r8, -0x30(%rbp)
movsd %xmm1, -0xc0(%rbp)
jbe 0x4a8b
movq %r14, -0x78(%rbp)
movq %r15, %r14
movq %r9, %r15
callq 0x449a
ucomisd 0x25d1(%rip), %xmm0     # 0x7010
jne 0x4a43
jnp 0x4a32
callq 0x1070
movapd %xmm0, %xmm5
movapd 0x25fc(%rip), %xmm4     # 0x7050
xorpd %xmm4, %xmm5
divsd -0x90(%rbp), %xmm5
movb $0x72, -0xb0(%rbp)
movl $0x1, %ebx
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movq %r15, %r9
movq %r14, %r15
movq -0x78(%rbp), %r14
movsd -0xc0(%rbp), %xmm1
ucomisd %xmm3, %xmm1
jbe 0x4af3
movq %r15, -0x68(%rbp)
movq %r9, %r15
movapd %xmm5, -0x60(%rbp)
callq 0x449a
ucomisd 0x2566(%rip), %xmm0     # 0x7010
jne 0x4aae
jnp 0x4a9d
callq 0x1070
movsd -0x90(%rbp), %xmm1
ucomisd 0x254d(%rip), %xmm1     # 0x7010
movapd 0x2585(%rip), %xmm4     # 0x7050
xorpd %xmm4, %xmm0
divsd -0xc0(%rbp), %xmm0
movl $0x1, %ebx
xorpd %xmm3, %xmm3
movapd -0x60(%rbp), %xmm1
jbe 0x4af9
ucomisd %xmm0, %xmm1
ja 0x4af9
movapd %xmm1, %xmm0
jmp 0x4b00
movapd %xmm5, %xmm0
jmp 0x4b10
movb $0x6d, -0xb0(%rbp)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
movq %r15, %r9
movq -0x68(%rbp), %r15
movq %r13, -0x88(%rbp)
movq %r9, -0x50(%rbp)
testl %r9d, %r9d
jle 0x4cbe
xorl %r13d, %r13d
movl (%r8,%r13,4), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
decl %eax
xorps %xmm5, %xmm5
cvtsi2sd %eax, %xmm5
mulsd %xmm1, %xmm5
ucomisd %xmm3, %xmm5
jbe 0x4bb7
movsd %xmm5, -0x40(%rbp)
movapd %xmm0, -0x60(%rbp)
callq 0x449a
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jne 0x4b60
jnp 0x4b4f
movsd (%r14,%r13,8), %xmm1
ucomisd %xmm2, %xmm1
jne 0x4bc0
jp 0x4bc0
callq 0x1070
movapd %xmm0, %xmm5
movapd 0x24d1(%rip), %xmm4     # 0x7050
xorpd %xmm4, %xmm5
movq -0x70(%rbp), %rax
mulsd (%rax,%r13,8), %xmm5
divsd -0x40(%rbp), %xmm5
testl %ebx, %ebx
movl $0x1, %ebx
movapd -0x60(%rbp), %xmm0
je 0x4c5c
ucomisd %xmm5, %xmm0
ja 0x4c5c
movapd %xmm0, %xmm5
jmp 0x4c6a
movapd %xmm0, %xmm5
jmp 0x4cac
movq -0x70(%rbp), %rax
movsd (%rax,%r13,8), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, -0x68(%rbp)
xorpd 0x2475(%rip), %xmm1     # 0x7050
movsd %xmm0, -0x78(%rbp)
movsd 0x6980(%rip), %xmm0     # 0xb568
subsd (%r15,%r13,8), %xmm0
mulsd %xmm1, %xmm0
callq 0x11a0
mulsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x78(%rbp), %xmm0
callq 0x1070
movapd %xmm0, %xmm1
mulsd -0x68(%rbp), %xmm1
divsd -0x40(%rbp), %xmm1
movsd 0x23e7(%rip), %xmm0     # 0x7008
subsd %xmm1, %xmm0
ucomisd 0x23e3(%rip), %xmm0     # 0x7010
xorpd %xmm3, %xmm3
jbe 0x4c79
callq 0x1070
movapd %xmm0, %xmm5
divsd (%r14,%r13,8), %xmm5
testl %ebx, %ebx
movl $0x1, %ebx
movapd -0x60(%rbp), %xmm0
je 0x4c89
ucomisd %xmm5, %xmm0
ja 0x4c89
movapd %xmm0, %xmm5
jmp 0x4c97
movb $0x63, -0xb0(%rbp)
movl %r13d, -0xa0(%rbp)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
jmp 0x4cac
movapd -0x60(%rbp), %xmm5
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
jmp 0x4ca4
movb $0x63, -0xb0(%rbp)
movl %r13d, -0xa0(%rbp)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movapd 0x23a4(%rip), %xmm4     # 0x7050
incq %r13
movapd %xmm5, %xmm0
cmpq %r12, %r13
jne 0x4b27
jmp 0x4cc2
movapd %xmm0, %xmm5
testl %ebx, %ebx
movq -0x88(%rbp), %r13
jne 0x4cd6
testq %r13, %r13
je 0x55eb
testl %ebx, %ebx
movq -0x50(%rbp), %r9
movapd %xmm5, -0x60(%rbp)
jne 0x4cec
testq %r13, %r13
jne 0x4d6f
testq %r13, %r13
je 0x4d05
movsd 0x686f(%rip), %xmm0     # 0xb568
addsd %xmm5, %xmm0
ucomisd (%r13), %xmm0
jae 0x4d6f
movsd 0x685b(%rip), %xmm0     # 0xb568
addsd %xmm5, %xmm0
movsd %xmm0, 0x684f(%rip)     # 0xb568
movb -0xb0(%rbp), %al
cmpb $0x6d, %al
movq -0x48(%rbp), %rbx
je 0x4fb8
movq %r9, %r12
movzbl %al, %eax
cmpl $0x72, %eax
jne 0x500f
callq 0x449a
movsd -0xe8(%rbp), %xmm3
movapd %xmm3, %xmm1
movsd -0x90(%rbp), %xmm2
divsd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x51f8
movq -0x80(%rbp), %rdi
callq 0x55f5
jmp 0x5217
movsd (%r13), %xmm0
movsd %xmm0, 0x67eb(%rip)     # 0xb568
movzbl 0x28(%r13), %eax
cmpl $0x66, %eax
movq -0x48(%rbp), %rbx
jle 0x4e2f
leal -0x67(%rax), %ecx
cmpl $0x7, %ecx
ja 0x4ea8
leaq 0x2f6e(%rip), %rdx      # 0x7d10
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movslq 0x8(%r13), %rbx
movq %r15, %r12
movq %r14, %r15
movq -0x70(%rbp), %r14
movsd (%r14,%rbx,8), %xmm1
movsd %xmm1, -0x40(%rbp)
movsd (%r15,%rbx,8), %xmm1
xorpd %xmm4, %xmm1
subsd (%r12,%rbx,8), %xmm0
mulsd %xmm1, %xmm0
callq 0x11a0
movq -0x50(%rbp), %r9
movapd -0x60(%rbp), %xmm5
movapd 0x2262(%rip), %xmm4     # 0x7050
xorpd %xmm3, %xmm3
movq -0x30(%rbp), %r8
movsd -0x38(%rbp), %xmm2
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r14,%rbx,8)
movq %r15, %r14
movq %r12, %r15
movsd 0x18(%r13), %xmm0
movsd %xmm0, (%r14,%rbx,8)
movsd 0x6748(%rip), %xmm0     # 0xb568
movsd %xmm0, (%r12,%rbx,8)
movq -0x48(%rbp), %rbx
jmp 0x51ef
cmpl $0x4d, %eax
jg 0x4f6e
cmpl $0x47, %eax
je 0x512f
cmpl $0x4d, %eax
jne 0x54a9
testl %r9d, %r9d
jle 0x4e81
leal -0x1(%r9), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorl %eax, %eax
movq (%rbx,%rax,8), %rcx
xorl %edx, %edx
movsd 0x18(%r13), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %r12
jne 0x4e62
incq %rax
cmpq %r12, %rax
jne 0x4e5c
testl %r9d, %r9d
jle 0x51ef
xorl %eax, %eax
movsd 0x18(%r13), %xmm0
movq (%rbx,%rax,8), %rcx
movsd %xmm0, (%rcx,%rax,8)
incq %rax
cmpq %rax, %r12
jne 0x4e8c
jmp 0x51ef
cmpl $0x73, %eax
je 0x524f
cmpl $0x76, %eax
jne 0x54a9
movq %r15, -0x68(%rbp)
movslq 0x8(%r13), %rbx
movl 0xc(%r13), %eax
movl $0x0, (%r8,%rbx,4)
cmpl $0x0, 0x667b(%rip)      # 0xb550
jle 0x4f56
movslq %eax, %r13
movl $0x4, %r15d
xorl %r12d, %r12d
movq 0x6646(%rip), %rax      # 0xb530
cmpl %ebx, (%rax,%r15)
jne 0x4f43
callq 0x449a
movq -0x88(%rbp), %rax
ucomisd 0x10(%rax), %xmm0
jbe 0x4f0d
movq -0x30(%rbp), %r8
incl (%r8,%rbx,4)
jmp 0x4f2d
movq 0x661c(%rip), %rax      # 0xb530
movl %r13d, (%rax,%r15)
movq -0x30(%rbp), %r8
incl (%r8,%r13,4)
movq -0xe0(%rbp), %rax
movl $0x1, (%rax)
movsd -0x38(%rbp), %xmm2
xorpd %xmm3, %xmm3
movapd 0x2112(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
incq %r12
movslq 0x6603(%rip), %rax      # 0xb550
addq $0x10, %r15
cmpq %rax, %r12
jl 0x4ee3
movq -0x88(%rbp), %rax
movq 0x30(%rax), %r13
movq -0x48(%rbp), %rbx
movq -0x50(%rbp), %r9
jmp 0x5401
cmpl $0x4e, %eax
je 0x51c9
cmpl $0x61, %eax
jne 0x54a9
testl %r9d, %r9d
jle 0x51ef
movq 0x20(%r13), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq (%rbx,%rcx,8), %rsi
xorl %edi, %edi
movsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %r12
jne 0x4f99
incq %rcx
cmpq %r12, %rcx
jne 0x4f8f
jmp 0x51ef
callq 0x449a
movl 0x658d(%rip), %eax      # 0xb550
testl %eax, %eax
jle 0x540a
movsd -0xc0(%rbp), %xmm1
mulsd %xmm0, %xmm1
movq 0x6552(%rip), %rdx      # 0xb530
addq $0x4, %rdx
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movslq (%rdx), %rsi
movq (%rbx,%rsi,8), %rdi
addsd (%rdi,%rsi,8), %xmm0
ucomisd %xmm1, %xmm0
ja 0x5008
incq %rcx
addq $0x10, %rdx
cmpq %rcx, %rax
jne 0x4fe8
movl %eax, %ecx
movl %ecx, %ebx
jmp 0x540c
movl -0xa0(%rbp), %ebx
movl %ebx, %edi
movq %r8, %rsi
leaq -0xc8(%rbp), %rdx
leaq -0xc4(%rbp), %rcx
callq 0x58f8
movl -0xc8(%rbp), %edx
movl -0xc4(%rbp), %ecx
movq -0x80(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x59b8
movq -0x30(%rbp), %r8
movslq %ebx, %rcx
movq -0x48(%rbp), %rbx
subl %eax, (%r8,%rcx,4)
jmp 0x5231
movslq 0x8(%r13), %rax
movslq 0xc(%r13), %rcx
movsd 0x18(%r13), %xmm0
movq (%rbx,%rax,8), %rdx
subsd (%rdx,%rcx,8), %xmm0
addsd (%rdx,%rax,8), %xmm0
movsd %xmm0, (%rdx,%rax,8)
movsd 0x18(%r13), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
jmp 0x51ef
movslq 0x8(%r13), %rax
movslq 0xc(%r13), %rcx
movl (%r8,%rax,4), %edx
addl %edx, (%r8,%rcx,4)
movl $0x0, (%r8,%rax,4)
cmpl $0x0, 0x64a3(%rip)      # 0xb550
jle 0x50d5
movq 0x647a(%rip), %rdx      # 0xb530
addq $0x4, %rdx
xorl %esi, %esi
cmpl %eax, (%rdx)
jne 0x50c2
movl %ecx, (%rdx)
incq %rsi
movslq 0x6484(%rip), %rdi      # 0xb550
addq $0x10, %rdx
cmpq %rdi, %rsi
jl 0x50bc
testl %r9d, %r9d
jle 0x51ef
movl %eax, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x5102
movq (%rbx,%rdx,8), %rsi
movsd (%rsi,%rdx,8), %xmm0
subsd (%rsi,%rax,8), %xmm0
movsd %xmm0, (%rsi,%rdx,8)
movq $0x0, (%rsi,%rax,8)
incq %rdx
cmpq %rdx, %r12
jne 0x50e2
jmp 0x51ef
movsd 0x18(%r13), %xmm0
movslq 0x8(%r13), %rax
movq -0x70(%rbp), %rcx
movsd %xmm0, (%rcx,%rax,8)
movq $0x0, (%r14,%rax,8)
jmp 0x51ef
testl %r9d, %r9d
movq -0x70(%rbp), %rdx
jle 0x51a6
xorl %ebx, %ebx
movsd (%rdx,%rbx,8), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd (%r14,%rbx,8), %xmm1
xorpd %xmm4, %xmm1
movsd 0x6412(%rip), %xmm0     # 0xb568
subsd (%r15,%rbx,8), %xmm0
mulsd %xmm1, %xmm0
movq %rdx, %r13
callq 0x11a0
movq %r13, %rdx
movq -0x88(%rbp), %r13
movapd 0x1ed6(%rip), %xmm4     # 0x7050
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rdx,%rbx,8)
movsd 0x18(%r13), %xmm0
movsd %xmm0, (%r14,%rbx,8)
movsd 0x63d0(%rip), %xmm0     # 0xb568
movsd %xmm0, (%r15,%rbx,8)
incq %rbx
cmpq %rbx, %r12
jne 0x513a
movq 0x30(%r13), %r13
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movq -0x48(%rbp), %rbx
movapd -0x60(%rbp), %xmm5
movq -0x50(%rbp), %r9
jmp 0x54a9
testl %r9d, %r9d
movq -0x70(%rbp), %rcx
jle 0x51ef
xorl %eax, %eax
movsd 0x18(%r13), %xmm0
movsd %xmm0, (%rcx,%rax,8)
movq $0x0, (%r14,%rax,8)
incq %rax
cmpq %rax, %r12
jne 0x51d4
movq 0x30(%r13), %r13
jmp 0x54a9
addsd -0xd0(%rbp), %xmm3
divsd %xmm2, %xmm3
ucomisd %xmm0, %xmm3
jbe 0x54b8
movq -0x80(%rbp), %rdi
callq 0x5671
movq 0x6312(%rip), %rcx      # 0xb530
cltq
shlq $0x4, %rax
movslq 0x4(%rcx,%rax), %rax
movq -0x30(%rbp), %r8
incl (%r8,%rax,4)
movsd -0x38(%rbp), %xmm2
xorpd %xmm3, %xmm3
movapd 0x1e0e(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
movq %r12, %r9
jmp 0x54a9
movslq 0x8(%r13), %rax
movq %rax, -0x90(%rbp)
movsd 0x18(%r13), %xmm0
movsd %xmm0, -0x40(%rbp)
movslq %r9d, %r13
leaq 0x4(,%r13,4), %rsi
movq %r8, %rdi
callq 0x1170
movq %rax, -0x30(%rbp)
leaq 0x8(,%r13,8), %rbx
movq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x1170
movq %rax, -0x70(%rbp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1170
movq %rax, %r14
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1170
movsd 0x62b3(%rip), %xmm0     # 0xb568
movq %rax, -0x68(%rbp)
movsd %xmm0, (%rax,%r13,8)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq -0x70(%rbp), %rcx
movq %rax, (%rcx,%r13,8)
movq %r14, -0x78(%rbp)
movq $0x0, (%r14,%r13,8)
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x1170
movq %rax, %r15
cmpl $0x0, -0x50(%rbp)
jle 0x530d
xorl %r14d, %r14d
movq (%r15,%r14,8), %rdi
movq %rbx, %rsi
callq 0x1170
movq %rax, (%r15,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x52f5
movq %rbx, %rdi
callq 0x1120
movq %rax, (%r15,%r13,8)
cmpl $0x0, -0x50(%rbp)
movl $0x0, %edi
js 0x5340
movq -0x50(%rbp), %rcx
incl %ecx
xorl %edx, %edx
movq (%r15,%rdx,8), %rsi
movq %rdi, (%rsi,%r13,8)
movq %rdi, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x532c
movq %r15, -0x48(%rbp)
movq -0x30(%rbp), %r8
movl %edi, (%r8,%r13,4)
movq -0x90(%rbp), %rbx
movl %edi, (%r8,%rbx,4)
cmpl %edi, 0x61f3(%rip)      # 0xb550
movsd -0x38(%rbp), %xmm2
xorpd %xmm3, %xmm3
movapd 0x1ce2(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
jle 0x53e7
leaq (%r8,%r13,4), %r14
leaq (%r8,%rbx,4), %r15
movl $0x4, %r12d
xorl %r13d, %r13d
movq 0x61a3(%rip), %rax      # 0xb530
cmpl %ebx, (%rax,%r12)
jne 0x53d4
callq 0x449a
movsd -0x40(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movq %r15, %rax
ja 0x53b8
movq 0x6183(%rip), %rax      # 0xb530
movq -0x50(%rbp), %rcx
movl %ecx, (%rax,%r12)
movq %r14, %rax
incl (%rax)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movapd 0x1c81(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
incq %r13
movslq 0x6172(%rip), %rax      # 0xb550
addq $0x10, %r12
cmpq %rax, %r13
jl 0x5386
movq -0x50(%rbp), %r9
incl %r9d
movq -0x88(%rbp), %r13
movq 0x30(%r13), %r13
movq -0x48(%rbp), %rbx
movq -0x78(%rbp), %r14
movq -0x68(%rbp), %r15
jmp 0x54a9
xorl %ebx, %ebx
callq 0x449a
movq 0x6118(%rip), %rax      # 0xb530
shlq $0x4, %rbx
movslq 0x4(%rax,%rbx), %rcx
movq -0x50(%rbp), %r9
testl %r9d, %r9d
jle 0x5476
movq -0x48(%rbp), %rdx
movq (%rdx,%rcx,8), %rsi
mulsd (%rsi,%rcx,8), %xmm0
movl %ecx, %edi
xorpd %xmm1, %xmm1
xorl %edx, %edx
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movapd 0x1bfc(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
cmpq %rdx, %rdi
je 0x5469
addsd (%rsi,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x5492
incq %rdx
cmpq %rdx, %r12
jne 0x5459
movl %r12d, %edx
jmp 0x5492
xorl %edx, %edx
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
xorpd %xmm3, %xmm3
movapd 0x1bc3(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
addq %rbx, %rax
addq $0x4, %rax
decl (%r8,%rcx,4)
movl %edx, %ecx
incl (%r8,%rcx,4)
movl %edx, (%rax)
movq -0x48(%rbp), %rbx
cmpl $0x1, 0x60a0(%rip)      # 0xb550
jg 0x4960
jmp 0x54ec
movq -0x80(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x57d2
testl %eax, %eax
js 0x54da
movq 0x605d(%rip), %rcx      # 0xb530
movl %eax, %eax
jmp 0x5220
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r8
jmp 0x5236
movq -0x30(%rbp), %r8
movl 0x606e(%rip), %eax      # 0xb560
movq -0xd8(%rbp), %rcx
movl %eax, (%rcx)
movq %r8, %rdi
movq %r15, %r12
movq %r9, %r15
callq 0x10e0
movq -0x70(%rbp), %rdi
callq 0x10e0
movq %r14, %rdi
callq 0x10e0
movq %r12, %rdi
callq 0x10e0
movq %r15, %rax
testl %eax, %eax
movq %rbx, %r15
jle 0x5542
movl %eax, %ebx
xorl %r14d, %r14d
movq (%r15,%r14,8), %rdi
callq 0x10e0
incq %r14
cmpq %r14, %rbx
jne 0x5531
movq %r15, %rdi
callq 0x10e0
movq 0x5ff7(%rip), %rax      # 0xb548
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2811(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x4674
leaq 0x2800(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x4688
leaq 0x27ef(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x469d
leaq 0x27de(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x46bc
leaq 0x27f5(%rip), %rdi      # 0x7da3
callq 0x1090
jmp 0x4809
leaq 0x2771(%rip), %rdi      # 0x7d30
callq 0x1090
jmp 0x4604
leaq 0x2775(%rip), %rdi      # 0x7d45
callq 0x1090
jmp 0x462d
leaq 0x277d(%rip), %rdi      # 0x7d5e
callq 0x1090
jmp 0x465a
callq 0x1512
callq 0x153a