// File: /workspace/github_c_makefile_star2_O3/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 $0xf8, %rsp
movq %rdx, -0x100(%rbp)
movq %rsi, -0xf8(%rbp)
movl 0x4(%rdi), %eax
movq %rax, -0x98(%rbp)
movslq (%rdi), %r13
movl 0x20(%rdi), %eax
movq %rax, -0xb0(%rbp)
movq 0x8(%rdi), %rax
movq %rax, -0x60(%rbp)
movsd 0x18(%rdi), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd 0x28(%rdi), %xmm0
movaps %xmm0, -0xd0(%rbp)
movq %rdi, -0x48(%rbp)
movsd 0x30(%rdi), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq (,%r13,8), %r12
movq %r12, %rdi
callq 0x1120
movq %rax, %r15
testq %r13, %r13
jle 0x4637
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rbx
xorl %r14d, %r14d
movq %r12, %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, %r13
jne 0x461d
incq %r14
cmpq %r13, %r14
jne 0x460b
movq %r12, -0x90(%rbp)
movq -0x48(%rbp), %rax
movq 0x48(%rax), %r12
cmpq $0x0, 0x6ee2(%rip)      # 0xb530
jne 0x4679
movq -0x98(%rbp), %rax
leal 0x14(%rax), %edi
movl %edi, 0x6ed8(%rip)      # 0xb538
shlq $0x4, %rdi
callq 0x1120
movq %rax, 0x6ec0(%rip)      # 0xb530
testq %rax, %rax
je 0x567b
cmpq $0x0, 0x6ebf(%rip)      # 0xb540
jne 0x46a2
movl 0x5a77(%rip), %edi      # 0xa100
shlq $0x2, %rdi
callq 0x1120
movq %rax, 0x6ea7(%rip)      # 0xb540
testq %rax, %rax
je 0x568c
cmpq $0x0, 0x6e9e(%rip)      # 0xb548
jne 0x46cf
movl 0x5a4e(%rip), %eax      # 0xa100
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdi
callq 0x1120
movq %rax, 0x6e82(%rip)      # 0xb548
testq %rax, %rax
je 0x569d
leaq 0x4(,%r13,4), %rdi
callq 0x1120
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x561f
movq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0x1120
movq %rax, %rbx
testq %rax, %rax
je 0x5630
movq %r14, %rdi
callq 0x1120
movq %rax, -0x78(%rbp)
testq %rax, %rax
je 0x5641
movq %rbx, -0x68(%rbp)
movq %r15, -0x70(%rbp)
movq %r14, %rdi
callq 0x1120
testq %rax, %rax
movq %rax, -0x88(%rbp)
je 0x5652
movslq -0x98(%rbp), %rcx
movq %rcx, -0xb8(%rbp)
testl %r13d, %r13d
jle 0x4865
movq -0x48(%rbp), %rcx
movq 0x38(%rcx), %rdx
movq %rdx, -0x80(%rbp)
movq 0x40(%rcx), %r15
xorl %ebx, %ebx
movq %rax, %rdi
xorl %esi, %esi
movq -0x90(%rbp), %r14
movq %r14, %rdx
callq 0x1040
leaq (,%r13,4), %rdx
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1080
movq -0x68(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq %r14, %rdx
callq 0x1080
movq -0x78(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1080
movq -0xb0(%rbp), %rax
decl %eax
movl %eax, -0x48(%rbp)
xorl %r15d, %r15d
movq %r13, -0xa0(%rbp)
movq %r12, -0xa8(%rbp)
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x4859
movslq %r15d, %r14
movq 0x6d51(%rip), %r13      # 0xb530
shlq $0x4, %r14
xorl %r12d, %r12d
movl $0x1, (%r13,%r14)
movl $0xc, %edi
callq 0x1120
movq %rax, 0x8(%r13,%r14)
testq %rax, %rax
je 0x482e
movl $0x0, (%rax)
movl -0x48(%rbp), %ecx
movl %ecx, 0x4(%rax)
leal (%r15,%r12), %ecx
movl %ecx, 0x8(%rax)
movl %ebx, 0x4(%r13,%r14)
incl %r12d
addq $0x10, %r14
movq -0x60(%rbp), %rax
cmpl (%rax,%rbx,4), %r12d
jl 0x47e6
jmp 0x4848
leaq 0x355c(%rip), %rdi      # 0x7d91
callq 0x1090
movq 0x6cef(%rip), %r13      # 0xb530
movq 0x8(%r13,%r14), %rax
jmp 0x4803
addl %r12d, %r15d
movq -0xa0(%rbp), %r13
movq -0xa8(%rbp), %r12
incq %rbx
cmpq %r13, %rbx
jne 0x47c7
movq 0x6cdc(%rip), %rbx      # 0xb548
movl $0x0, (%rbx)
movq -0xb8(%rbp), %rdi
addq %rdi, %rdi
movl $0x10, %esi
callq 0x1050
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x566a
movq -0x98(%rbp), %rbx
leal -0x1(%rbx), %eax
movq 0x6c9c(%rip), %rcx      # 0xb540
movl %eax, (%rcx)
movl %ebx, 0x6ca4(%rip)      # 0xb550
movq -0xb0(%rbp), %rax
decl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
imull %ebx, %eax
cltq
movq %rax, 0x6c8b(%rip)      # 0xb558
movl $0x1, 0x6c89(%rip)      # 0xb560
movq $0x0, 0x6c86(%rip) # 0xb568
movsd 0x273e(%rip), %xmm1     # 0x7028
movsd -0x38(%rbp), %xmm0
addsd %xmm0, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
cmpltsd -0xd0(%rbp), %xmm0
andpd %xmm0, %xmm1
movsd 0x26f8(%rip), %xmm2     # 0x7008
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movlpd %xmm0, 0x6c50(%rip)     # 0xb570
callq 0x1070
movsd %xmm0, 0x6c4b(%rip)     # 0xb578
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x6c2f(%rip), %xmm0     # 0xb570
movsd -0x60(%rbp), %xmm1
callq 0x1190
movsd 0x26b5(%rip), %xmm1     # 0x7008
subsd %xmm0, %xmm1
mulsd -0x48(%rbp), %xmm1
movsd %xmm1, 0x6c1c(%rip)     # 0xb580
cmpl $0x2, 0x6be5(%rip)      # 0xb550
movq -0x70(%rbp), %r14
movq -0x78(%rbp), %r15
jl 0x55a7
movsd -0xd8(%rbp), %xmm1
movsd -0x60(%rbp), %xmm2
divsd %xmm2, %xmm1
movapd %xmm1, %xmm0
movapd -0xd0(%rbp), %xmm3
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm3
xorpd %xmm2, %xmm2
movsd %xmm1, -0xd8(%rbp)
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm0
andnpd %xmm3, %xmm2
orpd %xmm0, %xmm2
movapd %xmm2, -0x120(%rbp)
movsd -0x38(%rbp), %xmm0
mulsd %xmm2, %xmm0
movapd 0x267c(%rip), %xmm4     # 0x7050
movapd %xmm0, %xmm2
movsd %xmm0, -0x38(%rbp)
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
xorps %xmm6, %xmm6
cvtsi2sdq 0x6b67(%rip), %xmm6 # 0xb558
movl %r13d, %ebx
movsd 0x6b84(%rip), %xmm0     # 0xb580
mulsd %xmm2, %xmm0
movsd %xmm0, -0xf0(%rbp)
testl %r13d, %r13d
movq %r14, -0x70(%rbp)
jle 0x4a76
xorpd %xmm1, %xmm1
xorl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sdl (%r9,%rax,4), %xmm0
movq (%r14,%rax,8), %rcx
mulsd (%rcx,%rax,8), %xmm0
addsd %xmm0, %xmm1
incq %rax
cmpq %rax, %rbx
jne 0x4a17
testq %r12, %r12
sete %al
cmpl $0x1, %r13d
movb %al, -0x39(%rbp)
je 0x4a86
ucomisd %xmm3, %xmm1
jne 0x4a86
jp 0x4a86
testq %r12, %r12
jne 0x4a86
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
cmpl $0x0, (%r9,%rax,4)
setg %dl
addl %edx, %ecx
incq %rax
cmpq %rax, %rbx
jne 0x4a55
movq %r12, %r14
cmpl $0x2, %ecx
jb 0x4a89
jmp 0x56b3
movq %r12, %r14
testq %r12, %r12
sete -0x39(%rbp)
xorpd %xmm1, %xmm1
jmp 0x4a89
movq %r12, %r14
movsd -0xd8(%rbp), %xmm0
mulsd %xmm6, %xmm0
mulsd -0x120(%rbp), %xmm6
movsd %xmm0, -0x108(%rbp)
addsd %xmm0, %xmm6
addsd -0xf0(%rbp), %xmm6
xorl %r12d, %r12d
movsd %xmm6, -0x80(%rbp)
ucomisd %xmm3, %xmm6
movq %r9, -0x30(%rbp)
movsd %xmm1, -0xe0(%rbp)
jbe 0x4b18
callq 0x4503
ucomisd 0x2538(%rip), %xmm0     # 0x7010
jne 0x4adc
jnp 0x4acb
callq 0x1070
movapd %xmm0, %xmm5
movapd 0x2563(%rip), %xmm4     # 0x7050
xorpd %xmm4, %xmm5
divsd -0x80(%rbp), %xmm5
movb $0x72, -0xd0(%rbp)
movl $0x1, %r12d
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
movsd -0xe0(%rbp), %xmm1
ucomisd %xmm3, %xmm1
jbe 0x4b77
movapd %xmm5, -0x60(%rbp)
callq 0x4503
ucomisd 0x24e0(%rip), %xmm0     # 0x7010
jne 0x4b34
jnp 0x4b23
callq 0x1070
movsd -0x80(%rbp), %xmm1
ucomisd 0x24ca(%rip), %xmm1     # 0x7010
movapd 0x2502(%rip), %xmm4     # 0x7050
xorpd %xmm4, %xmm0
divsd -0xe0(%rbp), %xmm0
movl $0x1, %r12d
xorpd %xmm3, %xmm3
movapd -0x60(%rbp), %xmm1
jbe 0x4b7d
ucomisd %xmm0, %xmm1
ja 0x4b7d
movapd %xmm1, %xmm0
jmp 0x4b84
movapd %xmm5, %xmm0
jmp 0x4b8d
movb $0x6d, -0xd0(%rbp)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
movq %r13, -0xa0(%rbp)
testl %r13d, %r13d
jle 0x4d54
xorl %r13d, %r13d
movl (%r9,%r13,4), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
decl %eax
xorps %xmm5, %xmm5
cvtsi2sd %eax, %xmm5
mulsd %xmm1, %xmm5
ucomisd %xmm3, %xmm5
jbe 0x4c32
movsd %xmm5, -0x48(%rbp)
movapd %xmm0, -0x60(%rbp)
callq 0x4503
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jne 0x4bd9
jnp 0x4bc8
movsd (%r15,%r13,8), %xmm1
ucomisd %xmm2, %xmm1
jne 0x4c3b
jp 0x4c3b
callq 0x1070
movapd %xmm0, %xmm5
movapd 0x2458(%rip), %xmm4     # 0x7050
xorpd %xmm4, %xmm5
movq -0x68(%rbp), %rax
mulsd (%rax,%r13,8), %xmm5
divsd -0x48(%rbp), %xmm5
testl %r12d, %r12d
movl $0x1, %r12d
movapd -0x60(%rbp), %xmm0
je 0x4cf2
ucomisd %xmm5, %xmm0
ja 0x4cf2
movapd %xmm0, %xmm5
jmp 0x4d00
movapd %xmm0, %xmm5
jmp 0x4d42
movq -0x68(%rbp), %rax
movsd (%rax,%r13,8), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, -0x90(%rbp)
xorpd 0x23f7(%rip), %xmm1     # 0x7050
movsd %xmm0, -0xa8(%rbp)
movsd 0x68ff(%rip), %xmm0     # 0xb568
movq -0x88(%rbp), %rax
subsd (%rax,%r13,8), %xmm0
mulsd %xmm1, %xmm0
callq 0x11a0
mulsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x1070
movapd %xmm0, %xmm1
mulsd -0x90(%rbp), %xmm1
divsd -0x48(%rbp), %xmm1
movsd 0x2353(%rip), %xmm0     # 0x7008
subsd %xmm1, %xmm0
ucomisd 0x234f(%rip), %xmm0     # 0x7010
xorpd %xmm3, %xmm3
jbe 0x4d0f
callq 0x1070
movapd %xmm0, %xmm5
divsd (%r15,%r13,8), %xmm5
testl %r12d, %r12d
movl $0x1, %r12d
movapd -0x60(%rbp), %xmm0
je 0x4d1f
ucomisd %xmm5, %xmm0
ja 0x4d1f
movapd %xmm0, %xmm5
jmp 0x4d2d
movb $0x63, -0xd0(%rbp)
movl %r13d, -0xb8(%rbp)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
jmp 0x4d42
movapd -0x60(%rbp), %xmm5
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
jmp 0x4d3a
movb $0x63, -0xd0(%rbp)
movl %r13d, -0xb8(%rbp)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
movapd 0x230e(%rip), %xmm4     # 0x7050
incq %r13
movapd %xmm5, %xmm0
cmpq %rbx, %r13
jne 0x4ba0
jmp 0x4d58
movapd %xmm0, %xmm5
testl %r12d, %r12d
sete %al
andb -0x39(%rbp), %al
cmpb $0x1, %al
je 0x56ae
testl %r12d, %r12d
movq -0xa0(%rbp), %r13
movq %r14, %r12
movapd %xmm5, -0x60(%rbp)
jne 0x4d8e
testq %r12, %r12
je 0x4d8e
movsd (%r12), %xmm0
movq -0x70(%rbp), %r14
jmp 0x4e06
movsd 0x67d2(%rip), %xmm1     # 0xb568
addsd %xmm5, %xmm1
testq %r12, %r12
movq -0x70(%rbp), %r14
je 0x4daf
movsd (%r12), %xmm0
ucomisd %xmm0, %xmm1
jae 0x4e06
movsd %xmm1, 0x67b1(%rip)     # 0xb568
movb -0xd0(%rbp), %al
cmpb $0x6d, %al
je 0x5047
movzbl %al, %eax
cmpl $0x72, %eax
jne 0x50a3
callq 0x4503
movsd -0x108(%rbp), %xmm3
movapd %xmm3, %xmm1
movsd -0x80(%rbp), %xmm2
divsd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x52a1
movq -0x98(%rbp), %rdi
callq 0x56b8
jmp 0x52c3
movsd %xmm0, 0x675a(%rip)     # 0xb568
movzbl 0x28(%r12), %eax
cmpl $0x66, %eax
jle 0x4eb8
leal -0x67(%rax), %ecx
cmpl $0x7, %ecx
ja 0x4f37
leaq 0x2ee0(%rip), %rdx      # 0x7d10
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movslq 0x8(%r12), %rbx
movq -0x68(%rbp), %rax
movsd (%rax,%rbx,8), %xmm1
movsd %xmm1, -0x48(%rbp)
movsd (%r15,%rbx,8), %xmm1
xorpd %xmm4, %xmm1
movq -0x88(%rbp), %r14
subsd (%r14,%rbx,8), %xmm0
mulsd %xmm1, %xmm0
callq 0x11a0
movapd -0x60(%rbp), %xmm5
movapd 0x21d7(%rip), %xmm4     # 0x7050
xorpd %xmm3, %xmm3
movq -0x30(%rbp), %r9
movsd -0x38(%rbp), %xmm2
mulsd -0x48(%rbp), %xmm0
movq -0x68(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
movsd 0x18(%r12), %xmm0
movsd %xmm0, (%r15,%rbx,8)
movsd 0x66bf(%rip), %xmm0     # 0xb568
movsd %xmm0, (%r14,%rbx,8)
movq -0x70(%rbp), %r14
jmp 0x5297
cmpl $0x4d, %eax
jg 0x4ffc
cmpl $0x47, %eax
je 0x51cd
cmpl $0x4d, %eax
jne 0x555f
testl %r13d, %r13d
jle 0x5297
leal -0x1(%r13), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorl %eax, %eax
movq (%r14,%rax,8), %rcx
xorl %edx, %edx
movsd 0x18(%r12), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rbx
jne 0x4eef
incq %rax
cmpq %rbx, %rax
jne 0x4ee9
testl %r13d, %r13d
jle 0x5297
movsd 0x18(%r12), %xmm0
xorl %eax, %eax
movq (%r14,%rax,8), %rcx
movsd %xmm0, (%rcx,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x4f21
jmp 0x5297
cmpl $0x73, %eax
je 0x52f8
cmpl $0x76, %eax
jne 0x5593
movq %r15, -0x78(%rbp)
movslq 0x8(%r12), %rbx
movq %r12, %r14
movl 0xc(%r12), %eax
movl $0x0, (%r9,%rbx,4)
cmpl $0x0, 0x65e7(%rip)      # 0xb550
jle 0x4fef
cltq
movq %rax, -0x48(%rbp)
movl $0x4, %r15d
movq 0x65ae(%rip), %rax      # 0xb530
xorl %r12d, %r12d
cmpl %ebx, (%rax,%r15)
jne 0x4fdc
callq 0x4503
ucomisd 0x10(%r14), %xmm0
movq 0x6593(%rip), %rax      # 0xb530
jbe 0x4fa9
movq -0x30(%rbp), %r9
incl (%r9,%rbx,4)
jmp 0x4fc6
movq -0x48(%rbp), %rcx
movl %ecx, (%rax,%r15)
movq -0x30(%rbp), %r9
incl (%r9,%rcx,4)
movq -0x100(%rbp), %rcx
movl $0x1, (%rcx)
movsd -0x38(%rbp), %xmm2
xorpd %xmm3, %xmm3
movapd 0x2079(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
incq %r12
movslq 0x656a(%rip), %rcx      # 0xb550
addq $0x10, %r15
cmpq %rcx, %r12
jl 0x4f85
movq 0x30(%r14), %r12
movq -0x70(%rbp), %r14
jmp 0x555b
cmpl $0x4e, %eax
je 0x5270
cmpl $0x61, %eax
jne 0x555f
testl %r13d, %r13d
jle 0x5297
movq 0x20(%r12), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq (%r14,%rcx,8), %rsi
xorl %edi, %edi
movsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %rbx
jne 0x5028
incq %rcx
cmpq %rbx, %rcx
jne 0x501e
jmp 0x5297
callq 0x4503
movl 0x64fe(%rip), %eax      # 0xb550
testl %eax, %eax
movq %r15, -0x78(%rbp)
jle 0x54c8
movsd -0xe0(%rbp), %xmm1
mulsd %xmm0, %xmm1
movq 0x64bf(%rip), %rdx      # 0xb530
addq $0x4, %rdx
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movslq (%rdx), %rsi
movq (%r14,%rsi,8), %rdi
addsd (%rdi,%rsi,8), %xmm0
ucomisd %xmm1, %xmm0
ja 0x509b
incq %rcx
addq $0x10, %rdx
cmpq %rcx, %rax
jne 0x507b
movl %eax, %ecx
movl %ecx, %r15d
jmp 0x54cb
movl -0xb8(%rbp), %ebx
movl %ebx, %edi
movq %r9, %rsi
leaq -0xe8(%rbp), %rdx
leaq -0xe4(%rbp), %rcx
callq 0x59ad
movl -0xe8(%rbp), %edx
movl -0xe4(%rbp), %ecx
movq -0x98(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x5a6d
movq -0x30(%rbp), %r9
movslq %ebx, %rcx
subl %eax, (%r9,%rcx,4)
jmp 0x52dd
movslq 0x8(%r12), %rax
movslq 0xc(%r12), %rcx
movsd 0x18(%r12), %xmm0
movq (%r14,%rax,8), %rdx
subsd (%rdx,%rcx,8), %xmm0
addsd (%rdx,%rax,8), %xmm0
movsd %xmm0, (%rdx,%rax,8)
movsd 0x18(%r12), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
jmp 0x5297
movslq 0x8(%r12), %rax
movslq 0xc(%r12), %rcx
movl (%r9,%rax,4), %edx
addl %edx, (%r9,%rcx,4)
movl $0x0, (%r9,%rax,4)
movl 0x640b(%rip), %edx      # 0xb550
testl %edx, %edx
jle 0x5171
movq 0x63e0(%rip), %rsi      # 0xb530
addq $0x4, %rsi
xorl %edi, %edi
cmpl %eax, (%rsi)
jne 0x5162
movl %ecx, (%rsi)
movl 0x63ee(%rip), %edx      # 0xb550
incq %rdi
movslq %edx, %r8
addq $0x10, %rsi
cmpq %r8, %rdi
jl 0x5156
testl %r13d, %r13d
jle 0x5297
movl %eax, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x519e
movq (%r14,%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, %rbx
jne 0x517e
jmp 0x5297
movsd 0x18(%r12), %xmm0
movslq 0x8(%r12), %rax
movq -0x68(%rbp), %rcx
movsd %xmm0, (%rcx,%rax,8)
movq $0x0, (%r15,%rax,8)
jmp 0x5297
testl %r13d, %r13d
movq %r15, %r13
movq -0x68(%rbp), %r15
movq -0x88(%rbp), %rax
jle 0x5246
xorl %r14d, %r14d
movsd (%r15,%r14,8), %xmm1
movsd %xmm1, -0x48(%rbp)
movsd (%r13,%r14,8), %xmm1
xorpd %xmm4, %xmm1
subsd (%rax,%r14,8), %xmm0
mulsd %xmm1, %xmm0
callq 0x11a0
movapd 0x1e40(%rip), %xmm4     # 0x7050
movq -0x88(%rbp), %rax
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, (%r15,%r14,8)
movsd 0x18(%r12), %xmm0
movsd %xmm0, (%r13,%r14,8)
movsd 0x6330(%rip), %xmm0     # 0xb568
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x51e3
movq 0x30(%r12), %r12
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
movq %r13, %r15
xorpd %xmm3, %xmm3
movapd -0x60(%rbp), %xmm5
movq -0x70(%rbp), %r14
movq -0xa0(%rbp), %r13
jmp 0x555f
testl %r13d, %r13d
movq -0x68(%rbp), %rcx
jle 0x5297
xorl %eax, %eax
movsd 0x18(%r12), %xmm0
movsd %xmm0, (%rcx,%rax,8)
movq $0x0, (%r15,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x527b
movq 0x30(%r12), %r12
jmp 0x555f
addsd -0xf0(%rbp), %xmm3
divsd %xmm2, %xmm3
ucomisd %xmm0, %xmm3
jbe 0x556e
movq -0x98(%rbp), %rdi
callq 0x5735
movq 0x6266(%rip), %rcx      # 0xb530
cltq
shlq $0x4, %rax
movslq 0x4(%rcx,%rax), %rax
movq -0x30(%rbp), %r9
incl (%r9,%rax,4)
movsd -0x38(%rbp), %xmm2
xorpd %xmm3, %xmm3
movapd 0x1d62(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
jmp 0x555f
movslq 0x8(%r12), %rax
movq %rax, -0x48(%rbp)
movq %r12, -0xa8(%rbp)
movsd 0x18(%r12), %xmm0
movsd %xmm0, -0x90(%rbp)
leal 0x1(%r13), %eax
movl %eax, -0x80(%rbp)
movslq %eax, %r12
leaq (,%r12,4), %rsi
movq %r9, %rdi
callq 0x1170
movq %rax, -0x30(%rbp)
shlq $0x3, %r12
movq -0x68(%rbp), %rdi
movq %r12, %rsi
callq 0x1170
movq %rax, -0x68(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1170
movq %rax, %r14
movq -0x88(%rbp), %rdi
movq %r12, %rsi
callq 0x1170
movsd 0x61fa(%rip), %xmm0     # 0xb568
movslq %r13d, %r15
movq %rax, -0x88(%rbp)
movsd %xmm0, (%rax,%r15,8)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq -0x68(%rbp), %rcx
movq %rax, (%rcx,%r15,8)
movq %r14, -0x78(%rbp)
movq $0x0, (%r14,%r15,8)
movq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x1170
movq %r13, %rcx
movq %rax, %r13
testl %ecx, %ecx
jle 0x53cf
xorl %r14d, %r14d
movq (%r13,%r14,8), %rdi
movq %r12, %rsi
callq 0x1170
movq %rax, (%r13,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x53b5
movq %r12, %rdi
callq 0x1120
movq %rax, (%r13,%r15,8)
cmpl $0x0, -0xa0(%rbp)
movl $0x0, %edi
js 0x5404
movl -0x80(%rbp), %ecx
xorl %edx, %edx
movq (%r13,%rdx,8), %rsi
movq %rdi, (%rsi,%r15,8)
movq %rdi, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x53ef
movq -0x30(%rbp), %r9
movl %edi, (%r9,%r15,4)
movq -0x48(%rbp), %rdx
movl %edi, (%r9,%rdx,4)
cmpl %edi, 0x6136(%rip)      # 0xb550
movsd -0x38(%rbp), %xmm2
xorpd %xmm3, %xmm3
movapd 0x1c25(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
jle 0x54ae
leaq (%r9,%r15,4), %rbx
leaq (%r9,%rdx,4), %r14
movl $0x4, %r15d
movq 0x60e9(%rip), %rax      # 0xb530
xorl %r12d, %r12d
cmpl %edx, (%rax,%r15)
jne 0x549b
callq 0x4503
movsd -0x90(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movq 0x60c8(%rip), %rax      # 0xb530
movq %r14, %rcx
ja 0x547b
movq -0xa0(%rbp), %rcx
movl %ecx, (%rax,%r15)
movq %rbx, %rcx
incl (%rcx)
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
movapd 0x1bbe(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
movq -0x48(%rbp), %rdx
incq %r12
movslq 0x60ab(%rip), %rcx      # 0xb550
addq $0x10, %r15
cmpq %rcx, %r12
jl 0x544a
movq -0xa8(%rbp), %r12
movq 0x30(%r12), %r12
movl -0x80(%rbp), %eax
movq %r13, %r14
movq %rax, %r13
jmp 0x555b
xorl %r15d, %r15d
callq 0x4503
shlq $0x4, %r15
movq 0x6055(%rip), %rcx      # 0xb530
movslq 0x4(%rcx,%r15), %rax
testl %r13d, %r13d
jle 0x552c
movq (%r14,%rax,8), %rsi
mulsd (%rsi,%rax,8), %xmm0
movl %eax, %edi
xorpd %xmm1, %xmm1
xorl %edx, %edx
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
movapd 0x1b45(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
cmpq %rdx, %rdi
je 0x5520
addsd (%rsi,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x5548
incq %rdx
cmpq %rdx, %rbx
jne 0x5510
movl %ebx, %edx
jmp 0x5548
xorl %edx, %edx
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
xorpd %xmm3, %xmm3
movapd 0x1b0d(%rip), %xmm4     # 0x7050
movapd -0x60(%rbp), %xmm5
addq %r15, %rcx
addq $0x4, %rcx
decl (%r9,%rax,4)
movl %edx, %eax
incl (%r9,%rax,4)
movl %edx, (%rcx)
movq -0x78(%rbp), %r15
cmpl $0x1, 0x5fea(%rip)      # 0xb550
jg 0x49e5
jmp 0x55ab
movq -0x98(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x5896
testl %eax, %eax
js 0x5599
movq 0x5fa4(%rip), %rcx      # 0xb530
movl %eax, %eax
jmp 0x52cc
movq -0x70(%rbp), %r14
jmp 0x555f
movsd -0x38(%rbp), %xmm2
movq -0x30(%rbp), %r9
jmp 0x52e2
movq -0x30(%rbp), %r9
movl 0x5faf(%rip), %eax      # 0xb560
movq -0xf8(%rbp), %rcx
movl %eax, (%rcx)
movq %r9, %rdi
callq 0x10e0
movq -0x68(%rbp), %rdi
callq 0x10e0
movq %r15, %rdi
callq 0x10e0
movq -0x88(%rbp), %rdi
callq 0x10e0
testl %r13d, %r13d
movq %r14, %r15
jle 0x55fe
movl %r13d, %ebx
xorl %r14d, %r14d
movq (%r15,%r14,8), %rdi
callq 0x10e0
incq %r14
cmpq %r14, %rbx
jne 0x55ed
movq %r15, %rdi
callq 0x10e0
movq 0x5f3b(%rip), %rax      # 0xb548
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2755(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x46e9
leaq 0x2744(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x4704
leaq 0x2733(%rip), %rdi      # 0x7d7b
callq 0x1090
jmp 0x4719
leaq 0x2722(%rip), %rdi      # 0x7d7b
callq 0x1090
movq -0x88(%rbp), %rax
jmp 0x4739
leaq 0x2732(%rip), %rdi      # 0x7da3
callq 0x1090
jmp 0x4893
leaq 0x26ae(%rip), %rdi      # 0x7d30
callq 0x1090
jmp 0x4679
leaq 0x26b2(%rip), %rdi      # 0x7d45
callq 0x1090
jmp 0x46a2
leaq 0x26ba(%rip), %rdi      # 0x7d5e
callq 0x1090
jmp 0x46cf
callq 0x150f
callq 0x1537