// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]yahs/binomlite.c
// Function: algdiv
static double algdiv(double a, double b)
{
/* ----------------------------------------------------------------------- */

/*     COMPUTATION OF LN(GAMMA(B)/GAMMA(A+B)) WHEN B >= 8 */

/*                         -------- */

/*     IN THIS ALGORITHM, DEL(X) IS THE FUNCTION DEFINED BY */
/*     LN(GAMMA(X)) = (X - 0.5)*LN(X) - X + 0.5*LN(2*PI) + DEL(X). */

/* ----------------------------------------------------------------------- */

    /* Initialized data */

    static double c0 = .0833333333333333;
    static double c1 = -.00277777777760991;
    static double c2 = 7.9365066682539e-4;
    static double c3 = -5.9520293135187e-4;
    static double c4 = 8.37308034031215e-4;
    static double c5 = -.00165322962780713;

    double c, d, h, t, u, v, w, x, s3, s5, x2, s7, s9, s11;

/* ------------------------ */
    if (a > b) {
    h = b / a;
    c = 1. / (h + 1.);
    x = h / (h + 1.);
    d = a + (b - 0.5);
    }
    else {
    h = a / b;
    c = h / (h + 1.);
    x = 1. / (h + 1.);
    d = b + (a - 0.5);
    }

/* Set s<n> = (1 - x^n)/(1 - x) : */

    x2 = x * x;
    s3 = x + x2 + 1.;
    s5 = x + x2 * s3 + 1.;
    s7 = x + x2 * s5 + 1.;
    s9 = x + x2 * s7 + 1.;
    s11 = x + x2 * s9 + 1.;

/* w := Del(b) - Del(a + b) */

    t = 1./ (b * b);
    w = ((((c5 * s11 * t + c4 * s9) * t + c3 * s7) * t + c2 * s5) * t + c1 *
        s3) * t + c0;
    w *= c / b;

/*                    COMBINE THE RESULTS */

    u = d * alnrel(a / b);
    v = a * (log(b) - 1.);
    if (u > v)
    return w - v - u;
    else
    return w - u - v;
}

// Assembly:
subq $0x38, %rsp
movapd %xmm0, %xmm3
ucomisd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
jbe 0x1856e
movapd %xmm1, %xmm2
divsd %xmm3, %xmm2
movsd 0x60dc(%rip), %xmm8     # 0x1e618
movapd %xmm2, %xmm0
addsd %xmm8, %xmm0
divsd %xmm0, %xmm8
divsd %xmm0, %xmm2
movsd 0x722a(%rip), %xmm0     # 0x1f780
addsd %xmm1, %xmm0
addsd %xmm3, %xmm0
movsd %xmm0, 0x8(%rsp)
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
jmp 0x185aa
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
movsd 0x609a(%rip), %xmm2     # 0x1e618
movapd %xmm0, %xmm4
addsd %xmm2, %xmm4
movapd %xmm0, %xmm8
divsd %xmm4, %xmm8
divsd %xmm4, %xmm2
movsd 0x71e4(%rip), %xmm4     # 0x1f780
addsd %xmm3, %xmm4
addsd %xmm1, %xmm4
movsd %xmm4, 0x8(%rsp)
movapd %xmm2, %xmm9
mulsd %xmm2, %xmm9
movapd %xmm2, %xmm3
addsd %xmm9, %xmm3
movsd 0x6053(%rip), %xmm4     # 0x1e618
addsd %xmm4, %xmm3
movapd %xmm9, %xmm5
mulsd %xmm3, %xmm5
addsd %xmm2, %xmm5
addsd %xmm4, %xmm5
movapd %xmm9, %xmm6
mulsd %xmm5, %xmm6
addsd %xmm2, %xmm6
addsd %xmm4, %xmm6
movapd %xmm9, %xmm7
mulsd %xmm6, %xmm7
addsd %xmm2, %xmm7
addsd %xmm4, %xmm7
mulsd %xmm7, %xmm9
addsd %xmm2, %xmm9
addsd %xmm4, %xmm9
movapd %xmm1, %xmm2
mulsd %xmm1, %xmm2
mulsd 0x7554(%rip), %xmm9     # 0x1fb70
mulsd 0x7554(%rip), %xmm7     # 0x1fb78
divsd %xmm2, %xmm4
mulsd %xmm4, %xmm9
mulsd 0x754b(%rip), %xmm6     # 0x1fb80
addsd %xmm7, %xmm9
mulsd %xmm4, %xmm9
mulsd 0x7541(%rip), %xmm5     # 0x1fb88
addsd %xmm6, %xmm9
mulsd %xmm4, %xmm9
mulsd 0x7537(%rip), %xmm3     # 0x1fb90
addsd %xmm5, %xmm9
mulsd %xmm4, %xmm9
addsd %xmm3, %xmm9
mulsd %xmm4, %xmm9
addsd 0x7522(%rip), %xmm9     # 0x1fb98
divsd %xmm1, %xmm8
mulsd %xmm9, %xmm8
movapd %xmm8, 0x20(%rsp)
movsd %xmm1, 0x10(%rsp)
callq 0x17ecb
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x2240
addsd 0x70ff(%rip), %xmm0     # 0x1f7b0
mulsd 0x18(%rsp), %xmm0
movapd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm3
subsd %xmm3, %xmm1
subsd %xmm3, %xmm2
subsd %xmm0, %xmm2
cmpltsd %xmm3, %xmm0
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
addq $0x38, %rsp
retq