// File: /workspace/github_cpp_makefile_star2_O1/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 0xf02(%rip), %rdx       # 0x2020
callq 0x10d0
testl %eax, %eax
js 0x11b5
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 0x2e8b(%rip), %rbp      # 0x3fd8
leaq 0xecc(%rip), %rbx       # 0x2020
cmpl $0x30, %eax
je 0x1193
cmpl $0x6b, %eax
je 0x1176
cmpl $0x78, %eax
je 0x1185
cmpl $0x6e, %eax
jne 0x11a1
movq (%rbp), %rdi
callq 0x10b0
movq %rax, %r14
jmp 0x11a1
movq (%rbp), %rdi
callq 0x10e0
movl %eax, 0xc(%rsp)
jmp 0x11a1
movq (%rbp), %rdi
callq 0x10b0
movq %rax, %r15
jmp 0x11a1
movq (%rbp), %rdi
callq 0x10b0
movq %rax, 0x18(%rsp)
movl %r13d, %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10d0
testl %eax, %eax
jns 0x1154
jmp 0x11d0
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 0x10c0
movq 0x10(%r13), %rax
movq 0x18(%r13), %rcx
addq (%r13), %rax
cvtsi2sd %rax, %xmm0
addq 0x8(%r13), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xdeb(%rip), %xmm1      # 0x2008
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
leaq 0x28(%rsp), %r13
xorl %edi, %edi
movq %r13, %rsi
callq 0x10c0
movq 0x10(%r13), %rax
movq 0x18(%r13), %rcx
addq (%r13), %rax
cvtsi2sd %rax, %xmm1
addq 0x8(%r13), %rcx
cvtsi2sd %rcx, %xmm0
mulsd 0xdb0(%rip), %xmm0      # 0x2008
addsd %xmm1, %xmm0
subsd 0x10(%rsp), %xmm0
movq 0x2d8f(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xdb6(%rip), %rsi       # 0x2029
movq %rbx, %rdx
movb $0x1, %al
callq 0x1070
leaq 0x28(%rsp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x10c0
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 0x10c0
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
addq 0x28(%rsp), %rax
cvtsi2sd %rax, %xmm0
addq 0x30(%rsp), %rcx
cvtsi2sd %rcx, %xmm2
movsd 0xd2b(%rip), %xmm1      # 0x2008
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movl %r14d, %edi
movl %ebp, %esi
callq 0x13d4
movl %eax, %r15d
xorl %edi, %edi
movq %r13, %rsi
callq 0x10c0
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
addq 0x28(%rsp), %rax
cvtsi2sd %rax, %xmm0
addq 0x30(%rsp), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xce0(%rip), %xmm1      # 0x2008
addsd %xmm0, %xmm1
subsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x10(%rsp)
xorl %edi, %edi
movq %r13, %rsi
callq 0x10c0
movq 0x48(%rsp), %rax
subq 0x20(%rsp), %rax
shlq $0xa, %rax
cvtsi2sd %rax, %xmm1
movsd 0xcb3(%rip), %xmm0      # 0x2010
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movapd %xmm0, %xmm2
movl %r14d, %eax
cvtsi2sd %rax, %xmm5
movsd 0xc99(%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 0xcb8(%rip), %rdi       # 0x205a
movl %r12d, %esi
movl %r14d, %edx
movb $0x4, %al
callq 0x1040
incl %r12d
addl %ebx, %r14d
cmpl 0xc(%rsp), %r12d
jbe 0x12a8
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq