// File: lemire[P]fastscancount/benchmark/counters.cpp
// Function: demo_data(std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>> const&, std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>> const&, unsigned long)
void demo_data(const std::vector<std::vector<uint32_t>>& data,
              const std::vector<std::vector<uint32_t>>& queries,
              size_t threshold) {
  size_t N = 0;
  for (const auto& data_elem : data) {
    size_t sz = data_elem.size();
    if (sz) {
      N = std::max(N, (size_t)data_elem[sz-1] + 1);
    }
  }

  std::vector<uint32_t> answer;
  answer.reserve(N);

  std::vector<int> evts = {
#ifdef __linux__
                           PERF_COUNT_HW_CPU_CYCLES,
                           PERF_COUNT_HW_INSTRUCTIONS,
                           PERF_COUNT_HW_BRANCH_MISSES,
                           PERF_COUNT_HW_CACHE_REFERENCES,
                           PERF_COUNT_HW_CACHE_MISSES
#endif
                          }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x560, %rsp            # imm = 0x560
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x7e50
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x7e80
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x7eb0
testb $0x1, %al
jne 0x42a4
jmp 0x4301
leaq -0x30(%rbp), %rdi
callq 0x7ef0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x7a40
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x42f4
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
subq $0x1, %rsi
callq 0x7a20
movl (%rax), %eax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7fb0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x42f6
leaq -0x30(%rbp), %rdi
callq 0x7f50
jmp 0x4291
leaq -0x68(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x7ff0
movq -0x478(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x8010
jmp 0x4323
movups 0x1013a(%rip), %xmm0    # 0x14464
movaps %xmm0, -0xc0(%rbp)
movl $0x3, -0xb0(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $0x5, -0x98(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x480(%rbp)
callq 0x8110
movq -0x480(%rbp), %rcx
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x8130
jmp 0x438a
leaq -0xc1(%rbp), %rdi
callq 0x81b0
leaq -0x150(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x81d0
jmp 0x43ab
leaq -0x138(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x82c0
jmp 0x43c0
leaq -0x150(%rbp), %rdi
callq 0x8490
leaq -0x168(%rbp), %rdi
movq %rdi, -0x488(%rbp)
callq 0x84f0
movq -0x488(%rbp), %rsi
movq -0x8(%rbp), %rdi
movl $0x9c40, %edx           # imm = 0x9C40
callq 0x40e0
jmp 0x43f6
leaq -0x180(%rbp), %rdi
callq 0x8510
leaq -0x198(%rbp), %rdi
callq 0x8510
xorps %xmm0, %xmm0
movss %xmm0, -0x19c(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1a0(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1a4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1a8(%rbp)
movq $0x0, -0x1b0(%rbp)
movq $0x0, -0x1b8(%rbp)
movq -0x1b8(%rbp), %rax
movq %rax, -0x490(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7e20
movq %rax, %rcx
movq -0x490(%rbp), %rax
cmpq %rcx, %rax
jae 0x4bb6
movq -0x10(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
callq 0x7f70
movq %rax, -0x1c0(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x8530
leaq -0x198(%rbp), %rdi
callq 0x8530
movq $0x0, -0x1c8(%rbp)
movq -0x1c0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rdi
callq 0x8550
movq %rax, -0x1d8(%rbp)
movq -0x1d0(%rbp), %rdi
callq 0x8580
movq %rax, -0x1e0(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x85b0
testb $0x1, %al
jne 0x4504
jmp 0x47d5
leaq -0x1d8(%rbp), %rdi
callq 0x85f0
movl (%rax), %eax
movl %eax, -0x1e4(%rbp)
movl -0x1e4(%rbp), %eax
movq %rax, -0x498(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7e20
movq %rax, %rcx
movq -0x498(%rbp), %rax
cmpq %rcx, %rax
jb 0x4738
leaq -0x370(%rbp), %rdi
callq 0x31e0
jmp 0x454f
leaq -0x360(%rbp), %rdi
leaq 0xfaf6(%rip), %rsi      # 0x14053
callq 0x3280
movq %rax, -0x4a0(%rbp)
jmp 0x456b
movq -0x4a0(%rbp), %rdi
movl -0x1e4(%rbp), %esi
callq 0x3340
movq %rax, -0x4a8(%rbp)
jmp 0x4586
movq -0x4a8(%rbp), %rdi
leaq 0xfadb(%rip), %rsi      # 0x1406f
callq 0x3280
movq %rax, -0x4b0(%rbp)
jmp 0x45a2
movq -0x8(%rbp), %rdi
callq 0x7e20
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
callq 0x3090
movq %rax, -0x4b8(%rbp)
jmp 0x45c3
movq -0x4b8(%rbp), %rdi
leaq 0xfab4(%rip), %rsi      # 0x14085
callq 0x3280
movq %rax, -0x4c0(%rbp)
jmp 0x45df
movq -0x4c0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
callq 0x3090
jmp 0x45f4
movb $0x1, -0x391(%rbp)
movl $0x10, %edi
callq 0x3160
movq %rax, -0x4c8(%rbp)
leaq -0x390(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x3270
jmp 0x4621
movq -0x4c8(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3410
jmp 0x4636
movq -0x4c8(%rbp), %rdi
movb $0x0, -0x391(%rbp)
movq 0x199a5(%rip), %rsi     # 0x1dff0
movq 0x19966(%rip), %rdx     # 0x1dfb8
callq 0x3450
jmp 0x4d9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4d89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc1(%rbp), %rdi
callq 0x81b0
jmp 0x4d89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4d7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x8490
jmp 0x4d7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4d65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4d4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4727
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x470e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x390(%rbp), %rdi
callq 0x31b0
testb $0x1, -0x391(%rbp)
jne 0x4719
jmp 0x4725
movq -0x4c8(%rbp), %rdi
callq 0x3200
jmp 0x4727
leaq -0x370(%rbp), %rdi
callq 0x3210
jmp 0x4d4d
movq -0x8(%rbp), %rdi
movl -0x1e4(%rbp), %eax
movl %eax, %esi
callq 0x7f70
movq %rax, %rdi
callq 0x7a40
movq %rax, %rcx
movq -0x1c8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x1c8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1e4(%rbp), %eax
movl %eax, %esi
callq 0x7f70
movq %rax, -0x3a0(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x8610
jmp 0x4792
movl -0x1e4(%rbp), %eax
movl %eax, %esi
leaq -0x168(%rbp), %rdi
callq 0x7f90
movq %rax, -0x3a8(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x8610
jmp 0x47c2
jmp 0x47c4
leaq -0x1d8(%rbp), %rdi
callq 0x8640
jmp 0x44e8
movq -0x1c8(%rbp), %rcx
movq -0x1b0(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x1b0(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x180(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3d00
jmp 0x4803
leaq -0x68(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x7a40
movq %rax, %rcx
movq -0x4e0(%rbp), %rax
movq %rcx, -0x3b0(%rbp)
leaq -0x180(%rbp), %rcx
movq %rcx, -0x3c8(%rbp)
movq %rax, -0x3c0(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x3b8(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x4d4(%rbp)
leaq -0x3e9(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x3480
movq -0x4d0(%rbp), %rdx
leaq 0xf822(%rip), %rsi      # 0x14090
leaq -0x3e8(%rbp), %rdi
callq 0x8660
jmp 0x487c
movl -0x4d4(%rbp), %edx
movq -0x3b8(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movups -0x3c8(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x180(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x3e8(%rbp), %rcx
callq 0x4da0
jmp 0x48b3
leaq -0x3e8(%rbp), %rdi
callq 0x31b0
leaq -0x3e9(%rbp), %rdi
callq 0x32e0
movq 0x196f6(%rip), %rdi     # 0x1dfc8
leaq 0xf7c5(%rip), %rsi      # 0x1409e
callq 0x3280
movq %rax, -0x4e8(%rbp)
jmp 0x48e7
movq -0x4e8(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
callq 0x3090
movq %rax, -0x4f0(%rbp)
jmp 0x4903
movq -0x4f0(%rbp), %rdi
leaq 0xf9c4(%rip), %rsi      # 0x142d5
callq 0x3280
movq %rax, -0x4f8(%rbp)
jmp 0x491f
movq -0x4f8(%rbp), %rdi
movq -0x3b0(%rbp), %rsi
callq 0x3090
movq %rax, -0x500(%rbp)
jmp 0x493b
movq -0x500(%rbp), %rdi
leaq 0xf75b(%rip), %rsi      # 0x140a4
callq 0x3280
jmp 0x4950
movq -0x1b8(%rbp), %rax
movq %rax, -0x510(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7e20
movq %rax, %rcx
movq -0x510(%rbp), %rax
decq %rcx
subq %rcx, %rax
sete -0x3ea(%rbp)
leaq -0x180(%rbp), %rax
movq %rax, -0x408(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x400(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x3f8(%rbp)
leaq -0x429(%rbp), %rdi
movq %rdi, -0x508(%rbp)
callq 0x3480
movq -0x508(%rbp), %rdx
leaq 0xf6e8(%rip), %rsi      # 0x140ab
leaq -0x428(%rbp), %rdi
callq 0x8660
jmp 0x49d1
movq -0x1c8(%rbp), %r8
movq -0x3b0(%rbp), %r9
movzbl -0x3ea(%rbp), %ecx
movq -0x3f8(%rbp), %rdx
movq %rsp, %rax
movq %rdx, 0x10(%rax)
movups -0x408(%rbp), %xmm0
movups %xmm0, (%rax)
andl $0x1, %ecx
movl %ecx, 0x18(%rax)
leaq -0x428(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x19c(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x5190
jmp 0x4a24
leaq -0x428(%rbp), %rdi
callq 0x31b0
leaq -0x429(%rbp), %rdi
callq 0x32e0
leaq -0x180(%rbp), %rax
movq %rax, -0x448(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x440(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x438(%rbp)
leaq -0x469(%rbp), %rdi
movq %rdi, -0x518(%rbp)
callq 0x3480
movq -0x518(%rbp), %rdx
leaq 0xf63d(%rip), %rsi      # 0x140be
leaq -0x468(%rbp), %rdi
callq 0x8660
jmp 0x4a8f
movq -0x1c8(%rbp), %r8
movq -0x3b0(%rbp), %r9
movzbl -0x3ea(%rbp), %ecx
movq -0x438(%rbp), %rdx
movq %rsp, %rax
movq %rdx, 0x10(%rax)
movups -0x448(%rbp), %xmm0
movups %xmm0, (%rax)
andl $0x1, %ecx
movl %ecx, 0x18(%rax)
leaq -0x468(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x1a0(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x5490
jmp 0x4ae2
leaq -0x468(%rbp), %rdi
callq 0x31b0
leaq -0x469(%rbp), %rdi
callq 0x32e0
movq -0x1b8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1b8(%rbp)
jmp 0x4450
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4b37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x31b0
leaq -0x3e9(%rbp), %rdi
callq 0x32e0
jmp 0x4d4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4b6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x31b0
leaq -0x429(%rbp), %rdi
callq 0x32e0
jmp 0x4d4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4ba5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x31b0
leaq -0x469(%rbp), %rdi
callq 0x32e0
jmp 0x4d4d
movq 0x1940b(%rip), %rdi     # 0x1dfc8
leaq 0xf51e(%rip), %rsi      # 0x140e2
callq 0x3280
movq %rax, -0x520(%rbp)
jmp 0x4bd2
movq -0x520(%rbp), %rdi
movq 0x193c8(%rip), %rsi     # 0x1dfa8
callq 0x32c0
jmp 0x4be7
movq 0x193da(%rip), %rdi     # 0x1dfc8
leaq 0xf508(%rip), %rsi      # 0x140fd
callq 0x3280
movq %rax, -0x528(%rbp)
jmp 0x4c03
movq -0x528(%rbp), %rdi
movaps 0xf3ff(%rip), %xmm1     # 0x14010
movq -0x1b0(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xf3fb(%rip), %xmm1     # 0x14020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movss -0x19c(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0xf3e8(%rip), %xmm2     # 0x14030
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x34a0
movq %rax, -0x530(%rbp)
jmp 0x4c5e
movq -0x530(%rbp), %rdi
movq 0x1933c(%rip), %rsi     # 0x1dfa8
callq 0x32c0
jmp 0x4c73
movq 0x1934e(%rip), %rdi     # 0x1dfc8
leaq 0xf478(%rip), %rsi      # 0x140f9
callq 0x3280
movq %rax, -0x538(%rbp)
jmp 0x4c8f
movq -0x538(%rbp), %rdi
movaps 0xf373(%rip), %xmm1     # 0x14010
movq -0x1b0(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xf36f(%rip), %xmm1     # 0x14020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movss -0x1a0(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0xf35c(%rip), %xmm2     # 0x14030
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x34a0
movq %rax, -0x540(%rbp)
jmp 0x4cea
movq -0x540(%rbp), %rdi
movq 0x192b0(%rip), %rsi     # 0x1dfa8
callq 0x32c0
jmp 0x4cff
leaq -0x198(%rbp), %rdi
callq 0x8710
leaq -0x180(%rbp), %rdi
callq 0x8710
leaq -0x168(%rbp), %rdi
callq 0x8770
leaq -0x138(%rbp), %rdi
callq 0x87d0
leaq -0x90(%rbp), %rdi
callq 0x8490
leaq -0x68(%rbp), %rdi
callq 0x8800
addq $0x560, %rsp            # imm = 0x560
popq %rbp
retq
leaq -0x198(%rbp), %rdi
callq 0x8710
leaq -0x180(%rbp), %rdi
callq 0x8710
leaq -0x168(%rbp), %rdi
callq 0x8770
leaq -0x138(%rbp), %rdi
callq 0x87d0
leaq -0x90(%rbp), %rdi
callq 0x8490
leaq -0x68(%rbp), %rdi
callq 0x8800
movq -0x70(%rbp), %rdi
callq 0x3470
nopl (%rax,%rax)