// File: /workspace/github_c_makefile_star2_O0/genevalab[P]msmove/ms.c
// Function: main
int main(int argc, char *argv[])
{
	int i, k, howmany, segsites;
	int migflag;
	unsigned long int seed;
	double probss, tmrca, ttot;
	char **list, **tbsparamstrs;
	FILE *pf;

	ntbs = 0;
	tbsparamstrs = (char**)malloc((size_t)argc*sizeof(char*));

	for (i=0; i < argc; i++)
		printf("%s ", argv[i]);
	printf("\n");
	for (i=0; i < argc; i++)
		tbsparamstrs[i] = (char*)malloc(30*sizeof(char));
	for (i=1; i < argc; i++)
		if (strcmp(argv[i], "tbs") == 0)
			argv[i] = tbsparamstrs[ntbs++];

	count = 0;

	if (ntbs > 0)
		for (k = 0; k < ntbs; k++)
			scanf(" %s", tbsparamstrs[k]);
	getpars(argc, argv, &howmany);

	/* Initialize MT19937 rng from system clock */
	seed = (unsigned long int)time(0);
	init_genrand(seed);

	pf = stdout;
	fprintf(pf, "%ld\n", seed);

	if (pars.mp.segsitesin ==  0) 
	{
	     list = cmatrix(pars.cp.nsam, maxsites+1);
	     posit = (double*)malloc((size_t)maxsites*sizeof(double));
		 if (posit == NULL)
			 perror("Cannot allocate memory for posit");
	}
	else 
	{
	     list = cmatrix(pars.cp.nsam, pars.mp.segsitesin+1);
	     posit = (double*)malloc((size_t)pars.mp.segsitesin*sizeof(double));
		 if (posit == NULL)
			 perror("Cannot allocate memory for posit");
	     if (pars.mp.theta > 0) 
		 {
		    segfac = 1.0;
		    for (i=pars.mp.segsitesin; i > 1; i--)
				segfac *= i;
		 }
	}

	while (howmany-count++)
	{
		if ((ntbs > 0) && (count > 1)) 
		{
			for (k=0; k < ntbs; k++)
				if (scanf(" %s", tbsparamstrs[k]) == EOF)
					exit(EXIT_FAILURE);
			getpars(argc, argv, &howmany);
		}

		// generate coalescent history
		segsites = gensam(list, &probss, &tmrca, &ttot, &migflag);
		fprintf(pf, "\n//");
		if (migflag == 1)
			fprintf(pf, "*");
		if (ntbs > 0)
		{
			for (k=0; k < ntbs; k++)
				printf("\t%s", tbsparamstrs[k]);
		}
		printf("\n");
  		if (pars.mp.timeflag)
			fprintf(pf, "time:\t%lf\t%lf\n", tmrca, ttot);
        if ((segsites > 0) || (pars.mp.theta > 0))
		{
			if ((pars.mp.segsitesin > 0) && (pars.mp.theta > 0)) 
				fprintf(pf, "prob: %g\n", probss);
			fprintf(pf, "segsites: %d\n", segsites);
			if (segsites > 0)
				fprintf(pf, "positions: ");
			for (i=0; i < segsites; i++)
				fprintf(pf, "%6.4lf ", posit[i]);
			fprintf(pf, "\n");
			if (segsites > 0) 
				for (i=0; i < pars.cp.nsam; i++)
					fprintf(pf, "%s\n", list[i]); 
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, 0x9e78(%rip)      # 0xb118
movslq -0x8(%rbp), %rdi
shlq $0x3, %rdi
callq 0x10f0
movq %rax, -0x58(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x12e5
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x6ed9(%rip), %rdi      # 0x81ac
movb $0x0, %al
callq 0x1030
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x12b8
leaq 0x7787(%rip), %rdi      # 0x8a73
movb $0x0, %al
callq 0x1030
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x1326
movl $0x1e, %edi
callq 0x10f0
movq %rax, %rdx
movq -0x58(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x12fa
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x1387
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x6e68(%rip), %rsi      # 0x81b0
callq 0x1100
cmpl $0x0, %eax
jne 0x137a
movq -0x58(%rbp), %rax
movl 0x9dbc(%rip), %ecx      # 0xb118
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x9db1(%rip)      # 0xb118
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x137c
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x132d
movl $0x0, 0x9d8b(%rip)      # 0xb11c
cmpl $0x0, 0x9d80(%rip)      # 0xb118
jle 0x13d3
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl 0x9d6e(%rip), %eax      # 0xb118
jge 0x13d1
movq -0x58(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x6df5(%rip), %rdi      # 0x81b4
movb $0x0, %al
callq 0x10a0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x13a1
jmp 0x13d3
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x1770
xorl %eax, %eax
movl %eax, %edi
callq 0x1080
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4b30
movq 0x9bc8(%rip), %rax      # 0xafc8
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x6da2(%rip), %rsi      # 0x81b8
movb $0x0, %al
callq 0x1110
cmpl $0x0, 0x9d54(%rip)      # 0xb178
jne 0x1471
movl 0x9cf8(%rip), %edi      # 0xb124
movl 0x9c9e(%rip), %esi      # 0xb0d0
addl $0x1, %esi
callq 0x2c80
movq %rax, -0x50(%rbp)
movl 0x9c8c(%rip), %eax      # 0xb0d0
movl %eax, %edi
shlq $0x3, %rdi
callq 0x10f0
movq %rax, 0x9d32(%rip)      # 0xb188
cmpq $0x0, 0x9d2a(%rip)      # 0xb188
jne 0x146c
leaq 0x6d56(%rip), %rdi      # 0x81bd
callq 0x1070
jmp 0x150a
movl 0x9cad(%rip), %edi      # 0xb124
movl 0x9cfb(%rip), %esi      # 0xb178
addl $0x1, %esi
callq 0x2c80
movq %rax, -0x50(%rbp)
movslq 0x9ce8(%rip), %rdi      # 0xb178
shlq $0x3, %rdi
callq 0x10f0
movq %rax, 0x9ce8(%rip)      # 0xb188
cmpq $0x0, 0x9ce0(%rip)      # 0xb188
jne 0x14b6
leaq 0x6d0c(%rip), %rdi      # 0x81bd
callq 0x1070
movsd 0x9cb2(%rip), %xmm0     # 0xb170
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1508
movsd 0x6b39(%rip), %xmm0     # 0x8008
movsd %xmm0, 0x9cb9(%rip)     # 0xb190
movl 0x9c9b(%rip), %eax      # 0xb178
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x1506
cvtsi2sdl -0x14(%rbp), %xmm0
mulsd 0x9c9d(%rip), %xmm0     # 0xb190
movsd %xmm0, 0x9c95(%rip)     # 0xb190
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x14e0
jmp 0x1508
jmp 0x150a
jmp 0x150c
movl -0x1c(%rbp), %eax
movl 0x9c07(%rip), %ecx      # 0xb11c
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x9bfc(%rip)      # 0xb11c
subl %ecx, %eax
cmpl $0x0, %eax
je 0x1761
cmpl $0x0, 0x9be6(%rip)      # 0xb118
jle 0x1595
cmpl $0x1, 0x9be1(%rip)      # 0xb11c
jle 0x1595
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl 0x9bcb(%rip), %eax      # 0xb118
jge 0x1585
movq -0x58(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x6c52(%rip), %rdi      # 0x81b4
movb $0x0, %al
callq 0x10a0
cmpl $-0x1, %eax
jne 0x1578
movl $0x1, %edi
callq 0x10d0
jmp 0x157a
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1544
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x1770
movq -0x50(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x24(%rbp), %r8
callq 0x2d10
movl %eax, -0x20(%rbp)
movq -0x60(%rbp), %rdi
leaq 0x6c22(%rip), %rsi      # 0x81de
movb $0x0, %al
callq 0x1110
cmpl $0x1, -0x24(%rbp)
jne 0x15db
movq -0x60(%rbp), %rdi
leaq 0x6c0e(%rip), %rsi      # 0x81e2
movb $0x0, %al
callq 0x1110
cmpl $0x0, 0x9b36(%rip)      # 0xb118
jle 0x161d
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl 0x9b24(%rip), %eax      # 0xb118
jge 0x161b
movq -0x58(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x6bdb(%rip), %rdi      # 0x81e4
movb $0x0, %al
callq 0x1030
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x15eb
jmp 0x161d
leaq 0x744f(%rip), %rdi      # 0x8a73
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x9b4e(%rip)      # 0xb180
je 0x1650
movq -0x60(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
leaq 0x6b9f(%rip), %rsi      # 0x81e8
movb $0x2, %al
callq 0x1110
cmpl $0x0, -0x20(%rbp)
jg 0x166b
movsd 0x9b12(%rip), %xmm0     # 0xb170
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x175c
cmpl $0x0, 0x9b06(%rip)      # 0xb178
jle 0x169c
movsd 0x9af4(%rip), %xmm0     # 0xb170
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x169c
movq -0x60(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
leaq 0x6b62(%rip), %rsi      # 0x81f7
movb $0x1, %al
callq 0x1110
movq -0x60(%rbp), %rdi
movl -0x20(%rbp), %edx
leaq 0x6b57(%rip), %rsi      # 0x8201
movb $0x0, %al
callq 0x1110
cmpl $0x0, -0x20(%rbp)
jle 0x16c9
movq -0x60(%rbp), %rdi
leaq 0x6b4d(%rip), %rsi      # 0x820f
movb $0x0, %al
callq 0x1110
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x1705
movq -0x60(%rbp), %rdi
movq 0x9aa5(%rip), %rax      # 0xb188
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x6b28(%rip), %rsi      # 0x821b
movb $0x1, %al
callq 0x1110
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16d0
movq -0x60(%rbp), %rdi
leaq 0x7363(%rip), %rsi      # 0x8a73
movb $0x0, %al
callq 0x1110
cmpl $0x0, -0x20(%rbp)
jle 0x175a
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x99f7(%rip), %eax      # 0xb124
jge 0x1758
movq -0x60(%rbp), %rdi
movq -0x50(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x6c16(%rip), %rsi      # 0x835c
movb $0x0, %al
callq 0x1110
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1724
jmp 0x175a
jmp 0x175c
jmp 0x150c
xorl %eax, %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)