// File: /workspace/github_cpp_makefile_star2_O1/wx-csy[P]librmq/main.cpp
// Function: void performance_test<librmq::rmq_zkw>(unsigned long, unsigned long, unsigned long)
void performance_test(size_t size, size_t nq, size_t rep = 10) {
    std::vector<double> tprep, tq;
    printf("Testing size = %zu nq = %zu with %zu repititions\n", size, nq, rep);
    for (size_t i = 0; i < rep; i++) {
        printf("Round %zu ... ", i); 
        double ttprep, ttq;
        std::tie(ttprep, ttq) = performance_test_instance<TSolver<int>>(size, nq, gen());
        printf("tprep = %.6fs, tquery = %.6fs\n", ttprep, ttq);
        tprep.push_back(ttprep); tq.push_back(ttq);
    }
    double atprep, atq;
    atprep = std::accumulate(tprep.begin(), tprep.end(), 0.0) / rep;
    atq = std::accumulate(tq.begin(), tq.end(), 0.0) / rep;
    printf("tprep = %.6fs, tquery = %.6fs, MQPS = %.6f, ctp/ctq = %.6f\n", 
        atprep, atq, nq / 1000000.0 / atq, atprep / atq / size * nq);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movq %rax, 0x10(%rsp)
movapd %xmm0, (%rsp)
leaq 0xf00eb(%rip), %rdi     # 0xf171c
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1040
testq %r15, %r15
je 0x1701
leaq 0xf2a5f(%rip), %r13     # 0xf40b0
leaq 0xf0105(%rip), %rbp     # 0xf175d
xorl %r12d, %r12d
leaq 0xf00ec(%rip), %rdi     # 0xf174e
movq %r12, %rsi
xorl %eax, %eax
callq 0x1040
movq %r13, %rdi
callq 0x2204
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x3421
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x38(%rsp)
movq %rbp, %rdi
movb $0x2, %al
callq 0x1040
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x16b8
movsd 0x40(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x16c7
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x362c
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x16e8
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x16f5
movq %rsp, %rdi
leaq 0x38(%rsp), %rdx
callq 0x362c
incq %r12
cmpq %r12, %r15
jne 0x165b
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
cmpq %rcx, %rax
je 0x1722
addsd (%rax), %xmm0
addq $0x8, %rax
jmp 0x1713
movq %r15, %xmm2
punpckldq 0xefef1(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0xefef9(%rip), %xmm2    # 0xf1630
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
divsd %xmm3, %xmm0
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
je 0x1766
xorpd %xmm1, %xmm1
addsd (%rax), %xmm1
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x1759
movq %r14, %xmm2
movq 0xefead(%rip), %xmm4    # 0xf1620
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movapd 0xefeb1(%rip), %xmm5    # 0xf1630
subpd %xmm5, %xmm2
movapd %xmm2, %xmm6
unpckhpd %xmm2, %xmm6            # xmm6 = xmm6[1],xmm2[1]
addpd %xmm2, %xmm6
movapd %xmm6, %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
movapd 0xefea1(%rip), %xmm1    # 0xf1640
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
divpd %xmm1, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
divsd %xmm1, %xmm2
movapd %xmm0, %xmm3
divsd %xmm1, %xmm3
movq %rbx, %xmm7
punpckldq %xmm4, %xmm7    # xmm7 = xmm7[0],xmm4[0],xmm7[1],xmm4[1]
subpd %xmm5, %xmm7
movapd %xmm7, %xmm4
unpckhpd %xmm7, %xmm4            # xmm4 = xmm4[1],xmm7[1]
addsd %xmm7, %xmm4
divsd %xmm4, %xmm3
mulsd %xmm6, %xmm3
leaq 0xeff99(%rip), %rdi     # 0xf177c
movb $0x4, %al
callq 0x1040
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1800
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1817
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1828
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1841
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1858
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1110