// File: /workspace/github_cpp_makefile_star2_O2/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
leaq 0x20(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rsp, %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0xf01b6(%rip), %rdi     # 0xf16bc
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1040
leaq 0x40(%rsp), %rbp
leaq 0x38(%rsp), %r12
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x1589
leaq 0xf01bf(%rip), %rdi     # 0xf16ee
movq %r13, %rsi
xorl %eax, %eax
callq 0x1040
leaq 0xf2b78(%rip), %rdi     # 0xf40b8
callq 0x1e60
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x2d38
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x38(%rsp)
leaq 0xf0198(%rip), %rdi     # 0xf16fd
movb $0x2, %al
callq 0x1040
leaq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x2f12
movq %rsp, %rdi
movq %r12, %rsi
callq 0x2f12
incq %r13
jmp 0x1523
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
xorpd %xmm0, %xmm0
cmpq %rcx, %rax
je 0x15a6
addsd (%rax), %xmm0
addq $0x8, %rax
jmp 0x1597
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
xorpd %xmm1, %xmm1
cmpq %rcx, %rax
je 0x15c2
addsd (%rax), %xmm1
addq $0x8, %rax
jmp 0x15b3
movq %r15, %xmm2
movq 0xf0051(%rip), %xmm4    # 0xf1620
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movapd 0xf0055(%rip), %xmm5    # 0xf1630
subpd %xmm5, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addpd %xmm2, %xmm3
divsd %xmm3, %xmm0
movq %r14, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
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 0xf0028(%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 0xf00c0(%rip), %rdi     # 0xf171c
movb $0x4, %al
callq 0x1040
movq %rsp, %rdi
callq 0x309c
leaq 0x20(%rsp), %rdi
callq 0x309c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1686
movq %rax, %rbx
movq %rsp, %rdi
callq 0x309c
leaq 0x20(%rsp), %rdi
callq 0x309c
movq %rbx, %rdi
callq 0x1120