// File: /workspace/github_c_makefile_star2_O3/ryancdotorg[P]bloomslice/bloomutl.c
// Function: bloom_pick_hash_es
uint8_t bloom_pick_hash_es(double max_error, double max_bloom_saturation, uint64_t n, uint8_t *max_w, uint8_t *new_k) {
  if (max_error < 0 || max_bloom_saturation < 0) return 255;

  int i;

  uint8_t w, k;
  uint64_t m;

  double e, s;

  uint8_t max_k_by_w[49];
  for (i = 0; i <= 48; ++i) {
    if (i < 9) {
      max_k_by_w[i] = hash1sN;
    } else if (i < 17) {
      max_k_by_w[i] = hash2bN;
    } else if (i < 33) {
      max_k_by_w[i] = hash2sN;
    } else {
      max_k_by_w[i] = hash3sN;
    }
  }

  w = 8; m = 1<<w; k = 1;

  s = bloom_saturation(k, m, n);
  e = pow(s, k);

  while (e > max_error || s > max_bloom_saturation) {
    if (k >= max_k_by_w[w]) {
      m <<= 1; ++w; k = 0;
      if (w > *max_w) return 255;
    }
    ++k;
    s = bloom_saturation(k, m, n);
    e = pow(s, (double)k);
  }

  *max_w = w;

  if (new_k) *new_k = k;

  return bloom_pick_hash_wk(w, k);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
xorpd %xmm2, %xmm2
movsd %xmm0, 0x8(%rsp)
ucomisd %xmm0, %xmm2
movb $-0x1, %al
ja 0x6095
ucomisd %xmm1, %xmm2
ja 0x6095
movq %rdx, %rbx
movq %rsi, %r14
movsd %xmm1, (%rsp)
leaq 0x525a(%rip), %rax      # 0xb160
movb (%rax), %al
leaq 0x5381(%rip), %rcx      # 0xb290
movb (%rcx), %cl
leaq 0x53ed(%rip), %rdx      # 0xb305
movb (%rdx), %dl
leaq 0x53d9(%rip), %rsi      # 0xb2fa
movb (%rsi), %sil
xorl %r8d, %r8d
cmpq $0x8, %r8
ja 0x5f34
movb %sil, 0x30(%rsp,%r8)
jmp 0x5f53
cmpq $0x10, %r8
ja 0x5f41
movb %dl, 0x30(%rsp,%r8)
jmp 0x5f53
cmpq $0x20, %r8
ja 0x5f4e
movb %cl, 0x30(%rsp,%r8)
jmp 0x5f53
movb %al, 0x30(%rsp,%r8)
incq %r8
cmpq $0x31, %r8
jne 0x5f27
movq %rdi, %xmm0
punpckldq 0x10c7(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x10cf(%rip), %xmm0     # 0x7040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x212b(%rip), %xmm0     # 0x80b0
movapd %xmm1, 0x20(%rsp)
callq 0x1090
movsd 0x1080(%rip), %xmm1     # 0x7018
subsd %xmm0, %xmm1
ucomisd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm0
ja 0x5fba
ucomisd %xmm0, %xmm1
ja 0x5fba
movb $0x1, %r15b
movb $0x8, %bpl
jmp 0x607d
movb $0x8, %bpl
movb $0x1, %r15b
movl $0x100, %r12d           # imm = 0x100
movzbl %bpl, %eax
cmpb 0x30(%rsp,%rax), %r15b
jb 0x5fe3
incb %bpl
cmpb (%r14), %bpl
ja 0x60a2
addq %r12, %r12
xorl %r15d, %r15d
incb %r15b
movq %r12, %xmm0
punpckldq 0x103d(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1045(%rip), %xmm0     # 0x7040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x1009(%rip), %xmm0     # 0x7018
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
subsd %xmm2, %xmm0
movzbl %r15b, %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
movsd %xmm2, 0x18(%rsp)
movapd 0x20(%rsp), %xmm1
mulsd %xmm2, %xmm1
callq 0x1090
movsd 0xfd5(%rip), %xmm1      # 0x7018
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movapd %xmm1, %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x1090
ucomisd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm0
ja 0x5fc6
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x5fc6
movb %bpl, (%r14)
testq %rbx, %rbx
je 0x6088
movb %r15b, (%rbx)
movzbl %bpl, %edi
movzbl %r15b, %esi
callq 0x5d19
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $-0x1, %al
jmp 0x6095
nop