// File: /workspace/github_c_makefile_star2_O1/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:
movapd %xmm0, %xmm7
ucomisd %xmm1, %xmm0
jbe 0x1c147
movapd %xmm1, %xmm5
divsd %xmm7, %xmm5
movsd 0x54f7(%rip), %xmm4     # 0x21630
movapd %xmm5, %xmm3
movapd %xmm1, %xmm6
movapd %xmm7, %xmm2
jmp 0x1c163
movapd %xmm7, %xmm5
divsd %xmm1, %xmm5
movsd 0x54d9(%rip), %xmm3     # 0x21630
movapd %xmm5, %xmm4
movapd %xmm7, %xmm6
movapd %xmm1, %xmm2
subq $0x38, %rsp
movsd 0x54c1(%rip), %xmm0     # 0x21630
addsd %xmm0, %xmm5
divsd %xmm5, %xmm4
divsd %xmm5, %xmm3
addsd 0x6705(%rip), %xmm6     # 0x22888
addsd %xmm2, %xmm6
movsd %xmm6, 0x8(%rsp)
movapd %xmm3, %xmm8
mulsd %xmm3, %xmm8
movapd %xmm3, %xmm2
addsd %xmm8, %xmm2
addsd %xmm0, %xmm2
movapd %xmm4, %xmm9
movapd %xmm8, %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
addsd %xmm0, %xmm4
movapd %xmm8, %xmm5
mulsd %xmm4, %xmm5
addsd %xmm3, %xmm5
addsd %xmm0, %xmm5
movapd %xmm8, %xmm6
mulsd %xmm5, %xmm6
addsd %xmm3, %xmm6
addsd %xmm0, %xmm6
mulsd %xmm6, %xmm8
addsd %xmm3, %xmm8
addsd %xmm0, %xmm8
movapd %xmm1, %xmm3
mulsd %xmm1, %xmm3
mulsd 0x6c64(%rip), %xmm8     # 0x22e60
divsd %xmm3, %xmm0
mulsd 0x6c60(%rip), %xmm6     # 0x22e68
mulsd %xmm0, %xmm8
addsd %xmm6, %xmm8
mulsd 0x6c56(%rip), %xmm5     # 0x22e70
mulsd %xmm0, %xmm8
addsd %xmm5, %xmm8
mulsd 0x6c4c(%rip), %xmm4     # 0x22e78
mulsd %xmm0, %xmm8
addsd %xmm4, %xmm8
mulsd 0x6c42(%rip), %xmm2     # 0x22e80
mulsd %xmm0, %xmm8
addsd %xmm2, %xmm8
mulsd %xmm0, %xmm8
addsd 0x6c32(%rip), %xmm8     # 0x22e88
divsd %xmm1, %xmm9
mulsd %xmm8, %xmm9
movapd %xmm9, 0x20(%rsp)
movapd %xmm7, %xmm0
divsd %xmm1, %xmm0
movsd %xmm7, 0x18(%rsp)
movsd %xmm1, 0x10(%rsp)
callq 0x1ba27
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x2240
addsd 0x66b1(%rip), %xmm0     # 0x22950
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