// File: /workspace/github_c_makefile_star2_O0/genevalab[P]msmove/streec.c
// Function: cinr
int cinr(int nsam, int nsites)
{
	int len, el, lsg, lsgm1, ic, is, endic;
	int spot = (int)(nlinks * genrand_real3()) + 1;
	struct seg *pseg;
	
	for (ic=0; ic < nchrom; ic++)
	{
		lsg = chrom[ic].nseg;
		lsgm1 = lsg-1;
		pseg = chrom[ic].pseg;
		el = ((pseg+lsgm1)->end)-(pseg->beg);
		if (spot <= el)
			break;
		spot -= el;
	}
	is = pseg->beg+spot-1;
	endic = (pseg+lsgm1)->end;
	xover(nsam, ic, is);
	len = (int)floor(1.0+log(genrand_real3())/lnpc);
	if (is+len >= endic)
		return ic;  
	if (is+len < (chrom[nchrom-1].pseg)->beg)
	{
		ca(nsam, nsites, ic, nchrom-1);
		return -1;
	}
	xover(nsam, nchrom-1, is+len);
	ca(nsam, nsites, ic, nchrom-1);
	return ic;	

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cvtsi2sdq 0x5b01(%rip), %xmm0 # 0xc558
movsd %xmm0, -0x40(%rbp)
callq 0x4ee0
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl 0x5ac9(%rip), %eax      # 0xc550
jge 0x6afe
movq 0x5aa0(%rip), %rax      # 0xc530
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq 0x5a80(%rip), %rax      # 0xc530
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x38(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x6ae8
jmp 0x6afe
movl -0x14(%rbp), %ecx
movl -0x2c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x6a7e
movq -0x38(%rbp), %rax
movl (%rax), %eax
addl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x8(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x7390
callq 0x4ee0
callq 0x1060
movaps %xmm0, %xmm1
divsd 0x5a33(%rip), %xmm1     # 0xc578
movsd 0x14bb(%rip), %xmm0     # 0x8008
addsd %xmm1, %xmm0
callq 0x1140
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl -0x10(%rbp), %eax
cmpl -0x28(%rbp), %eax
jl 0x6b70
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6bec
movl -0x24(%rbp), %eax
addl -0x10(%rbp), %eax
movq 0x59b3(%rip), %rcx      # 0xc530
movl 0x59cd(%rip), %edx      # 0xc550
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
cmpl (%rcx), %eax
jge 0x6bb8
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x20(%rbp), %edx
movl 0x59a9(%rip), %ecx      # 0xc550
subl $0x1, %ecx
callq 0x6d30
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6bec
movl -0x8(%rbp), %edi
movl 0x598f(%rip), %esi      # 0xc550
subl $0x1, %esi
movl -0x24(%rbp), %edx
addl -0x10(%rbp), %edx
callq 0x7390
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x20(%rbp), %edx
movl 0x5972(%rip), %ecx      # 0xc550
subl $0x1, %ecx
callq 0x6d30
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)