// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/khashlpp/./../common.c
// Function: main
int main(int argc, char *argv[])
{
	uint32_t test_int(uint32_t n, uint32_t x0);
	int c;
	double t, t0;
	uint32_t i, m = 5, max = 50000000, n = 10000000, x0 = 1, step;
	uint64_t sum;
	long m0;

	while ((c = getopt(argc, argv, "n:x:0:k:")) >= 0) {
		if (c == 'n') n = atol(optarg);
		else if (c == 'x') max = atol(optarg);
		else if (c == '0') x0 = atol(optarg);
		else if (c == 'k') m = atoi(optarg);
	}

	t = cputime();
	sum = traverse_rng(max, x0);
	t0 = cputime() - t;
	fprintf(stderr, "CPU time spent on RNG: %.3f sec; total sum: %lu\n", t0, (unsigned long)sum);
	m0 = peakrss();

	step = (max - n) / m;
	for (i = 0; i <= m; ++i, n += step) {
		double t, mem, tpm;
		uint32_t size;
		t = cputime();
		size = test_int(n, x0);
		t = cputime() - t;
		mem = peakrss() - m0;
		tpm = (t - t0 * n / max) / n * 1e6;
		printf("%d\t%d\t%.3f\t%.3f\t%.4f\t%.4f\n", i, n, t, mem/1024./1024., tpm, mem / size);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r13
movl %edi, %ebp
pushq $0x5
popq %rbx
movl $0x2faf080, %eax        # imm = 0x2FAF080
movq %rax, 0x8(%rsp)
movl $0x989680, %r14d        # imm = 0x989680
pushq $0x1
popq %rax
movq %rax, 0x18(%rsp)
leaq 0xda7(%rip), %r12       # 0x2020
movq 0x2d50(%rip), %r15      # 0x3fd0
movl %ebp, %edi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1040
testl %eax, %eax
js 0x12dc
cmpl $0x30, %eax
je 0x12b2
cmpl $0x6b, %eax
je 0x12c1
cmpl $0x78, %eax
je 0x12cd
cmpl $0x6e, %eax
jne 0x1280
movq (%r15), %rdi
callq 0x1080
movq %rax, %r14
jmp 0x1280
movq (%r15), %rdi
callq 0x1080
movq %rax, 0x18(%rsp)
jmp 0x1280
movq (%r15), %rdi
callq 0x10a0
movl %eax, %ebx
jmp 0x1280
movq (%r15), %rdi
callq 0x1080
movq %rax, 0x8(%rsp)
jmp 0x1280
callq 0x1412
movsd %xmm0, 0x10(%rsp)
movq 0x8(%rsp), %r15
movl %r15d, %edi
movq 0x18(%rsp), %rsi
callq 0x11cc
movq %rax, %r12
callq 0x1412
subsd 0x10(%rsp), %xmm0
movq 0x2cd2(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
leaq 0xd11(%rip), %rsi       # 0x2029
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdx
movb $0x1, %al
callq 0x1090
callq 0x1455
movq %rax, %r12
movl %r15d, %eax
subl %r14d, %eax
xorl %ebp, %ebp
xorl %edx, %edx
divl %ebx
movl %eax, %r13d
movl %r15d, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x20(%rsp)
cmpl %ebx, %ebp
ja 0x1401
callq 0x1412
movsd %xmm0, 0x8(%rsp)
movl %r14d, %edi
movq 0x18(%rsp), %rsi
callq 0x147b
movl %eax, %r15d
callq 0x1412
subsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x1455
subq %r12, %rax
cvtsi2sd %rax, %xmm3
movl %r14d, %eax
cvtsi2sd %rax, %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x20(%rsp), %xmm1
movsd 0x8(%rsp), %xmm4
movapd %xmm4, %xmm2
subsd %xmm1, %xmm2
divsd %xmm0, %xmm2
mulsd 0xc48(%rip), %xmm2      # 0x2008
movapd %xmm3, %xmm1
movsd 0xc44(%rip), %xmm0      # 0x2010
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movl %r15d, %eax
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm3
leaq 0xc73(%rip), %rdi       # 0x205a
movl %ebp, %esi
movl %r14d, %edx
movapd %xmm4, %xmm0
movb $0x4, %al
callq 0x1030
incl %ebp
addl %r13d, %r14d
jmp 0x134d
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq