// File: /workspace/github_c_makefile_star2_O1/genevalab[P]msmove/ms.c
// Function: gensam
int gensam(char **list, double *pprobss, double *ptmrca, double *pttot, int *migflag) 
{
	int nsegs, i, k, seg, ns, start, end, len, segsit;
	int *ss, segsitesin, nsites, nsam, mfreq;
	double nsinv, tseg, tt, theta, es, *pk;
	struct segl *seglst;

	nsites = pars.cp.nsites;
	nsinv = 1.0/nsites;
	*migflag = 0;
	seglst = segtre_mig(&(pars.cp), &nsegs, migflag);
	nsam = pars.cp.nsam;
	segsitesin = pars.mp.segsitesin;
	theta = pars.mp.theta;
	mfreq = pars.mp.mfreq;

	if (pars.mp.treeflag) 
	{
	  	ns = 0;
	    for (seg=0, k=0; k < nsegs; seg = seglst[seg].next, k++)
		{
			if ( (pars.cp.r > 0) || (pars.cp.f > 0) )
			{
				end = k < nsegs-1 ? seglst[seglst[seg].next].beg-1 : nsites-1;
				start = seglst[seg].beg;
				len = end-start+1;
				fprintf(stdout, "[%d]", len);
			}
			prtree(seglst[seg].ptree, nsam);
			if ((segsitesin == 0) && (theta == 0) && (pars.mp.timeflag == 0)) 
				free(seglst[seg].ptree);
		}
	}

	if (pars.mp.timeflag)
	{
		tt = 0;
		for (seg=0, k=0; k < nsegs; seg = seglst[seg].next, k++)
		{ 
			if (mfreq > 1) 
				ndes_setup(seglst[seg].ptree, nsam);
			end = k < nsegs-1 ? seglst[seglst[seg].next].beg-1 : nsites-1;
			start = seglst[seg].beg;
			if ((nsegs == 1) || ((start <= nsites/2) && (end >= nsites/2)))
				*ptmrca = (seglst[seg].ptree+2*nsam-2)->time;
			len = end-start+1;
			tseg = len / (double)nsites;
			if (mfreq == 1)
				tt += ttime(seglst[seg].ptree, nsam) * tseg;
			else 
				tt += ttimemf(seglst[seg].ptree, nsam, mfreq)*tseg;
			if ((segsitesin == 0) && (theta == 0)) 
				free(seglst[seg].ptree);
		}
		*pttot = tt;
	}	
	
    if ((segsitesin == 0) && (theta > 0))
	{
		ns = 0;
		for (seg=0, k=0; k < nsegs; seg = seglst[seg].next, k++)
		{ 
			if (mfreq > 1)
				ndes_setup(seglst[seg].ptree, nsam);
			end = k < nsegs-1 ? seglst[seglst[seg].next].beg-1 : nsites-1;
			start = seglst[seg].beg;
			len = end-start+1;
			tseg = len*theta/nsites;
			if (mfreq == 1)
				tt = ttime(seglst[seg].ptree, nsam);
			else
				tt = ttimemf(seglst[seg].ptree, nsam, mfreq);
			segsit = poisso(tseg*tt);
			if ((unsigned int)(segsit+ns) >= maxsites)
			{
				maxsites = segsit+ns+SITESINC;
				posit = (double*)realloc(posit, (size_t)maxsites*sizeof(double));
				if (posit == NULL)
					perror("Realloc failure for posit");
				biggerlist(nsam, list); 
			}
			make_gametes(nsam, mfreq, seglst[seg].ptree, tt, segsit, ns, list);
			free(seglst[seg].ptree);
			locate(segsit, start * nsinv, len * nsinv, posit + ns);   
			ns += segsit;
		}
	}
	else
		if (segsitesin > 0)
		{
			pk = (double*)malloc((size_t)nsegs*sizeof(double));
			ss = (int*)malloc((size_t)nsegs*sizeof(int));
			if ((pk == 0) || (ss == 0))
				perror("malloc error. gensam.2");
			tt = 0;
			for (seg=0, k=0; k < nsegs; seg = seglst[seg].next, k++)
			{ 
				if (mfreq > 1)
					ndes_setup(seglst[seg].ptree, nsam);
				end = k < nsegs-1 ? seglst[seglst[seg].next].beg-1 : nsites-1;
				start = seglst[seg].beg;
				len = end-start+1;
				tseg = len/(double)nsites;
				if (mfreq == 1)
					pk[k] = ttime(seglst[seg].ptree, nsam)*tseg;
				else 
					pk[k] = ttimemf(seglst[seg].ptree, nsam, mfreq)*tseg;
				tt += pk[k];
			}
			if (theta > 0)
			{ 
				es = theta*tt;
				*pprobss = exp(-1.0*es)*pow(es, (double)segsitesin)/segfac;
			}
			if (tt > 0)
			{
				for (k=0; k < nsegs; k++)
					pk[k] *= 1.0/tt;
				mnmial(segsitesin, nsegs, pk, ss);
			}
			else
				for (k=0; k < nsegs; k++)
					ss[k] = 0;
			ns = 0;
			for (seg=0, k=0; k < nsegs; seg = seglst[seg].next, k++)
			{ 
				end = k < nsegs-1 ? seglst[seglst[seg].next].beg-1 : nsites-1;
				start = seglst[seg].beg;
				len = end-start+1;
				tseg = len/(double)nsites;
				make_gametes(nsam, mfreq, seglst[seg].ptree, tt*pk[k]/tseg, ss[k], ns, list);
				free(seglst[seg].ptree);
				locate(ss[k], start*nsinv, len*nsinv, posit+ns);
				ns += ss[k];
			}
			free(pk);
			free(ss);
		}
		
		for (i=0; i < nsam; i++)
			list[i][ns] = '\0';
		return ns;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, -0xb8(%rbp)
movq %rdx, -0x98(%rbp)
movq %rsi, -0xb0(%rbp)
movq %rdi, -0xa0(%rbp)
movl 0x7619(%rip), %eax      # 0xa140
movl %eax, -0x44(%rbp)
leaq 0x75ef(%rip), %rdi      # 0xa120
movl $0x0, (%r8)
leaq -0x2c(%rbp), %rsi
movq %r8, %rdx
callq 0x4518
movq %rax, -0x38(%rbp)
movslq 0x75d5(%rip), %rax      # 0xa124
movq %rax, -0x40(%rbp)
movl 0x761f(%rip), %eax      # 0xa178
movl %eax, -0x60(%rbp)
movsd 0x760c(%rip), %xmm0     # 0xa170
movapd %xmm0, -0x80(%rbp)
movl 0x7615(%rip), %eax      # 0xa184
movl %eax, -0x30(%rbp)
cmpl $0x0, 0x7603(%rip)      # 0xa17c
je 0x2c77
movl -0x2c(%rbp), %eax
testl %eax, %eax
jle 0x2c77
cmpl $0x0, -0x60(%rbp)
sete %cl
xorpd %xmm1, %xmm1
movapd -0x80(%rbp), %xmm0
ucomisd %xmm1, %xmm0
setnp %dl
sete %r14b
andb %dl, %r14b
andb %cl, %r14b
movq 0x7416(%rip), %r15      # 0x9fc8
leaq 0x45a0(%rip), %rbx      # 0x7159
xorl %r12d, %r12d
xorl %ecx, %ecx
movsd 0x7572(%rip), %xmm0     # 0xa138
ucomisd 0x4442(%rip), %xmm0     # 0x7010
movslq %ecx, %r13
ja 0x2be5
movsd 0x756d(%rip), %xmm0     # 0xa148
ucomisd 0x442d(%rip), %xmm0     # 0x7010
jbe 0x2c29
decl %eax
movl -0x44(%rbp), %edx
cmpl %eax, %r12d
jge 0x2c0a
leaq (,%r13,2), %rax
addq %r13, %rax
movq -0x38(%rbp), %rcx
movslq 0x10(%rcx,%rax,8), %rax
leaq (%rax,%rax,2), %rax
movl (%rcx,%rax,8), %edx
leaq (,%r13,2), %rax
addq %r13, %rax
movq -0x38(%rbp), %rcx
subl (%rcx,%rax,8), %edx
movq (%r15), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1150
leaq (,%r13,2), %rax
addq %r13, %rax
movq -0x38(%rbp), %rcx
leaq (%rcx,%rax,8), %r13
movq 0x8(%rcx,%rax,8), %rdi
movq -0x40(%rbp), %rsi
callq 0x34ab
cmpl $0x0, 0x752f(%rip)      # 0xa180
sete %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x2c64
movq 0x8(%r13), %rdi
callq 0x10e0
movl 0x10(%r13), %ecx
incl %r12d
movl -0x2c(%rbp), %eax
cmpl %eax, %r12d
jl 0x2bbe
xorps %xmm0, %xmm0
cvtsi2sdl -0x44(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
cmpl $0x0, 0x74f2(%rip)      # 0xa180
movl -0x30(%rbp), %edx
movapd -0x80(%rbp), %xmm1
je 0x2e68
cmpl $0x0, -0x2c(%rbp)
jle 0x2e4f
movl -0x44(%rbp), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl %ecx, -0x58(%rbp)
movq -0x40(%rbp), %rsi
leaq (%rsi,%rsi), %rdi
leal (%rsi,%rsi), %eax
movslq %eax, %r8
cmpl $0x0, -0x60(%rbp)
sete %al
xorpd %xmm2, %xmm2
xorpd %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
ucomisd %xmm2, %xmm1
leal -0x1(%rsi,%rsi), %ecx
movl %ecx, -0xa8(%rbp)
setnp %cl
sete %r13b
andb %cl, %r13b
andb %al, %r13b
leal -0x2(,%rsi,2), %eax
cltq
subq %rsi, %rax
incq %rax
movq %rax, -0xc8(%rbp)
shlq $0x4, %rsi
orq $0x8, %rsi
movq %rsi, -0xc0(%rbp)
xorl %r12d, %r12d
shlq $0x4, %rdi
movq %rdi, -0x68(%rbp)
shlq $0x4, %r8
movq %r8, -0x88(%rbp)
xorl %eax, %eax
movslq %eax, %rbx
cmpl $0x2, %edx
jl 0x2d50
leaq (%rbx,%rbx,2), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx,%rax,8), %rdi
movq -0x40(%rbp), %rsi
callq 0x3590
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %eax
leal -0x1(%rax), %ecx
movl -0x44(%rbp), %r15d
cmpl %ecx, %r12d
jge 0x2d74
leaq (%rbx,%rbx,2), %rcx
movq -0x38(%rbp), %rsi
movslq 0x10(%rsi,%rcx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
movl (%rsi,%rcx,8), %r15d
leaq (%rbx,%rbx,2), %rcx
movq -0x38(%rbp), %rsi
leaq (%rsi,%rcx,8), %r14
movl (%rsi,%rcx,8), %ebx
cmpl $0x1, %eax
je 0x2d93
cmpl -0x58(%rbp), %ebx
jg 0x2dac
cmpl -0x58(%rbp), %r15d
jle 0x2dac
movq 0x8(%r14), %rax
movq -0x68(%rbp), %rcx
movsd -0x18(%rax,%rcx), %xmm0
movq -0x98(%rbp), %rax
movsd %xmm0, (%rax)
movq 0x8(%r14), %rdi
cmpl $0x1, %edx
jne 0x2dea
movq -0x88(%rbp), %rax
movsd -0x18(%rdi,%rax), %xmm1
movl -0xa8(%rbp), %eax
cmpl -0x40(%rbp), %eax
jle 0x2df7
addq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rax
addsd (%rdi), %xmm1
addq $0x10, %rdi
decq %rax
jne 0x2ddb
jmp 0x2df7
movq -0x40(%rbp), %rsi
callq 0x3664
movapd %xmm0, %xmm1
testb %r13b, %r13b
je 0x2e0f
movq 0x8(%r14), %rdi
movsd %xmm1, -0x70(%rbp)
callq 0x10e0
movsd -0x70(%rbp), %xmm1
subl %ebx, %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
divsd -0x90(%rbp), %xmm0
mulsd %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movl 0x10(%r14), %eax
incl %r12d
cmpl -0x2c(%rbp), %r12d
movl -0x30(%rbp), %edx
movapd -0x80(%rbp), %xmm1
jl 0x2d2f
jmp 0x2e58
xorpd %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0xb8(%rbp), %rax
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd 0x4198(%rip), %xmm0     # 0x7008
divsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
cmpl $0x0, -0x60(%rbp)
jne 0x30cf
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x30cf
cmpl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %r12
jle 0x330f
leal (%r12,%r12), %eax
movslq %eax, %rcx
leal -0x1(,%r12,2), %eax
movl %eax, -0x88(%rbp)
leal -0x2(,%r12,2), %eax
cltq
subq %r12, %rax
incq %rax
movq %rax, -0xa8(%rbp)
movq %r12, %rax
shlq $0x4, %rax
orq $0x8, %rax
movq %rax, -0x60(%rbp)
xorl %r14d, %r14d
shlq $0x4, %rcx
movq %rcx, -0x68(%rbp)
xorl %eax, %eax
xorl %r13d, %r13d
movslq %eax, %r15
cmpl $0x2, %edx
jl 0x2f16
leaq (%r15,%r15,2), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx,%rax,8), %rdi
movl %r12d, %esi
callq 0x3590
movapd -0x80(%rbp), %xmm1
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %eax
decl %eax
movl -0x44(%rbp), %ebx
cmpl %eax, %r14d
jge 0x2f37
leaq (%r15,%r15,2), %rax
movq -0x38(%rbp), %rcx
movslq 0x10(%rcx,%rax,8), %rax
leaq (%rax,%rax,2), %rax
movl (%rcx,%rax,8), %ebx
leaq (%r15,%r15,2), %r15
movq -0x38(%rbp), %rax
movl (%rax,%r15,8), %ecx
movq 0x8(%rax,%r15,8), %rdi
cmpl $0x1, %edx
jne 0x2f7a
movq -0x68(%rbp), %rax
movsd -0x18(%rdi,%rax), %xmm3
cmpl %r12d, -0x88(%rbp)
jle 0x2f91
addq -0x60(%rbp), %rdi
movq -0xa8(%rbp), %rax
addsd (%rdi), %xmm3
addq $0x10, %rdi
decq %rax
jne 0x2f6b
jmp 0x2f91
movl %r12d, %esi
movl %ecx, %r12d
callq 0x3664
movl %r12d, %ecx
movapd -0x80(%rbp), %xmm1
movapd %xmm0, %xmm3
movl %ecx, -0x58(%rbp)
subl %ecx, %ebx
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
movapd %xmm1, %xmm0
movsd %xmm2, -0x50(%rbp)
mulsd %xmm2, %xmm0
divsd -0x90(%rbp), %xmm0
movsd %xmm3, -0x70(%rbp)
mulsd %xmm3, %xmm0
callq 0x36c7
movl %eax, %r12d
leal (%r12,%r13), %ebx
cmpl 0x712b(%rip), %ebx      # 0xa0f8
jb 0x3008
leal 0xa(%rbx), %esi
movl %esi, 0x7120(%rip)      # 0xa0f8
movq 0x71a9(%rip), %rdi      # 0xa188
shlq $0x3, %rsi
callq 0x1170
movq %rax, 0x7199(%rip)      # 0xa188
testq %rax, %rax
je 0x30be
movq -0x40(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x3755
movq -0x38(%rbp), %rax
leaq (%rax,%r15,8), %r15
movq 0x8(%r15), %rdx
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
movsd -0x70(%rbp), %xmm0
movl %r12d, %ecx
movl %r13d, %r8d
movq -0xa0(%rbp), %r9
callq 0x37ab
movq 0x8(%r15), %rdi
callq 0x10e0
movslq %r13d, %r13
shlq $0x3, %r13
addq 0x713f(%rip), %r13      # 0xa188
movl %r12d, %edi
movq %r13, %rsi
callq 0x396a
testl %r12d, %r12d
movsd -0x50(%rbp), %xmm2
jle 0x3099
xorps %xmm0, %xmm0
cvtsi2sdl -0x58(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm2
movl %r12d, %eax
xorl %ecx, %ecx
movsd (%r13,%rcx,8), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r13,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x307b
movl 0x10(%r15), %eax
incl %r14d
movl %ebx, %r13d
cmpl -0x2c(%rbp), %r14d
movq -0x40(%rbp), %r12
movl -0x30(%rbp), %edx
movapd -0x80(%rbp), %xmm1
jl 0x2ef1
jmp 0x3465
leaq 0x4099(%rip), %rdi      # 0x715e
callq 0x1090
jmp 0x2ff8
cmpl $0x0, -0x60(%rbp)
movq -0x40(%rbp), %r12
jle 0x330f
movslq -0x2c(%rbp), %rbx
leaq (,%rbx,8), %rdi
callq 0x1120
movq %rax, %r15
shlq $0x2, %rbx
movq %rbx, %rdi
callq 0x1120
movq %rax, %rbx
testq %r15, %r15
je 0x349a
testq %rbx, %rbx
je 0x349a
movq %rbx, -0x68(%rbp)
cmpl $0x0, -0x2c(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x30(%rbp), %r9d
movq %r15, -0x70(%rbp)
jle 0x325e
movq -0x40(%rbp), %rcx
leal (%rcx,%rcx), %eax
movslq %eax, %rbx
leal -0x1(,%rcx,2), %r14d
leal -0x2(,%rcx,2), %eax
cltq
subq %rcx, %rax
incq %rax
movq %rax, -0x58(%rbp)
shlq $0x4, %rcx
orq $0x8, %rcx
movq %rcx, -0x88(%rbp)
movsd %xmm0, -0x50(%rbp)
xorl %r12d, %r12d
shlq $0x4, %rbx
xorl %eax, %eax
movslq %eax, %r13
cmpl $0x2, %r9d
jl 0x319d
leaq (,%r13,2), %rax
addq %r13, %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx,%rax,8), %rdi
movq -0x40(%rbp), %rsi
callq 0x3590
movl -0x30(%rbp), %r9d
movslq -0x2c(%rbp), %rax
decq %rax
movl -0x44(%rbp), %r15d
cmpq %rax, %r12
jge 0x31c9
leaq (,%r13,2), %rax
addq %r13, %rax
movq -0x38(%rbp), %rcx
movslq 0x10(%rcx,%rax,8), %rax
leaq (%rax,%rax,2), %rax
movl (%rcx,%rax,8), %r15d
leaq (%r13,%r13,2), %r13
movq -0x38(%rbp), %rax
subl (%rax,%r13,8), %r15d
movq 0x8(%rax,%r13,8), %rdi
cmpl $0x1, %r9d
jne 0x3207
movsd -0x18(%rdi,%rbx), %xmm0
cmpl -0x40(%rbp), %r14d
jle 0x3217
addq -0x88(%rbp), %rdi
movq -0x58(%rbp), %rax
addsd (%rdi), %xmm0
addq $0x10, %rdi
decq %rax
jne 0x31f8
jmp 0x3217
movq -0x40(%rbp), %rsi
movl %r9d, %edx
callq 0x3664
movl -0x30(%rbp), %r9d
movq -0x38(%rbp), %rax
leaq (%rax,%r13,8), %rax
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
divsd -0x90(%rbp), %xmm1
mulsd %xmm0, %xmm1
movq -0x70(%rbp), %r15
movsd %xmm1, (%r15,%r12,8)
movsd -0x50(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movl 0x10(%rax), %eax
incq %r12
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %r12
jl 0x3173
movapd -0x80(%rbp), %xmm1
ucomisd 0x3da5(%rip), %xmm1     # 0x7010
jbe 0x32bb
mulsd -0x50(%rbp), %xmm1
movapd %xmm1, -0x80(%rbp)
movapd 0x3dd1(%rip), %xmm0     # 0x7050
xorpd %xmm1, %xmm0
callq 0x11a0
movsd %xmm0, -0x58(%rbp)
xorps %xmm1, %xmm1
cvtsi2sdl -0x60(%rbp), %xmm1
movapd -0x80(%rbp), %xmm0
callq 0x1190
movl -0x30(%rbp), %r9d
mulsd -0x58(%rbp), %xmm0
divsd 0x6ee0(%rip), %xmm0     # 0xa190
movq -0xb0(%rbp), %rax
movsd %xmm0, (%rax)
xorpd %xmm0, %xmm0
movsd -0x50(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movl -0x2c(%rbp), %edx
movq -0x40(%rbp), %r12
jbe 0x3316
testl %edx, %edx
movsd 0x3d2d(%rip), %xmm1     # 0x7008
jle 0x32fc
divsd -0x50(%rbp), %xmm1
xorl %eax, %eax
movsd (%r15,%rax,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0x32e4
movl -0x60(%rbp), %edi
movl %edx, %esi
movq %r15, %rdx
movq -0x68(%rbp), %rcx
callq 0x38bb
jmp 0x3329
xorl %ebx, %ebx
jmp 0x3465
testl %edx, %edx
jle 0x332d
shlq $0x2, %rdx
movq -0x68(%rbp), %rdi
xorl %esi, %esi
callq 0x1040
movl -0x30(%rbp), %r9d
movl -0x2c(%rbp), %eax
testl %eax, %eax
jle 0x3451
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r8d, %r8d
decl %eax
movslq %eax, %rdx
movslq %ecx, %rax
movl -0x44(%rbp), %ecx
cmpq %rdx, %r14
jge 0x3364
leaq (%rax,%rax,2), %rcx
movq -0x38(%rbp), %rdx
movslq 0x10(%rdx,%rcx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
movl (%rdx,%rcx,8), %ecx
leaq (%rax,%rax,2), %r15
movq -0x38(%rbp), %r13
movl (%r13,%r15,8), %eax
movl %eax, -0x58(%rbp)
subl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movsd %xmm1, -0x80(%rbp)
divsd -0x90(%rbp), %xmm1
movq 0x8(%r13,%r15,8), %rdx
movq -0x70(%rbp), %rax
movsd (%rax,%r14,8), %xmm0
mulsd -0x50(%rbp), %xmm0
divsd %xmm1, %xmm0
movq -0x68(%rbp), %rax
movslq (%rax,%r14,4), %rbx
movl %r12d, %edi
movl %r9d, %esi
movl %ebx, %ecx
movl %r8d, %r12d
movq -0xa0(%rbp), %r9
callq 0x37ab
movq 0x8(%r13,%r15,8), %rdi
callq 0x10e0
movl %r12d, %r13d
movslq %r12d, %r12
shlq $0x3, %r12
addq 0x6dac(%rip), %r12      # 0xa188
movl %ebx, %edi
movq %r12, %rsi
callq 0x396a
movsd -0x80(%rbp), %xmm2
testq %rbx, %rbx
jle 0x3426
xorps %xmm0, %xmm0
cvtsi2sdl -0x58(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm2
xorl %eax, %eax
movsd (%r12,%rax,8), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r12,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x340a
movq -0x38(%rbp), %rax
leaq (%rax,%r15,8), %rax
addl %r13d, %ebx
movl 0x10(%rax), %ecx
incq %r14
movslq -0x2c(%rbp), %rax
movl %ebx, %r8d
cmpq %rax, %r14
movq -0x40(%rbp), %r12
movl -0x30(%rbp), %r9d
jl 0x3340
jmp 0x3453
xorl %ebx, %ebx
movq -0x70(%rbp), %rdi
callq 0x10e0
movq -0x68(%rbp), %rdi
callq 0x10e0
testl %r12d, %r12d
movq -0xa0(%rbp), %rsi
jle 0x3486
movslq %ebx, %rax
xorl %ecx, %ecx
movq (%rsi,%rcx,8), %rdx
movb $0x0, (%rdx,%rax)
incq %rcx
cmpq %rcx, %r12
jne 0x3476
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3cd7(%rip), %rdi      # 0x7178
callq 0x1090
jmp 0x3112