// File: /workspace/github_c_makefile_star2_O1/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 0x5fbc
ucomisd %xmm1, %xmm2
ja 0x5fbc
movq %rdx, %rbx
movq %rsi, %r14
movsd %xmm1, (%rsp)
leaq 0x5333(%rip), %rax      # 0xb160
movb (%rax), %al
leaq 0x545a(%rip), %rcx      # 0xb290
movb (%rcx), %cl
leaq 0x54c6(%rip), %rdx      # 0xb305
movb (%rdx), %dl
leaq 0x54b2(%rip), %rsi      # 0xb2fa
movb (%rsi), %sil
xorl %r8d, %r8d
cmpq $0x8, %r8
ja 0x5e5b
movb %sil, 0x30(%rsp,%r8)
jmp 0x5e7a
cmpq $0x10, %r8
ja 0x5e68
movb %dl, 0x30(%rsp,%r8)
jmp 0x5e7a
cmpq $0x20, %r8
ja 0x5e75
movb %cl, 0x30(%rsp,%r8)
jmp 0x5e7a
movb %al, 0x30(%rsp,%r8)
incq %r8
cmpq $0x31, %r8
jne 0x5e4e
movq %rdi, %xmm0
punpckldq 0x11a0(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x11a8(%rip), %xmm0     # 0x7040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x2204(%rip), %xmm0     # 0x80b0
movapd %xmm1, 0x20(%rsp)
callq 0x1090
movsd 0x1159(%rip), %xmm1     # 0x7018
subsd %xmm0, %xmm1
ucomisd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm0
ja 0x5ee1
ucomisd %xmm0, %xmm1
ja 0x5ee1
movb $0x1, %r15b
movb $0x8, %bpl
jmp 0x5fa4
movb $0x8, %bpl
movb $0x1, %r15b
movl $0x100, %r12d           # imm = 0x100
movzbl %bpl, %eax
cmpb 0x30(%rsp,%rax), %r15b
jb 0x5f0a
incb %bpl
cmpb (%r14), %bpl
ja 0x5fc9
addq %r12, %r12
xorl %r15d, %r15d
incb %r15b
movq %r12, %xmm0
punpckldq 0x1116(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x111e(%rip), %xmm0     # 0x7040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x10e2(%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 0x10ae(%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 0x5eed
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x5eed
movb %bpl, (%r14)
testq %rbx, %rbx
je 0x5faf
movb %r15b, (%rbx)
movzbl %bpl, %edi
movzbl %r15b, %esi
callq 0x5c51
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $-0x1, %al
jmp 0x5fbc
nopl (%rax)