// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/khashl/./../common-block.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(n, 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;
		uint32_t size;
		t = cputime();
		size = test_int(n, x0);
		t = cputime() - t;
		mem = (peakrss() - m0) / 1024.0 / 1024.0;
		printf("%d\t%d\t%.3f\t%.3f\t%.4f\t%.4f\n", i, n, t, mem, t * 1e6 / n, mem * 1e6 / size);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r12
movl %edi, %r13d
leaq 0xf12(%rip), %rdx       # 0x2020
callq 0x10c0
testl %eax, %eax
js 0x11a5
pushq $0x1
popq %rcx
movq %rcx, 0x18(%rsp)
movl $0x989680, %r14d        # imm = 0x989680
movl $0x2faf080, %r15d       # imm = 0x2FAF080
pushq $0x5
popq %rcx
movl %ecx, 0xc(%rsp)
movq 0x2e9b(%rip), %rbp      # 0x3fd8
leaq 0xedc(%rip), %rbx       # 0x2020
cmpl $0x30, %eax
je 0x1183
cmpl $0x6b, %eax
je 0x1166
cmpl $0x78, %eax
je 0x1175
cmpl $0x6e, %eax
jne 0x1191
movq (%rbp), %rdi
callq 0x10a0
movq %rax, %r14
jmp 0x1191
movq (%rbp), %rdi
callq 0x10d0
movl %eax, 0xc(%rsp)
jmp 0x1191
movq (%rbp), %rdi
callq 0x10a0
movq %rax, %r15
jmp 0x1191
movq (%rbp), %rdi
callq 0x10a0
movq %rax, 0x18(%rsp)
movl %r13d, %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10c0
testl %eax, %eax
jns 0x1144
jmp 0x11c0
pushq $0x5
popq %rax
movl %eax, 0xc(%rsp)
movl $0x2faf080, %r15d       # imm = 0x2FAF080
movl $0x989680, %r14d        # imm = 0x989680
pushq $0x1
popq %rax
movq %rax, 0x18(%rsp)
leal -0x1(%r14), %eax
shlq $0x4, %rax
addq $0x10, %rax
xorl %r12d, %r12d
cmpl $0x1, %r14d
movl $0x0, %ebx
cmovaeq %rax, %rbx
leaq 0x28(%rsp), %r13
xorl %edi, %edi
movq %r13, %rsi
callq 0x10b0
movq 0x10(%r13), %rax
movq 0x18(%r13), %rcx
addq (%r13), %rax
cvtsi2sd %rax, %xmm0
addq 0x8(%r13), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xdfb(%rip), %xmm1      # 0x2008
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
leaq 0x28(%rsp), %r13
xorl %edi, %edi
movq %r13, %rsi
callq 0x10b0
movq 0x10(%r13), %rax
movq 0x18(%r13), %rcx
addq (%r13), %rax
cvtsi2sd %rax, %xmm1
addq 0x8(%r13), %rcx
cvtsi2sd %rcx, %xmm0
mulsd 0xdc0(%rip), %xmm0      # 0x2008
addsd %xmm1, %xmm0
subsd 0x10(%rsp), %xmm0
movq 0x2d9f(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xdc6(%rip), %rsi       # 0x2029
movq %rbx, %rdx
movb $0x1, %al
callq 0x1060
leaq 0x28(%rsp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x10b0
movq 0x20(%rbx), %rax
movq %rax, 0x20(%rsp)
subl %r14d, %r15d
movl %r15d, %eax
xorl %edx, %edx
divl 0xc(%rsp)
movl %eax, %ebx
movq 0x18(%rsp), %rbp
xorl %edi, %edi
leaq 0x28(%rsp), %r13
movq %r13, %rsi
callq 0x10b0
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
addq 0x28(%rsp), %rax
cvtsi2sd %rax, %xmm0
addq 0x30(%rsp), %rcx
cvtsi2sd %rcx, %xmm2
movsd 0xd3b(%rip), %xmm1      # 0x2008
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movl %r14d, %edi
movl %ebp, %esi
callq 0x13c4
movl %eax, %r15d
xorl %edi, %edi
movq %r13, %rsi
callq 0x10b0
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
addq 0x28(%rsp), %rax
cvtsi2sd %rax, %xmm0
addq 0x30(%rsp), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xcf0(%rip), %xmm1      # 0x2008
addsd %xmm0, %xmm1
subsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x10(%rsp)
xorl %edi, %edi
movq %r13, %rsi
callq 0x10b0
movq 0x48(%rsp), %rax
subq 0x20(%rsp), %rax
shlq $0xa, %rax
cvtsi2sd %rax, %xmm1
movsd 0xcc3(%rip), %xmm0      # 0x2010
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movapd %xmm0, %xmm2
movl %r14d, %eax
cvtsi2sd %rax, %xmm5
movsd 0xca9(%rip), %xmm4      # 0x2018
mulsd %xmm4, %xmm2
divsd %xmm5, %xmm2
movapd %xmm1, %xmm3
mulsd %xmm4, %xmm3
movl %r15d, %eax
cvtsi2sd %rax, %xmm4
divsd %xmm4, %xmm3
leaq 0xcc8(%rip), %rdi       # 0x205a
movl %r12d, %esi
movl %r14d, %edx
movb $0x4, %al
callq 0x1040
incl %r12d
addl %ebx, %r14d
cmpl 0xc(%rsp), %r12d
jbe 0x1298
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq