// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/binomlite.c
// Function: bup
static double bup(double a, double b, double x, double y, int n, double eps, int give_log)
{
/* ----------------------------------------------------------------------- */
/*     EVALUATION OF I_x(A,B) - I_x(A+N,B) WHERE N IS A POSITIVE INT. */
/*     EPS IS THE TOLERANCE USED. */
/* ----------------------------------------------------------------------- */

    double ret_val;
    int i, k, mu;
    double d, l;

// Obtain the scaling factor exp(-mu) and exp(mu)*(x^a * y^b / beta(a,b))/a

    double apb = a + b,
    ap1 = a + 1.;
    if (n > 1 && a >= 1. && apb >= ap1 * 1.1) {
        mu = (int)fabs(exparg(1));
        k = (int) exparg(0);
        if (mu > k)
            mu = k;
         d = exp(-(double) mu);
    } else {
        mu = 0;
        d = 1.;
    }

    /* L10: */
    ret_val = give_log? brcmp1(mu, a, b, x, y, 1) - log(a)
        : brcmp1(mu, a, b, x, y, 0)  / a;
    if (n == 1 ||
            (give_log && ret_val == ML_NEGINF) || (!give_log && ret_val == 0.))
        return ret_val;

    int nm1 = n - 1;
    double w = d;

/*          LET K BE THE INDEX OF THE MAXIMUM TERM */

    k = 0;
    if (b > 1.) {
        if (y > 1e-4) {
            double r = (b - 1.) * x / y - a;
            if (r >= 1.)
                k = (r < nm1) ? (int) r : nm1;
        } else {
            k = nm1;
        }

//          ADD THE INCREASING TERMS OF THE SERIES - if k > 0
/* L30: */
        for (i = 0; i < k; ++i) {
            l = (double) i;
            d *= (apb + l) / (ap1 + l) * x;
            w += d;
        }
    }

// L40:     ADD THE REMAINING TERMS OF THE SERIES

    for (i = k; i < nm1; ++i) {
        l = (double) i;
        d *= (apb + l) / (ap1 + l) * x;
        w += d;
        if (d <= eps * w) /* relativ convergence (eps) */
            break;
    }

    // L50: TERMINATE THE PROCEDURE
    if(give_log) {
        ret_val += log(w);
    } else {
        ret_val *= w;
    }
    return ret_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movsd %xmm3, -0x28(%rbp)
movl %edi, -0x2c(%rbp)
movsd %xmm4, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movsd -0x10(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd 0xfc17(%rip), %xmm0     # 0x315f8
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
cmpl $0x1, -0x2c(%rbp)
jle 0x21a80
movsd -0x10(%rbp), %xmm0
movsd 0xfbf6(%rip), %xmm1     # 0x315f8
ucomisd %xmm1, %xmm0
jb 0x21a80
movsd -0x70(%rbp), %xmm0
movsd 0x10e0b(%rip), %xmm1    # 0x32820
mulsd -0x78(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jb 0x21a80
movl $0x1, %edi
callq 0x24f00
movaps 0x110bf(%rip), %xmm1    # 0x32af0
pand %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x54(%rbp)
xorl %edi, %edi
callq 0x24f00
cvttsd2si %xmm0, %eax
movl %eax, -0x50(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x50(%rbp), %eax
jle 0x21a58
movl -0x50(%rbp), %eax
movl %eax, -0x54(%rbp)
cvtsi2sdl -0x54(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x2560
movsd %xmm0, -0x60(%rbp)
jmp 0x21a94
movl $0x0, -0x54(%rbp)
movsd 0xfb69(%rip), %xmm0     # 0x315f8
movsd %xmm0, -0x60(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x21ae6
movl -0x54(%rbp), %edi
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd -0x20(%rbp), %xmm2
movsd -0x28(%rbp), %xmm3
movl $0x1, %esi
callq 0x25460
movsd %xmm0, -0xa0(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0xa0(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x21b11
movl -0x54(%rbp), %edi
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd -0x20(%rbp), %xmm2
movsd -0x28(%rbp), %xmm3
xorl %esi, %esi
callq 0x25460
divsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
cmpl $0x1, -0x2c(%rbp)
je 0x21b57
cmpl $0x0, -0x3c(%rbp)
je 0x21b41
movsd -0x48(%rbp), %xmm0
movsd 0x10c49(%rip), %xmm1    # 0x32780
ucomisd %xmm1, %xmm0
jne 0x21b41
jp 0x21b41
jmp 0x21b57
cmpl $0x0, -0x3c(%rbp)
jne 0x21b66
movsd -0x48(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x21b66
jp 0x21b66
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x21d40
movl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x7c(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movl $0x0, -0x50(%rbp)
movsd -0x18(%rbp), %xmm0
movsd 0xfa68(%rip), %xmm1     # 0x315f8
ucomisd %xmm1, %xmm0
jbe 0x21c8a
movsd -0x28(%rbp), %xmm0
movsd 0x10c81(%rip), %xmm1    # 0x32828
ucomisd %xmm1, %xmm0
jbe 0x21c22
movsd -0x18(%rbp), %xmm0
movsd 0xfa3e(%rip), %xmm1     # 0x315f8
subsd %xmm1, %xmm0
mulsd -0x20(%rbp), %xmm0
divsd -0x28(%rbp), %xmm0
subsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
movsd 0xfa13(%rip), %xmm1     # 0x315f8
ucomisd %xmm1, %xmm0
jb 0x21c20
movsd -0x90(%rbp), %xmm1
cvtsi2sdl -0x7c(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x21c0e
cvttsd2si -0x90(%rbp), %eax
movl %eax, -0xa4(%rbp)
jmp 0x21c17
movl -0x7c(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x21c28
movl -0x7c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x21c88
cvtsi2sdl -0x4c(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x70(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
addsd -0x68(%rbp), %xmm1
divsd %xmm1, %xmm0
mulsd -0x20(%rbp), %xmm0
mulsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x21c2f
jmp 0x21c8a
movl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x21d05
cvtsi2sdl -0x4c(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x70(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
addsd -0x68(%rbp), %xmm1
divsd %xmm1, %xmm0
mulsd -0x20(%rbp), %xmm0
mulsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x60(%rbp), %xmm1
movsd -0x38(%rbp), %xmm0
mulsd -0x88(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x21cf8
jmp 0x21d05
jmp 0x21cfa
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x21c90
cmpl $0x0, -0x3c(%rbp)
je 0x21d24
movsd -0x88(%rbp), %xmm0
callq 0x2250
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x21d36
movsd -0x88(%rbp), %xmm0
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0xb0, %rsp
popq %rbp
retq
nop