// File: /workspace/github_c_makefile_star2_O1/genevalab[P]msmove/streec.c
// Function: xover
int xover(int nsam, int ic, int is)
{
	int i, k, lsgm1, newsg, jseg, in;
	int lsg = chrom[ic].nseg;	
	struct seg *pseg = chrom[ic].pseg;
	struct seg *pseg2;
	double len = (pseg+lsg-1)->end - pseg->beg;
	
	cleft -= 1.0-pow(pc, len);

	for (jseg=0; is >= (pseg + jseg)->end; jseg++);
	if (is >= (pseg+jseg)->beg)
		in = 1;
	else
		in = 0;
	newsg = lsg-jseg;
	nchrom++;
	if ((unsigned int)nchrom >= maxchr)
	{
		maxchr += 20;
		chrom = (struct chromo*)realloc(chrom, (size_t)maxchr*sizeof(struct chromo));
		if (chrom == NULL)
			perror("malloc error. segtre2");
	}
	if (!(pseg2 = chrom[nchrom-1].pseg = (struct seg*)calloc((size_t)newsg, sizeof(struct seg))))
		perror(" alloc error. re1");
	chrom[nchrom-1].nseg = newsg;
	chrom[nchrom-1].pop = chrom[ic].pop;
	pseg2->end = (pseg+jseg)->end;
	if (in)
	{
		pseg2->beg = is+1;
		(pseg+jseg)->end = is;
	}
	else
		pseg2->beg = (pseg+jseg)->beg;
	pseg2->desc = (pseg+jseg)->desc;
	for (k=1; k < newsg; k++)
	{
		(pseg2+k)->beg = (pseg+jseg+k)->beg;
		(pseg2+k)->end = (pseg+jseg+k)->end;
		(pseg2+k)->desc = (pseg+jseg+k)->desc;
	}
	lsg = chrom[ic].nseg = lsg-newsg+in;
	lsgm1 = lsg-1;
	nlinks -= pseg2->beg - (pseg+lsgm1)->end;
	len = (pseg+lsgm1)->end - (pseg->beg);
	cleft += 1.0-pow(pc, len);
	len = (pseg2+newsg-1)->end - pseg2->beg;
	cleft += 1.0-pow(pc, len);
	if (!(chrom[ic].pseg = (struct seg*)realloc(chrom[ic].pseg, (size_t)lsg*sizeof(struct seg))))
		perror("realloc error. re2");
	if (in)
	{
		begs = pseg2->beg;
		for (i=0, k=0; (k < nsegs-1) && (begs > seglst[seglst[i].next].beg-1); i=seglst[i].next, k++);
		if (begs != seglst[i].beg)
		{
			if ((unsigned int)nsegs >= seglimit)
			{
				seglimit += SEGINC;
				nnodes = (int*)realloc(nnodes, (size_t)seglimit*sizeof(int));
				if (nnodes == NULL)
					perror("realloc error. 1. segtre_mig.c");
				seglst = (struct segl*)realloc(seglst,(size_t)seglimit*sizeof(struct segl));
				if (seglst == NULL)
					perror("realloc error. 2. segtre_mig.c");
			}
			seglst[nsegs].next = seglst[i].next;
			seglst[i].next = nsegs;
			seglst[nsegs].beg = begs;
			if (!(seglst[nsegs].ptree = (struct node*)calloc((size_t)(2*nsam), sizeof(struct node))))
				perror("calloc error. re3.");
			nnodes[nsegs] = nnodes[i];
			ptree1 = seglst[i].ptree;
			ptree2 = seglst[nsegs].ptree;
			nsegs++;
			for (k=0; k <= nnodes[i]; k++)
			{
				(ptree2+k)->abv = (ptree1+k)->abv;
				(ptree2+k)->time = (ptree1+k)->time;
			}
		}
	}
	return ic;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r12d
movq 0x5640(%rip), %rax      # 0xb530
movl %esi, -0x38(%rbp)
movslq %esi, %rcx
shlq $0x4, %rcx
movslq (%rax,%rcx), %r14
movq %rcx, -0x40(%rbp)
movq 0x8(%rax,%rcx), %rbx
leaq (%r14,%r14,2), %rax
movl -0x8(%rbx,%rax,4), %eax
subl (%rbx), %eax
movl %edi, -0x30(%rbp)
cvtsi2sd %eax, %xmm1
movsd 0x5650(%rip), %xmm0     # 0xb570
callq 0x1190
movsd 0x10db(%rip), %xmm1     # 0x7008
subsd %xmm0, %xmm1
movsd 0x5647(%rip), %xmm0     # 0xb580
subsd %xmm1, %xmm0
movsd %xmm0, 0x563b(%rip)     # 0xb580
movq %rbx, -0x50(%rbp)
leaq 0x8(%rbx), %r13
movl $0x1, %ebx
movq %r13, %rax
addq $0xc, %r13
decl %ebx
cmpl %r12d, -0x4(%rax)
jle 0x5f52
movl -0x14(%r13), %eax
movl %eax, -0x34(%rbp)
cmpl %r12d, %eax
setle -0x29(%rbp)
addl %ebx, %r14d
movl 0x55d8(%rip), %eax      # 0xb550
incl %eax
movl %eax, 0x55d0(%rip)      # 0xb550
movl 0x55b2(%rip), %esi      # 0xb538
cmpl %esi, %eax
jb 0x5fb3
addl $0x14, %esi
movl %esi, 0x55a5(%rip)      # 0xb538
movq 0x5596(%rip), %rdi      # 0xb530
shlq $0x4, %rsi
callq 0x1170
movq %rax, 0x5586(%rip)      # 0xb530
testq %rax, %rax
je 0x6319
movslq %r14d, %rdi
movl $0xc, %esi
movq %rdi, -0x48(%rbp)
callq 0x1050
movq %rax, %r15
movq 0x5562(%rip), %rax      # 0xb530
movslq 0x557b(%rip), %rcx      # 0xb550
shlq $0x4, %rcx
movq %r15, -0x8(%rax,%rcx)
testq %r15, %r15
je 0x62f7
movq 0x5542(%rip), %rax      # 0xb530
movslq 0x555b(%rip), %rcx      # 0xb550
shlq $0x4, %rcx
movl %r14d, -0x10(%rax,%rcx)
movslq 0x554b(%rip), %rcx      # 0xb550
shlq $0x4, %rcx
movq -0x40(%rbp), %rdx
movl 0x4(%rax,%rdx), %edx
movl %edx, -0xc(%rax,%rcx)
movl -0x10(%r13), %ecx
movl %ecx, 0x4(%r15)
cmpl %r12d, -0x34(%rbp)
jg 0x6031
leal 0x1(%r12), %ecx
movl %ecx, (%r15)
movl %r12d, -0x10(%r13)
jmp 0x6038
movl -0x14(%r13), %ecx
movl %ecx, (%r15)
xorl %edi, %edi
movb -0x29(%rbp), %cl
movb %cl, %dil
movl -0xc(%r13), %ecx
movl %ecx, 0x8(%r15)
cmpl $0x2, %r14d
jl 0x6085
movl %r14d, %ecx
shlq $0x2, %rcx
leaq (%rcx,%rcx,2), %rcx
movl $0xc, %edx
movl -0x8(%r13), %esi
movl %esi, (%r15,%rdx)
movl -0x4(%r13), %esi
movl %esi, 0x4(%r15,%rdx)
movl (%r13), %esi
movl %esi, 0x8(%r15,%rdx)
addq $0xc, %rdx
addq $0xc, %r13
cmpq %rdx, %rcx
jne 0x605e
movl %edi, %ecx
subl %ebx, %ecx
movq -0x40(%rbp), %r14
movl %ecx, (%rax,%r14)
movslq (%r15), %rax
shlq $0x2, %rcx
leaq (%rcx,%rcx,2), %r12
movq -0x50(%rbp), %rsi
movslq -0x8(%rsi,%r12), %rcx
movq %rcx, %rdx
subq %rax, %rdx
addq %rdx, 0x54a6(%rip)      # 0xb558
movl (%rsi), %eax
subl %eax, %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x54ae(%rip), %xmm0     # 0xb570
movl %edi, %r13d
callq 0x1190
movsd 0xf36(%rip), %xmm1      # 0x7008
subsd %xmm0, %xmm1
addsd 0x54a2(%rip), %xmm1     # 0xb580
movq -0x48(%rbp), %rax
leaq (%rax,%rax,2), %rax
movl -0x8(%r15,%rax,4), %eax
subl (%r15), %eax
movsd %xmm1, 0x548a(%rip)     # 0xb580
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x546b(%rip), %xmm0     # 0xb570
callq 0x1190
movsd 0xef6(%rip), %xmm1      # 0x7008
subsd %xmm0, %xmm1
addsd 0x5462(%rip), %xmm1     # 0xb580
movsd %xmm1, 0x545a(%rip)     # 0xb580
movq 0x5403(%rip), %rbx      # 0xb530
movq 0x8(%rbx,%r14), %rdi
movq %r12, %rsi
callq 0x1170
movq %rax, 0x8(%rbx,%r14)
testq %rax, %rax
je 0x6308
testl %r13d, %r13d
je 0x62e5
movl (%r15), %ecx
movl %ecx, 0x542e(%rip)      # 0xb588
movl 0x5400(%rip), %eax      # 0xb560
xorl %ebx, %ebx
cmpl $0x2, %eax
jl 0x6190
movq 0x53da(%rip), %rdx      # 0xb548
leal -0x1(%rax), %esi
movslq %ebx, %rdi
leaq (%rdi,%rdi,2), %rdi
movslq 0x10(%rdx,%rdi,8), %rdi
leaq (%rdi,%rdi,2), %r8
cmpl (%rdx,%r8,8), %ecx
jl 0x618d
movl %edi, %ebx
decl %esi
jne 0x6171
movslq %ebx, %rbx
movq 0x53b1(%rip), %rdx      # 0xb548
leaq (%rbx,%rbx,2), %r14
cmpl (%rdx,%r14,8), %ecx
je 0x62e5
movl 0x3f55(%rip), %esi      # 0xa100
cmpl %esi, %eax
jb 0x6202
addl $0x50, %esi
movl %esi, 0x3f48(%rip)      # 0xa100
movq 0x5381(%rip), %rdi      # 0xb540
shlq $0x2, %rsi
callq 0x1170
movq %rax, 0x5371(%rip)      # 0xb540
testq %rax, %rax
je 0x633b
movq 0x5369(%rip), %rdi      # 0xb548
movl 0x3f1b(%rip), %eax      # 0xa100
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x1170
movq %rax, 0x534f(%rip)      # 0xb548
testq %rax, %rax
je 0x634c
movq 0x533f(%rip), %r15      # 0xb548
movl 0x10(%r15,%r14,8), %eax
movslq 0x534b(%rip), %rcx      # 0xb560
leaq (%rcx,%rcx,2), %rcx
movl %eax, 0x10(%r15,%rcx,8)
movl 0x533c(%rip), %eax      # 0xb560
movl %eax, 0x10(%r15,%r14,8)
movl 0x5359(%rip), %eax      # 0xb588
movslq 0x532a(%rip), %rcx      # 0xb560
leaq (%rcx,%rcx,2), %rcx
movl %eax, (%r15,%rcx,8)
movl -0x30(%rbp), %eax
addl %eax, %eax
movslq %eax, %rdi
movl $0x10, %esi
callq 0x1050
movslq 0x5309(%rip), %rcx      # 0xb560
leaq (%rcx,%rcx,2), %rcx
movq %rax, 0x8(%r15,%rcx,8)
testq %rax, %rax
je 0x632a
movq 0x52d0(%rip), %rax      # 0xb540
movl (%rax,%rbx,4), %ecx
movslq 0x52e6(%rip), %rdx      # 0xb560
movl %ecx, (%rax,%rdx,4)
movq 0x52c4(%rip), %rdx      # 0xb548
movq 0x8(%rdx,%r14,8), %rcx
movq %rcx, 0x5300(%rip)      # 0xb590
movslq 0x52c9(%rip), %rsi      # 0xb560
leaq (%rsi,%rsi,2), %rdi
movq 0x8(%rdx,%rdi,8), %rdx
movq %rdx, 0x52f1(%rip)      # 0xb598
incl %esi
movl %esi, 0x52b1(%rip)      # 0xb560
cmpl $0x0, (%rax,%rbx,4)
js 0x62e5
movq $-0x1, %rsi
movl $0x8, %edi
movl -0x8(%rcx,%rdi), %r8d
movl %r8d, -0x8(%rdx,%rdi)
movsd (%rcx,%rdi), %xmm0
movsd %xmm0, (%rdx,%rdi)
movslq (%rax,%rbx,4), %r8
incq %rsi
addq $0x10, %rdi
cmpq %r8, %rsi
jl 0x62c1
movl -0x38(%rbp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b5f(%rip), %rdi      # 0x7e5d
callq 0x1090
jmp 0x5fe7
leaq 0x1b60(%rip), %rdi      # 0x7e6f
callq 0x1090
jmp 0x6148
leaq 0x1b27(%rip), %rdi      # 0x7e47
callq 0x1090
jmp 0x5fb3
leaq 0x1b8f(%rip), %rdi      # 0x7ec0
callq 0x1090
jmp 0x6269
leaq 0x1b40(%rip), %rdi      # 0x7e82
callq 0x1090
jmp 0x61d8
leaq 0x1b4e(%rip), %rdi      # 0x7ea1
callq 0x1090
jmp 0x6202