// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movl %edx, %r15d
movq 0x55d7(%rip), %rax      # 0xb530
movl %esi, -0x3c(%rbp)
movslq %esi, %rcx
shlq $0x4, %rcx
movslq (%rax,%rcx), %r14
movq %rcx, -0x48(%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 0x55e7(%rip), %xmm0     # 0xb570
callq 0x1190
movsd 0x1072(%rip), %xmm1     # 0x7008
subsd %xmm0, %xmm1
movsd 0x55de(%rip), %xmm0     # 0xb580
subsd %xmm1, %xmm0
movsd %xmm0, 0x55d2(%rip)     # 0xb580
movq %rbx, -0x58(%rbp)
addq $0x8, %rbx
movl $0x1, %r13d
movq %rbx, %rax
addq $0xc, %rbx
decl %r13d
cmpl %r15d, -0x4(%rax)
jle 0x5fbc
movl -0x14(%rbx), %eax
movl %eax, -0x38(%rbp)
cmpl %r15d, %eax
setle -0x29(%rbp)
leal (%r14,%r13), %ecx
movl 0x556d(%rip), %eax      # 0xb550
incl %eax
movl %eax, 0x5565(%rip)      # 0xb550
movl 0x5547(%rip), %esi      # 0xb538
movq 0x5538(%rip), %r14      # 0xb530
cmpl %esi, %eax
jb 0x602a
addl $0x14, %esi
movl %esi, 0x5533(%rip)      # 0xb538
shlq $0x4, %rsi
movq %r14, %rdi
movl %ecx, %r12d
callq 0x1170
movl %r12d, %ecx
movq %rax, %r14
movq %rax, 0x550f(%rip)      # 0xb530
testq %rax, %rax
je 0x6369
movl %ecx, -0x34(%rbp)
movslq %ecx, %rdi
movl $0xc, %esi
movq %rdi, -0x50(%rbp)
callq 0x1050
movq %rax, %r12
movslq 0x5508(%rip), %rax      # 0xb550
movq %rax, %rcx
shlq $0x4, %rcx
movq %r12, -0x8(%r14,%rcx)
testq %r12, %r12
je 0x6339
shlq $0x4, %rax
movl -0x34(%rbp), %edx
movl %edx, -0x10(%r14,%rax)
movslq 0x54e0(%rip), %rax      # 0xb550
shlq $0x4, %rax
movq -0x48(%rbp), %rcx
movl 0x4(%r14,%rcx), %ecx
movl %ecx, -0xc(%r14,%rax)
movl -0x10(%rbx), %eax
movl %eax, 0x4(%r12)
cmpl %r15d, -0x38(%rbp)
movl %edx, %ecx
jg 0x609b
movl %r15d, -0x10(%rbx)
incl %r15d
jmp 0x609f
movl -0x14(%rbx), %r15d
xorl %esi, %esi
movb -0x29(%rbp), %al
movb %al, %sil
movl %r15d, (%r12)
movl -0xc(%rbx), %eax
movl %eax, 0x8(%r12)
cmpl $0x2, %ecx
jl 0x60ea
movl %ecx, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rax
movl $0xc, %ecx
movl -0x8(%rbx), %edx
movl %edx, (%r12,%rcx)
movl -0x4(%rbx), %edx
movl %edx, 0x4(%r12,%rcx)
movl (%rbx), %edx
movl %edx, 0x8(%r12,%rcx)
addq $0xc, %rcx
addq $0xc, %rbx
cmpq %rcx, %rax
jne 0x60c7
movl %esi, %eax
subl %r13d, %eax
movq -0x48(%rbp), %r13
movl %eax, (%r14,%r13)
shlq $0x2, %rax
leaq (%rax,%rax,2), %r14
movq -0x58(%rbp), %rdx
movl -0x8(%rdx,%r14), %eax
subl %eax, %r15d
movslq %r15d, %rcx
subq %rcx, 0x5443(%rip)      # 0xb558
subl (%rdx), %eax
cvtsi2sd %eax, %xmm1
movsd 0x544d(%rip), %xmm0     # 0xb570
movl %esi, %r15d
callq 0x1190
movsd 0xed5(%rip), %xmm1      # 0x7008
subsd %xmm0, %xmm1
addsd 0x5441(%rip), %xmm1     # 0xb580
movq -0x50(%rbp), %rax
leaq (%rax,%rax,2), %rax
movl -0x8(%r12,%rax,4), %eax
subl (%r12), %eax
movsd %xmm1, 0x5428(%rip)     # 0xb580
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x5409(%rip), %xmm0     # 0xb570
callq 0x1190
movsd 0xe94(%rip), %xmm1      # 0x7008
subsd %xmm0, %xmm1
addsd 0x5400(%rip), %xmm1     # 0xb580
movsd %xmm1, 0x53f8(%rip)     # 0xb580
movq 0x53a1(%rip), %rbx      # 0xb530
movq 0x8(%rbx,%r13), %rdi
movq %r14, %rsi
callq 0x1170
movq %rax, 0x8(%rbx,%r13)
testq %rax, %rax
je 0x6358
testl %r15d, %r15d
je 0x6327
movl (%r12), %ecx
movl %ecx, 0x53cb(%rip)      # 0xb588
movl 0x539d(%rip), %eax      # 0xb560
xorl %ebx, %ebx
movq 0x537c(%rip), %r15      # 0xb548
cmpl $0x2, %eax
jl 0x61f3
leal -0x1(%rax), %edx
movslq %ebx, %rsi
leaq (%rsi,%rsi,2), %rsi
movslq 0x10(%r15,%rsi,8), %rsi
leaq (%rsi,%rsi,2), %rdi
cmpl (%r15,%rdi,8), %ecx
jl 0x61f0
movl %esi, %ebx
decl %edx
jne 0x61d4
movslq %ebx, %rbx
leaq (%rbx,%rbx,2), %r14
cmpl (%r15,%r14,8), %ecx
je 0x6327
movl 0x3ef8(%rip), %r12d     # 0xa100
cmpl %r12d, %eax
jb 0x625f
addl $0x50, %r12d
movl %r12d, 0x3ee8(%rip)     # 0xa100
movq 0x5321(%rip), %rdi      # 0xb540
leaq (,%r12,4), %rsi
callq 0x1170
movq %rax, 0x530d(%rip)      # 0xb540
testq %rax, %rax
je 0x63a3
shlq $0x3, %r12
leaq (%r12,%r12,2), %rsi
movq %r15, %rdi
callq 0x1170
movq %rax, %r15
movq %rax, 0x52f2(%rip)      # 0xb548
testq %rax, %rax
je 0x63c2
movl 0x10(%r15,%r14,8), %eax
movslq 0x52f5(%rip), %rcx      # 0xb560
leaq (%rcx,%rcx,2), %rcx
movl %eax, 0x10(%r15,%rcx,8)
movslq 0x52e5(%rip), %rax      # 0xb560
movl %eax, 0x10(%r15,%r14,8)
movl 0x5302(%rip), %ecx      # 0xb588
leaq (%rax,%rax,2), %rax
movl %ecx, (%r15,%rax,8)
movl -0x30(%rbp), %eax
addl %eax, %eax
movslq %eax, %rdi
movl $0x10, %esi
callq 0x1050
movslq 0x52b9(%rip), %rcx      # 0xb560
leaq (%rcx,%rcx,2), %rdx
movq %rax, 0x8(%r15,%rdx,8)
testq %rax, %rax
je 0x6384
movq 0x5280(%rip), %rax      # 0xb540
movl (%rax,%rbx,4), %edx
movl %edx, (%rax,%rcx,4)
movq 0x8(%r15,%r14,8), %rcx
movq %rcx, 0x52be(%rip)      # 0xb590
movslq 0x5287(%rip), %rsi      # 0xb560
leaq (%rsi,%rsi,2), %rdx
movq 0x8(%r15,%rdx,8), %rdx
movq %rdx, 0x52af(%rip)      # 0xb598
incl %esi
movl %esi, 0x526f(%rip)      # 0xb560
cmpl $0x0, (%rax,%rbx,4)
js 0x6327
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 0x6303
movl -0x3c(%rbp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b1d(%rip), %rdi      # 0x7e5d
callq 0x1090
movq 0x51e4(%rip), %r14      # 0xb530
movslq 0x51fd(%rip), %rax      # 0xb550
jmp 0x605d
leaq 0x1b10(%rip), %rdi      # 0x7e6f
callq 0x1090
jmp 0x61aa
leaq 0x1ad7(%rip), %rdi      # 0x7e47
callq 0x1090
movl %r12d, %ecx
movq 0x51b1(%rip), %r14      # 0xb530
jmp 0x602a
leaq 0x1b35(%rip), %rdi      # 0x7ec0
callq 0x1090
movslq 0x51c9(%rip), %rcx      # 0xb560
movq 0x51aa(%rip), %r15      # 0xb548
jmp 0x62b9
leaq 0x1ad8(%rip), %rdi      # 0x7e82
callq 0x1090
movq 0x5192(%rip), %r15      # 0xb548
movl 0x3d43(%rip), %r12d     # 0xa100
jmp 0x623c
leaq 0x1ad8(%rip), %rdi      # 0x7ea1
callq 0x1090
movq 0x5173(%rip), %r15      # 0xb548
jmp 0x625f