// File: melop[P]admixem/./newran02/newran.cpp
// Function: Binomial2::Binomial2(int, double)
Binomial2::Binomial2(int nx, Real px)
{
   Real qx = 1.0 - px;
   Real probs[40];
   int k = (int)(nx * px);
   probs[k] = exp(ln_gamma(nx+1) - ln_gamma(k+1) - ln_gamma(nx-k+1)
      + k * log(px) + (nx-k) * log(qx));
   int i;
   int m = (nx >= 40) ? 39 : nx;
   for (i=k+1; i<=m; i++) probs[i]=probs[i-1] * px * (nx-i+1) / qx / i;
   for (i=k-1; i>=0; i--) probs[i]=probs[i+1] * qx * (i+1) / px / (nx-i);
   dg = new DiscreteGen(m + 1, probs);
   if (!dg) ErrorNoSpace();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x198a0
movq -0x190(%rbp), %rax
leaq 0x93cbb(%rip), %rcx     # 0xa8e70
movq %rcx, (%rax)
movsd -0x18(%rbp), %xmm1
movsd 0x60e4b(%rip), %xmm0    # 0x76010
subsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
cvtsi2sdl -0xc(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x164(%rbp)
movl -0xc(%rbp), %eax
incl %eax
cvtsi2sd %eax, %xmm0
callq 0x14be0
movsd %xmm0, -0x188(%rbp)
jmp 0x151fe
movl -0x164(%rbp), %eax
incl %eax
cvtsi2sd %eax, %xmm0
callq 0x14be0
movsd %xmm0, -0x198(%rbp)
jmp 0x15219
movsd -0x198(%rbp), %xmm1
movsd -0x188(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x1a8(%rbp)
movl -0xc(%rbp), %eax
movl -0x164(%rbp), %ecx
subl %ecx, %eax
incl %eax
cvtsi2sd %eax, %xmm0
callq 0x14be0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x15255
movsd -0x1a0(%rbp), %xmm1
movsd -0x1a8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x1c8(%rbp)
cvtsi2sdl -0x164(%rbp), %xmm0
movsd %xmm0, -0x1c0(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x8940
movsd -0x1c8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x1c0(%rbp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x1b8(%rbp)
movl -0xc(%rbp), %eax
subl -0x164(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x1b0(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x8940
movsd -0x1b8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x1b0(%rbp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x8958
movslq -0x164(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
cmpl $0x28, -0xc(%rbp)
jl 0x15310
movl $0x27, %eax
movl %eax, -0x1cc(%rbp)
jmp 0x15319
movl -0xc(%rbp), %eax
movl %eax, -0x1cc(%rbp)
movl -0x1cc(%rbp), %eax
movl %eax, -0x17c(%rbp)
movl -0x164(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
movl -0x178(%rbp), %eax
cmpl -0x17c(%rbp), %eax
jg 0x153b8
movl -0x178(%rbp), %eax
subl $0x1, %eax
cltq
movsd -0x160(%rbp,%rax,8), %xmm0
mulsd -0x18(%rbp), %xmm0
movl -0xc(%rbp), %eax
subl -0x178(%rbp), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
divsd -0x20(%rbp), %xmm0
cvtsi2sdl -0x178(%rbp), %xmm1
divsd %xmm1, %xmm0
movslq -0x178(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
jmp 0x15334
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x170(%rbp)
movl %eax, -0x174(%rbp)
jmp 0x154b1
movl -0x164(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x178(%rbp)
cmpl $0x0, -0x178(%rbp)
jl 0x15431
movl -0x178(%rbp), %eax
addl $0x1, %eax
cltq
movsd -0x160(%rbp,%rax,8), %xmm0
mulsd -0x20(%rbp), %xmm0
movl -0x178(%rbp), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
divsd -0x18(%rbp), %xmm0
movl -0xc(%rbp), %eax
subl -0x178(%rbp), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movslq -0x178(%rbp), %rax
movsd %xmm0, -0x160(%rbp,%rax,8)
movl -0x178(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x178(%rbp)
jmp 0x153c7
movl $0x38, %edi
callq 0x84c0
movq %rax, -0x1d8(%rbp)
jmp 0x15444
movq -0x1d8(%rbp), %rdi
movl -0x17c(%rbp), %esi
incl %esi
leaq -0x160(%rbp), %rdx
callq 0x15e90
jmp 0x15461
movq -0x190(%rbp), %rax
movq -0x1d8(%rbp), %rcx
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x8(%rax)
jne 0x154a8
callq 0x136a0
jmp 0x15481
jmp 0x154a8
movq -0x1d8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x170(%rbp)
movl %eax, -0x174(%rbp)
movl $0x38, %esi
callq 0x84d0
jmp 0x154b1
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
movq -0x190(%rbp), %rdi
callq 0x19e90
movq -0x170(%rbp), %rdi
callq 0x8860
nopl (%rax)