// File: /workspace/github_c_makefile_star2_O3/FastFilter[P]BlockBloomSimulator/src/laneblockmodel.h
// Function: assessBlockSizeLanes
void assessBlockSizeLanes(size_t HowManyKeys, size_t BlockSizeInBits,
                          bool verbose) {
  for (size_t bitsperkey = 8; bitsperkey <= 16; bitsperkey += 1) {
    size_t bitbudget = bitsperkey * HowManyKeys;
    sim_stats_t beststats;
    size_t bestlane = findBestLaneSize(HowManyKeys, bitbudget, BlockSizeInBits,
                                       &beststats, verbose);
    double colrate8 = findLaneCollisionRateAndDensity(HowManyKeys, bitbudget,
                                            BlockSizeInBits, 8, verbose).collision_rate;
    // for each key, we set BlockSizeInBits/bestlane bits to one
    double density = ( BlockSizeInBits / bestlane ) * 1.0 / bitsperkey;

    double bloombestbitsperbucket = bitsperkey * log(2);
    double bloombestcollisionrate = pow(2, -bloombestbitsperbucket);

    double theoretical_best_bits = log(1.0/beststats.collision_rate) / log(2.0);
    double inefficiency = (bitsperkey/theoretical_best_bits - 1.0) * 100.0;
    printf("bits per key %3zu best lane size = %zu bits, max density = %0.0f %%, density = %0.0f %%, collision rate = "
           "%0.3f %% (x %.2f worse than Bloom), inefficiency = %0.1f %%  // collision rate at 8 bits is "
           "%0.3f %% \n",
           bitsperkey, bestlane, density * 100, beststats.density * 100, beststats.collision_rate * 100,
           beststats.collision_rate / bloombestcollisionrate,  inefficiency, colrate8 * 100);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq (,%rdi,8), %r15
movl $0x8, %r12d
leaq 0x23df(%rip), %rbp      # 0x422e
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
leaq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x1bfe
movq %rax, %r13
movl $0x8, %ecx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x1d59
movsd %xmm0, 0x18(%rsp)
movq %rbx, %rax
xorl %edx, %edx
divq %r13
movq %rax, %xmm0
punpckldq 0x2177(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x217f(%rip), %xmm0     # 0x4020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
xorps %xmm2, %xmm2
cvtsi2sd %r12, %xmm2
movsd %xmm2, (%rsp)
addsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movapd %xmm1, 0x30(%rsp)
movapd %xmm2, %xmm0
mulsd 0x21d8(%rip), %xmm0     # 0x40a8
callq 0x1030
movsd %xmm0, 0x10(%rsp)
movsd 0x20(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x2199(%rip), %xmm0     # 0x4088
divsd %xmm1, %xmm0
callq 0x10a0
divsd 0x2190(%rip), %xmm0     # 0x4090
movsd (%rsp), %xmm4
divsd %xmm0, %xmm4
addsd 0x2187(%rip), %xmm4     # 0x4098
movsd 0x2187(%rip), %xmm6     # 0x40a0
mulsd %xmm6, %xmm4
movapd 0x30(%rsp), %xmm0
mulsd %xmm6, %xmm0
movsd 0x28(%rsp), %xmm1
mulsd %xmm6, %xmm1
movsd 0x8(%rsp), %xmm5
movapd %xmm5, %xmm2
mulsd %xmm6, %xmm2
divsd 0x10(%rsp), %xmm5
movapd %xmm5, %xmm3
movsd 0x18(%rsp), %xmm5
mulsd %xmm6, %xmm5
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
movb $0x6, %al
callq 0x1080
incq %r12
addq %r14, %r15
cmpq $0x11, %r12
jne 0x1e4f
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq