// File: /workspace/github_cpp_makefile_star2_O1/redpony[P]cpyp/./cpyp/mf_crp.h
// Function: std::pair<unsigned int, int> cpyp::mf_crp<2u, unsigned int, std::hash<unsigned int>>::decrement<cpyp::MT19937>(unsigned int const&, cpyp::MT19937&, double*)
std::pair<unsigned,int> decrement(const Dish& dish, Engine& eng, double* logq = nullptr) {
    crp_table_manager<NumFloors>& loc = dish_locs_[dish];
    assert(loc.num_customers());
    if (loc.num_customers() == 1) {
      update_llh_remove_customer_from_table_seating(1);
      unsigned floor = 0;
      for (; floor < NumFloors; ++floor)
        if (!loc.h[floor].empty()) break;
      assert(floor < NumFloors);
      
      dish_locs_.erase(dish);
      --num_tables_;
      --num_customers_;
      // q = 1 since this is the first customer
      return std::make_pair(floor, -1);
    } else {
      unsigned selected_table_postcount = 0;
      const std::pair<unsigned,int> delta = loc.remove_customer(eng, &selected_table_postcount);
      update_llh_remove_customer_from_table_seating(selected_table_postcount + 1);
      --num_customers_;
      if (delta.second) --num_tables_;

      if (logq) {
        double p_empty = (strength_ + num_tables_ * discount_);
        double p_share = (loc.num_customers() - loc.num_tables() * discount_);
        const double z = p_empty + p_share;
        p_empty /= z;
        p_share /= z;
        if (selected_table_postcount)
          *logq += log(p_share * (selected_table_postcount - discount_) /
                     (loc.num_customers() - loc.num_tables() * discount_));
        else
          *logq += log(p_empty);
      }
      return delta;
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
leaq 0x8(%rdi), %rbp
movq %rbp, %rdi
callq 0x83b2
movq %rax, %r12
movl (%rax), %eax
cmpl $0x1, %eax
je 0x55e4
testl %eax, %eax
je 0x569d
leaq 0x4(%rsp), %r13
movl $0x0, (%r13)
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x8a3e
movq %rax, %rbx
movl (%r13), %esi
incl %esi
movq %r14, %rdi
callq 0x898e
decl 0x4(%r14)
movq %rbx, %rax
shrq $0x20, %rax
je 0x5571
decl (%r14)
testq %r15, %r15
je 0x568b
movl (%r14), %eax
cvtsi2sd %rax, %xmm0
movsd 0x40(%r14), %xmm1
mulsd %xmm1, %xmm0
addsd 0x48(%r14), %xmm0
movl (%r12), %eax
movl 0x4(%r12), %ecx
cvtsi2sd %rax, %xmm2
cvtsi2sd %rcx, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm3, %xmm2
movapd %xmm0, %xmm3
addsd %xmm2, %xmm3
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x5678
movapd %xmm2, %xmm4
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd %xmm3, %xmm4
subsd %xmm1, %xmm0
mulsd %xmm4, %xmm0
divsd %xmm2, %xmm0
jmp 0x567c
movq %r14, %rdi
movl $0x1, %esi
callq 0x898e
addq $0x81, %r12
movb $0x1, %al
xorl %ebx, %ebx
cmpb $0x1, (%r12)
jne 0x560e
movq -0x79(%r12), %rcx
movq 0x18(%rcx), %rcx
jmp 0x5614
movzbl -0x1(%r12), %ecx
testq %rcx, %rcx
jne 0x5648
incq %rbx
subq $-0x80, %r12
cmpq $0x1, %rbx
sete %al
je 0x55fc
leaq 0x5309(%rip), %rdi      # 0xa939
leaq 0x5314(%rip), %rsi      # 0xa94b
leaq 0x53d0(%rip), %rcx      # 0xaa0e
movl $0xb1, %edx
callq 0x20e0
testb $0x1, %al
je 0x5629
movq %rbp, %rdi
movq %r13, %rsi
callq 0x8b9a
movq (%r14), %xmm0
pcmpeqd %xmm1, %xmm1
paddd %xmm0, %xmm1
movq %xmm1, (%r14)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
orq %rax, %rbx
jmp 0x568b
divsd %xmm3, %xmm0
callq 0x2150
addsd (%r15), %xmm0
movsd %xmm0, (%r15)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5114(%rip), %rdi      # 0xa7b8
leaq 0x52a0(%rip), %rsi      # 0xa94b
leaq 0x535c(%rip), %rcx      # 0xaa0e
movl $0xab, %edx
callq 0x20e0