// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]sassafras/sassafras.c
// Function: incbeta
double
incbeta(double a, double b, double x)
{
	// begin altered source
	// if (x < 0.0 || x > 1.0) return 1.0/0.0;
	if (x <= 0.0)
		return 0.0;
	if (x >= 1.0)
		return 1.0;
	// end altered source

	/*The continued fraction converges nicely for x < (a+1)/(a+b+2)*/
	if (x > (a+1.0)/(a+b+2.0)) {
		return (1.0-incbeta(b,a,1.0-x)); /*Use the fact that beta is symmetrical.*/
	}

	/*Find the first part before the continued fraction.*/
	const double lbeta_ab = lgamma(a)+lgamma(b)-lgamma(a+b);
	const double front = exp(log(x)*a+log(1.0-x)*b-lbeta_ab) / a;

	/*Use Lentz's algorithm to evaluate the continued fraction.*/
	double f = 1.0, c = 1.0, d = 0.0;

	int i, m;
	for (i = 0; i <= 200; ++i) {
		m = i/2;

		double numerator;
		if (i == 0) {
			numerator = 1.0; /*First numerator is 1.0.*/
		} else if (i % 2 == 0) {
			numerator = (m*(b-m)*x)/((a+2.0*m-1.0)*(a+2.0*m)); /*Even term.*/
		} else {
			numerator = -((a+m)*(a+b+m)*x)/((a+2.0*m)*(a+2.0*m+1)); /*Odd term.*/
		}

		/*Do an iteration of Lentz's algorithm.*/
		d = 1.0 + numerator * d;
		if (fabs(d) < TINY) d = TINY;
		d = 1.0 / d;

		c = 1.0 + numerator / c;
		if (fabs(c) < TINY) c = TINY;

		const double cd = c*d;
		f *= cd;

		/*Check for stop.*/
		if (fabs(1.0-cd) < STOP) {
			return front * (f-1.0);
		}
	}

	return 1.0/0.0; /*Needed more loops, did not converge.*/
}

// Assembly:
movapd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm2, %xmm0
jae 0x3ec5
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movapd %xmm2, %xmm4
movsd 0x7693(%rip), %xmm0     # 0xb2c8
ucomisd %xmm0, %xmm2
jae 0x3ec0
movsd 0x7681(%rip), %xmm0     # 0xb2c8
addsd %xmm3, %xmm0
movapd %xmm3, %xmm5
addsd %xmm1, %xmm5
movsd 0x7675(%rip), %xmm2     # 0xb2d0
addsd %xmm5, %xmm2
divsd %xmm2, %xmm0
ucomisd %xmm0, %xmm4
jbe 0x3c97
movsd 0x7657(%rip), %xmm2     # 0xb2c8
subsd %xmm4, %xmm2
movapd %xmm1, %xmm0
movapd %xmm3, %xmm1
callq 0x3c0f
movsd 0x763e(%rip), %xmm1     # 0xb2c8
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x3ec0
movapd %xmm3, %xmm0
movsd %xmm3, -0x20(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm4, -0x10(%rbp)
movsd %xmm5, -0x28(%rbp)
callq 0x2180
movsd %xmm0, -0x8(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x2180
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x28(%rbp), %xmm0
callq 0x2180
movsd -0x8(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x8(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x2120
movsd %xmm0, -0x30(%rbp)
movsd 0x75cc(%rip), %xmm0     # 0xb2c8
subsd -0x10(%rbp), %xmm0
callq 0x2120
mulsd -0x18(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
mulsd -0x20(%rbp), %xmm1
addsd %xmm1, %xmm0
subsd -0x8(%rbp), %xmm0
callq 0x2230
movsd 0x759d(%rip), %xmm7     # 0xb2c8
movsd -0x10(%rbp), %xmm15
movsd -0x18(%rbp), %xmm14
movsd -0x20(%rbp), %xmm13
divsd %xmm13, %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
movapd 0x7550(%rip), %xmm2     # 0xb2a0
movsd 0x7588(%rip), %xmm3     # 0xb2e0
movsd 0x7588(%rip), %xmm4     # 0xb2e8
movsd 0x7588(%rip), %xmm6     # 0xb2f0
movapd %xmm7, %xmm5
movapd %xmm7, %xmm9
movapd %xmm7, %xmm8
movapd %xmm7, %xmm10
testl %eax, %eax
je 0x3e1c
movl %eax, %ecx
shrl %ecx
xorps %xmm12, %xmm12
cvtsi2sd %ecx, %xmm12
movapd %xmm12, %xmm11
addsd %xmm12, %xmm11
testb $0x1, %al
jne 0x3dd6
movapd %xmm14, %xmm10
subsd %xmm12, %xmm10
mulsd %xmm12, %xmm10
mulsd %xmm15, %xmm10
addsd %xmm13, %xmm11
movapd %xmm11, %xmm12
addsd 0x7513(%rip), %xmm12    # 0xb2d8
mulsd %xmm11, %xmm12
divsd %xmm12, %xmm10
movapd %xmm8, %xmm7
jmp 0x3e1c
movsd -0x28(%rbp), %xmm10
addsd %xmm12, %xmm10
addsd %xmm13, %xmm12
xorpd 0x74a1(%rip), %xmm12    # 0xb290
mulsd %xmm10, %xmm12
mulsd %xmm15, %xmm12
addsd %xmm13, %xmm11
movapd %xmm11, %xmm10
movapd %xmm8, %xmm7
addsd %xmm8, %xmm10
mulsd %xmm11, %xmm10
divsd %xmm10, %xmm12
movapd %xmm12, %xmm10
mulsd %xmm10, %xmm1
addsd %xmm7, %xmm1
divsd %xmm1, %xmm7
andpd %xmm2, %xmm1
cmpltsd %xmm3, %xmm1
movapd %xmm1, %xmm12
andnpd %xmm7, %xmm12
andpd %xmm4, %xmm1
orpd %xmm12, %xmm1
divsd %xmm9, %xmm10
addsd %xmm8, %xmm10
movapd %xmm10, %xmm9
andpd %xmm2, %xmm9
cmpltsd %xmm3, %xmm9
movapd %xmm9, %xmm11
andnpd %xmm10, %xmm11
andpd %xmm3, %xmm9
orpd %xmm11, %xmm9
movapd %xmm1, %xmm10
mulsd %xmm9, %xmm10
mulsd %xmm10, %xmm5
movapd %xmm8, %xmm11
subsd %xmm10, %xmm11
andpd %xmm2, %xmm11
ucomisd %xmm11, %xmm6
ja 0x3eb4
movapd %xmm8, %xmm7
incl %eax
cmpl $0xc9, %eax
jne 0x3d76
movsd 0x7446(%rip), %xmm0     # 0xb2f8
jmp 0x3ec0
addsd 0x741c(%rip), %xmm5     # 0xb2d8
mulsd %xmm5, %xmm0
addq $0x30, %rsp
popq %rbp
retq