// File: /workspace/github_c_makefile_star2_O0/esheldon[P]xshear/src/cosmo.c
// Function: gauleg
void gauleg(double x1, double x2, int npts, double* x, double* w) {
	int i, j, m;
	double xm, xl, z1, z, p1, p2, p3, pp=0, EPS, abszdiff;

	EPS = 4.e-11;

	m = (npts + 1)/2;

	xm = (x1 + x2)/2.0;
	xl = (x2 - x1)/2.0;
	z1 = 0.0;

	for (i=1; i<= m; ++i) 
	{

		z=cos( M_PI*(i-0.25)/(npts+.5) );

		abszdiff = fabs(z-z1);

		while (abszdiff > EPS) 
		{
			p1 = 1.0;
			p2 = 0.0;
			for (j=1; j <= npts;++j)
			{
				p3 = p2;
				p2 = p1;
				p1 = ( (2.0*j - 1.0)*z*p2 - (j-1.0)*p3 )/j;
			}
			pp = npts*(z*p1 - p2)/(z*z -1.);
			z1=z;
			z=z1 - p1/pp;

			abszdiff = fabs(z-z1);

		}

		x[i-1] = xm - xl*z;
		x[npts+1-i-1] = xm + xl*z;
		w[i-1] = 2.0*xl/( (1.-z*z)*pp*pp );
		w[npts+1-i-1] = w[i-1];


	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movsd %xmm0, -0x8(%rbp)
movsd %xmm1, -0x10(%rbp)
movl %edi, -0x14(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd 0xa748(%rip), %xmm0     # 0xe158
movsd %xmm0, -0x80(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x34(%rbp)
movsd -0x8(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
movsd 0xa5e0(%rip), %xmm1     # 0xe018
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x10(%rbp), %xmm0
subsd -0x8(%rbp), %xmm0
movsd 0xa5c5(%rip), %xmm1     # 0xe018
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x3d32
cvtsi2sdl -0x2c(%rbp), %xmm1
movsd 0xa6dc(%rip), %xmm0     # 0xe160
subsd %xmm0, %xmm1
movsd 0xa5b8(%rip), %xmm0     # 0xe048
mulsd %xmm1, %xmm0
cvtsi2sdl -0x14(%rbp), %xmm1
movsd 0xa5c7(%rip), %xmm2     # 0xe068
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x2120
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
movaps 0xa5ec(%rip), %xmm1     # 0xe0b0
pand %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm0
ucomisd -0x80(%rbp), %xmm0
jbe 0x3c2d
movsd 0xa53d(%rip), %xmm0     # 0xe028
movsd %xmm0, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x3b8f
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
cvtsi2sdl -0x30(%rbp), %xmm0
addsd %xmm0, %xmm0
movsd 0xa510(%rip), %xmm1     # 0xe040
addsd %xmm1, %xmm0
mulsd -0x58(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
cvtsi2sdl -0x30(%rbp), %xmm1
movsd 0xa4dd(%rip), %xmm3     # 0xe028
subsd %xmm3, %xmm1
mulsd -0x70(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl -0x30(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3aff
cvtsi2sdl -0x14(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x60(%rbp), %xmm3
movsd -0x68(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
mulsd %xmm2, %xmm1
movsd 0xa464(%rip), %xmm2     # 0xe040
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
divsd -0x78(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
movaps 0xa494(%rip), %xmm1     # 0xe0b0
pand %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
jmp 0x3ad0
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
movsd -0x58(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
movsd -0x58(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
subl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0xa374(%rip), %xmm0     # 0xe018
mulsd -0x48(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
movsd 0xa352(%rip), %xmm2     # 0xe028
addsd %xmm2, %xmm1
mulsd -0x78(%rbp), %xmm1
mulsd -0x78(%rbp), %xmm1
divsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
subl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3a6b
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)