// File: ctz[P]openssl-bench/bench.cc
// Function: test_bulk(unsigned int, Context&, Context&, unsigned long)
static void test_bulk(const unsigned n_threads, Context &server_ctx,
                      Context &client_ctx, const size_t plaintext_size) {

  std::vector<std::thread> threads;
  std::vector<Timings> results(n_threads);
  const size_t rounds = rounds_for_bulk_test(plaintext_size);

  for (unsigned i = 0; i < n_threads; i++) {
    threads.push_back(std::thread(&test_bulk_one, std::ref(results[i]),
                                  std::ref(server_ctx), std::ref(client_ctx),
                                  rounds, plaintext_size));
  }

  for (unsigned i = 0; i < n_threads; i++) {
    threads[i].join();
  }

  Conn client(client_ctx.open());
  Conn server(server_ctx.open());
  do_handshake(client, server);
  std::string prefix_send = "bulk\tsend\t";
  std::string prefix_recv = "bulk\trecv\t";
  prefix_send += client.get_cipher_string();
  prefix_recv += client.get_cipher_string();

  const double total_mbs = (plaintext_size * rounds) / (1024. * 1024.);
  print_results(prefix_send.c_str(), prefix_recv.c_str(), results, total_mbs,
                "MB/s");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6250
movl -0x4(%rbp), %eax
movq %rax, -0x1c0(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x6270
movq -0x1c0(%rbp), %rsi
movq -0x1b8(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x6290
jmp 0x3b16
leaq -0x51(%rbp), %rdi
callq 0x6300
movq -0x20(%rbp), %rdi
callq 0x4cd0
movq %rax, -0x1c8(%rbp)
jmp 0x3b31
movq -0x1c8(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x3c3a
leaq 0x11ca(%rip), %rax      # 0x4d20
movq %rax, -0x88(%rbp)
movl -0x74(%rbp), %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x6380
movq %rax, %rdi
callq 0x6350
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rdi
callq 0x63a0
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x63a0
movq %rax, -0xa0(%rbp)
movq %rsp, %rax
leaq -0x20(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0x90(%rbp), %rdx
leaq -0x98(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0x70(%rbp), %r9
callq 0x63d0
jmp 0x3bcf
leaq -0x38(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6320
jmp 0x3bde
leaq -0x80(%rbp), %rdi
callq 0x64b0
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x3b43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x6300
jmp 0x3f66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3f5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x64b0
jmp 0x3f5d
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x3c7d
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x64e0
movq %rax, %rdi
callq 0x3580
jmp 0x3c6a
jmp 0x3c6c
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x3c44
movq -0x18(%rbp), %rdi
callq 0x6500
movq %rax, -0x1d0(%rbp)
jmp 0x3c8f
movq -0x1d0(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x6520
jmp 0x3ca4
movq -0x10(%rbp), %rdi
callq 0x6500
movq %rax, -0x1d8(%rbp)
jmp 0x3cb6
movq -0x1d8(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x6520
jmp 0x3ccb
leaq -0xe0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x5050
jmp 0x3ce0
leaq -0x139(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x35a0
movq -0x1e0(%rbp), %rdx
leaq 0xa600(%rip), %rsi      # 0xe301
leaq -0x138(%rbp), %rdi
callq 0x65e0
jmp 0x3d0f
leaq -0x139(%rbp), %rdi
callq 0x3380
leaq -0x161(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x35a0
movq -0x1e8(%rbp), %rdx
leaq 0xa5d0(%rip), %rsi      # 0xe30c
leaq -0x160(%rbp), %rdi
callq 0x65e0
jmp 0x3d4a
leaq -0x161(%rbp), %rdi
callq 0x3380
leaq -0x188(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x6690
jmp 0x3d6b
leaq -0x138(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x3440
jmp 0x3d80
leaq -0x188(%rbp), %rdi
callq 0x31f0
leaq -0x1a8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x6690
jmp 0x3da1
leaq -0x160(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x3440
jmp 0x3db6
leaq -0x1a8(%rbp), %rdi
callq 0x31f0
movq -0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
imulq %rcx, %rax
movq %rax, %xmm0
movaps 0xa236(%rip), %xmm1     # 0xe010
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xa23a(%rip), %xmm1     # 0xe020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0xa233(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1b0(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x3160
movq %rax, -0x1f0(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x3160
movq -0x1f0(%rbp), %rdi
movq %rax, %rsi
movsd -0x1b0(%rbp), %xmm0
leaq 0xa4d6(%rip), %rcx      # 0xe317
leaq -0x50(%rbp), %rdx
callq 0x5090
jmp 0x3e4c
leaq -0x160(%rbp), %rdi
callq 0x31f0
leaq -0x138(%rbp), %rdi
callq 0x31f0
leaq -0x118(%rbp), %rdi
callq 0x6770
leaq -0xe0(%rbp), %rdi
callq 0x6770
leaq -0x50(%rbp), %rdi
callq 0x67c0
leaq -0x38(%rbp), %rdi
callq 0x6820
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3f51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3f45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x139(%rbp), %rdi
callq 0x3380
jmp 0x3f45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x161(%rbp), %rdi
callq 0x3380
jmp 0x3f39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3f2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x31f0
jmp 0x3f2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x31f0
leaq -0x160(%rbp), %rdi
callq 0x31f0
leaq -0x138(%rbp), %rdi
callq 0x31f0
leaq -0x118(%rbp), %rdi
callq 0x6770
leaq -0xe0(%rbp), %rdi
callq 0x6770
leaq -0x50(%rbp), %rdi
callq 0x67c0
leaq -0x38(%rbp), %rdi
callq 0x6820
movq -0x60(%rbp), %rdi
callq 0x3590
nopl (%rax,%rax)