// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/wgsim.c
// Function: main
int main(int argc, char *argv[])
{
	int64_t N;
	int dist, std_dev, c, size_l, size_r, is_hap = 0;
	FILE *fpout1, *fpout2;
	int seed = -1;

	N = 1000000; dist = 500; std_dev = 50;
	size_l = size_r = 70;
	while ((c = getopt(argc, argv, "e:d:s:N:1:2:r:R:hX:S:")) >= 0) {
		switch (c) {
		case 'd': dist = atoi(optarg); break;
		case 's': std_dev = atoi(optarg); break;
		case 'N': N = atoi(optarg); break;
		case '1': size_l = atoi(optarg); break;
		case '2': size_r = atoi(optarg); break;
		case 'e': ERR_RATE = atof(optarg); break;
		case 'r': MUT_RATE = atof(optarg); break;
		case 'R': INDEL_FRAC = atof(optarg); break;
		case 'X': INDEL_EXTEND = atof(optarg); break;
		case 'S': seed = atoi(optarg); break;
		case 'h': is_hap = 1; break;
		}
	}
	if (argc - optind < 3) return simu_usage();
	fpout1 = fopen(argv[optind+1], "w");
	fpout2 = fopen(argv[optind+2], "w");
	if (!fpout1 || !fpout2) {
		fprintf(stderr, "[wgsim] file open error\n");
		return 1;
	}
	srand48(seed > 0? seed : time(0));
	wgsim_core(fpout1, fpout2, argv[optind], is_hap, N, dist, std_dev, size_l, size_r);

	fclose(fpout1); fclose(fpout2);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %r15d
leaq 0x99c(%rip), %rdx       # 0x32ec
callq 0x1180
testl %eax, %eax
js 0x2adb
movl $0x32, %ecx
movq %rcx, 0x20(%rsp)
movl $0x1f4, 0x8(%rsp)       # imm = 0x1F4
movl $0x46, %ecx
movq %rcx, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movl $0xf4240, %ecx          # imm = 0xF4240
movq %rcx, 0x18(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x2641(%rip), %r13      # 0x4fd8
leaq 0x94e(%rip), %r12       # 0x32ec
movl $0x46, %r14d
cmpl $0x57, %eax
jle 0x29df
cmpl $0x67, %eax
jg 0x2a0b
cmpl $0x58, %eax
je 0x2aa8
cmpl $0x64, %eax
je 0x2a74
cmpl $0x65, %eax
jne 0x2ac3
movq (%r13), %rdi
callq 0x1070
movsd %xmm0, 0x273e(%rip)     # 0x5118
jmp 0x2ac3
cmpl $0x4d, %eax
jle 0x2a35
cmpl $0x4e, %eax
je 0x2a96
cmpl $0x52, %eax
je 0x2a61
cmpl $0x53, %eax
jne 0x2ac3
movq (%r13), %rdi
callq 0x1190
movl %eax, %ebp
jmp 0x2ac3
cmpl $0x68, %eax
je 0x2abb
cmpl $0x72, %eax
je 0x2a83
cmpl $0x73, %eax
jne 0x2ac3
movq (%r13), %rdi
callq 0x1190
movq %rax, 0x20(%rsp)
jmp 0x2ac3
cmpl $0x31, %eax
je 0x2a53
cmpl $0x32, %eax
jne 0x2ac3
movq (%r13), %rdi
callq 0x1190
movq %rax, 0x10(%rsp)
jmp 0x2ac3
movq (%r13), %rdi
callq 0x1190
movl %eax, %r14d
jmp 0x2ac3
movq (%r13), %rdi
callq 0x1070
movsd %xmm0, 0x269e(%rip)     # 0x5110
jmp 0x2ac3
movq (%r13), %rdi
callq 0x1190
movl %eax, 0x8(%rsp)
jmp 0x2ac3
movq (%r13), %rdi
callq 0x1070
movsd %xmm0, 0x2674(%rip)     # 0x5108
jmp 0x2ac3
movq (%r13), %rdi
callq 0x1190
cltq
movq %rax, 0x18(%rsp)
jmp 0x2ac3
movq (%r13), %rdi
callq 0x1070
movsd %xmm0, 0x2647(%rip)     # 0x5100
jmp 0x2ac3
movl $0x1, 0xc(%rsp)
movl %r15d, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1180
testl %eax, %eax
jns 0x29a4
jmp 0x2b14
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xf4240, %eax          # imm = 0xF4240
movq %rax, 0x18(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x46, %r14d
movl $0x1f4, 0x8(%rsp)       # imm = 0x1F4
movl $0x32, %eax
movq %rax, 0x20(%rsp)
movl $0x46, %eax
movq %rax, 0x10(%rsp)
movq 0x24b5(%rip), %r13      # 0x4fd0
movslq (%r13), %rax
subl %eax, %r15d
cmpl $0x2, %r15d
jg 0x2b2f
callq 0x1c07
jmp 0x2b71
movq 0x8(%rbx,%rax,8), %rdi
leaq 0x7c7(%rip), %r12       # 0x3302
movq %r12, %rsi
callq 0x1170
movq %rax, %r15
movslq (%r13), %rax
movq 0x10(%rbx,%rax,8), %rdi
movq %r12, %rsi
callq 0x1170
testq %r15, %r15
je 0x2b6c
movq %rax, %r12
testq %rax, %rax
je 0x2b6c
testl %ebp, %ebp
jle 0x2b78
movl %ebp, %edi
jmp 0x2b82
callq 0x1beb
movl $0x1, %eax
jmp 0x2bcc
xorl %edi, %edi
callq 0x1120
movq %rax, %rdi
callq 0x1150
movslq (%r13), %rax
movq (%rbx,%rax,8), %rdx
subq $0x8, %rsp
movq %r15, %rdi
movq %r12, %rsi
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %r8
movl 0x10(%rsp), %r9d
pushq 0x18(%rsp)
pushq %r14
pushq 0x38(%rsp)
callq 0x11f0
addq $0x20, %rsp
movq %r15, %rdi
callq 0x1080
movq %r12, %rdi
callq 0x1080
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq