// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/binomlite.c
// Function: fpser
double fpser(double a, double b, double x, double eps, int log_p)
{
/* ----------------------------------------------------------------------- *
 *                 EVALUATION OF I (A,B)
 *                                X
 *          FOR B < MIN(EPS, EPS*A) AND X <= 0.5
 * ----------------------------------------------------------------------- */

    double ans, c, s, t, an, tol;

    /* SET  ans := x^a : */
    if (log_p) {
        ans = a * log(x);
    } else if (a > eps * 0.001) {
        t = a * log(x);
        if (t < exparg(1)) { /* exp(t) would underflow */
            return 0.;
        }
        ans = exp(t);
    } else {
        ans = 1.;
    }

/*                NOTE THAT 1/B(A,B) = B */

    if (log_p)
        ans += log(b) - log(a);
    else
        ans *= b / a;

    tol = eps / a;
    an = a + 1.;
    t = x;
    s = t / an;
    do {
        an += 1.;
        t = x * t;
        c = t / an;
        s += c;
    } while (fabs(c) > tol);

    if (log_p)
        ans += log1p(a * s);
    else
        ans *= a * s + 1.;
    return ans;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movsd %xmm3, -0x28(%rbp)
movl %edi, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x21502
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x2158b
movsd -0x10(%rbp), %xmm0
movsd 0x11291(%rip), %xmm1    # 0x327a0
mulsd -0x28(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2157c
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movl $0x1, %edi
callq 0x24f00
movsd -0x70(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2156b
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x216b5
movsd -0x50(%rbp), %xmm0
callq 0x2560
movsd %xmm0, -0x38(%rbp)
jmp 0x21589
movsd 0x10074(%rip), %xmm0    # 0x315f8
movsd %xmm0, -0x38(%rbp)
jmp 0x2158b
cmpl $0x0, -0x2c(%rbp)
je 0x215c2
movsd -0x18(%rbp), %xmm0
callq 0x2250
movsd %xmm0, -0x80(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
subsd %xmm1, %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x215d6
movsd -0x18(%rbp), %xmm0
divsd -0x10(%rbp), %xmm0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x28(%rbp), %xmm0
divsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd 0x1000b(%rip), %xmm0    # 0x315f8
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
divsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0xffe0(%rip), %xmm0     # 0x315f8
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x20(%rbp), %xmm0
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
divsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x40(%rbp), %xmm0
movaps 0x11495(%rip), %xmm1    # 0x32af0
pand %xmm1, %xmm0
ucomisd -0x60(%rbp), %xmm0
ja 0x21610
cmpl $0x0, -0x2c(%rbp)
je 0x21687
movsd -0x10(%rbp), %xmm0
mulsd -0x48(%rbp), %xmm0
callq 0x2230
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x216ab
movsd -0x10(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0xff5b(%rip), %xmm1     # 0x315f8
addsd %xmm1, %xmm0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)