// File: kaityo256[P]randomsampling/test.cpp
// Function: void test<walker_alias>(std::vector<double, std::allocator<double>>&)
void test(std::vector<double> &v) {
  std::vector<double> r(v.size(), 0.0);
  std::mt19937 mt;
  T s(v);
  std::cout << s.name() << std::endl;
  const int N = 100000;
  double sum = std::accumulate(v.begin(), v.end(), 0);
  const double a = sum / N;
  for (int i = 0; i < N; i++) {
    int index = s.select(mt);
    r[index] += a;
  }
  for (size_t i = 0; i < v.size(); i++) {
    std::cout << i << ":" << r[i] << std::endl;
  }
  std::cout << std::endl;
}

// Assembly:
subq $0x14c8, %rsp           # imm = 0x14C8
movq %rdi, 0x14c0(%rsp)
movq 0x14c0(%rsp), %rdi
callq 0x2640
movq %rax, 0x40(%rsp)
movq $0x0, 0x14a0(%rsp)
leaq 0x149f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x3400
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rcx
leaq 0x14a8(%rsp), %rdi
leaq 0x14a0(%rsp), %rdx
callq 0x36b0
jmp 0x26e0
leaq 0x149f(%rsp), %rdi
callq 0x34a0
leaq 0x100(%rsp), %rdi
callq 0x3730
jmp 0x26fc
movq 0x14c0(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x3750
jmp 0x2713
leaq 0x88(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3d80
jmp 0x272a
movq 0xd8a7(%rip), %rdi      # 0xffd8
leaq 0x88(%rsp), %rsi
callq 0x2130
movq %rax, 0x38(%rsp)
jmp 0x2745
movq 0x38(%rsp), %rdi
movq 0xd877(%rip), %rsi      # 0xffc8
callq 0x2170
jmp 0x2758
leaq 0x88(%rsp), %rdi
callq 0x20b0
movl $0x186a0, 0x84(%rsp) # imm = 0x186A0
movq 0x14c0(%rsp), %rdi
callq 0x3e70
movq %rax, 0x70(%rsp)
movq 0x14c0(%rsp), %rdi
callq 0x3ea0
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
xorl %edx, %edx
callq 0x3e00
movl %eax, 0x34(%rsp)
jmp 0x27ab
movl 0x34(%rsp), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
movsd 0x8849(%rip), %xmm1     # 0xb010
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
cmpl $0x186a0, 0x5c(%rsp)    # imm = 0x186A0
jge 0x28c1
leaq 0xa8(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x3ed0
movl %eax, 0x30(%rsp)
jmp 0x2802
movl 0x30(%rsp), %eax
movl %eax, 0x58(%rsp)
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movslq 0x58(%rsp), %rsi
leaq 0x14a8(%rsp), %rdi
callq 0x2660
movsd 0x28(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x27d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1490(%rsp)
movl %eax, 0x148c(%rsp)
leaq 0x149f(%rsp), %rdi
callq 0x34a0
jmp 0x29be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1490(%rsp)
movl %eax, 0x148c(%rsp)
jmp 0x29b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1490(%rsp)
movl %eax, 0x148c(%rsp)
jmp 0x29a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1490(%rsp)
movl %eax, 0x148c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x20b0
jmp 0x29a4
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x14c0(%rsp), %rdi
callq 0x2640
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x296d
movq 0x50(%rsp), %rsi
movq 0xd6de(%rip), %rdi      # 0xffd8
callq 0x2040
movq %rax, 0x18(%rsp)
jmp 0x2906
movq 0x18(%rsp), %rdi
leaq 0x8751(%rip), %rsi      # 0xb063
callq 0x2140
movq %rax, 0x10(%rsp)
jmp 0x291e
movq 0x50(%rsp), %rsi
leaq 0x14a8(%rsp), %rdi
callq 0x2660
movq 0x10(%rsp), %rdi
movsd (%rax), %xmm0
callq 0x2250
movq %rax, 0x8(%rsp)
jmp 0x2945
movq 0x8(%rsp), %rdi
movq 0xd677(%rip), %rsi      # 0xffc8
callq 0x2170
jmp 0x2958
jmp 0x295a
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x28ca
movq 0xd664(%rip), %rdi      # 0xffd8
movq 0xd64d(%rip), %rsi      # 0xffc8
callq 0x2170
jmp 0x2982
leaq 0xa8(%rsp), %rdi
callq 0x3f70
leaq 0x14a8(%rsp), %rdi
callq 0x34b0
addq $0x14c8, %rsp           # imm = 0x14C8
retq
leaq 0xa8(%rsp), %rdi
callq 0x3f70
leaq 0x14a8(%rsp), %rdi
callq 0x34b0
movq 0x1490(%rsp), %rdi
callq 0x2220
nopl (%rax,%rax)