// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/quadrature.c
// Function: compute_Laguerre
int compute_Laguerre(double *x, double *w, int N, double alpha, double *b, double *c,int totalweight){
  int i,j,iter,maxiter=10;
  double x0=0.,r1,r2,ratio,d,logprod,logcc;
  double p0,p1,p2,dp0,dp1,dp2;
  double eps=1e-14;
  /* Initialise recursion coefficients: */
  for(i=0; i<N; i++){
    b[i] = alpha + 2.0*i +1.0;
    c[i] = i*(alpha+i);
  }
  logprod = 0.0;
  for(i=1; i<N; i++) logprod +=log(c[i]);
  logcc = lgamma(alpha+1)+logprod;

  /* Loop over roots: */
  for (i=0; i<N; i++){
    /* Estimate root: */
    if (i==0) {
      x0 =(1.0+alpha)*(3.0+0.92*alpha)/( 1.0+2.4*N+1.8*alpha);
    }
    else if (i==1){
      x0 += (15.0+6.25*alpha)/( 1.0+0.9*alpha+2.5*N);
    }
    else{
      r1 = (1.0+2.55*(i-1))/( 1.9*(i-1));
      r2 = 1.26*(i-1)*alpha/(1.0+3.5*(i-1));
      ratio = (r1+r2)/(1.0+0.3*alpha);
      x0 += ratio*(x0-x[i-2]);
    }
    /* Refine root using Newtons method: */
    for(iter=1; iter<=maxiter; iter++){
      /* We need to find p2=L_N(x0), dp2=L'_N(x0) and
	 p1 = L_(N-1)(x0): */
      p1 = 1.0;
      dp1 = 0.0;
      p2 = x0 - alpha - 1.0;
      dp2 = 1.0;
      for (j=1; j<N; j++ ){
	p0 = p1;
	dp0 = dp1;
	p1 = p2;
	dp1 = dp2;
	p2  = (x0-b[j])*p1 - c[j]*p0;
	dp2 = (x0-b[j])*dp1 + p1 - c[j]*dp0;
      }
      /* New guess at root: */
      d = p2/dp2;
      x0 -= d;
      if (fabs(d)<=eps*(fabs(x0)+1.0)) break;
    }
    /* Okay, write root and weight: */
    x[i] = x0;

    if (totalweight == _TRUE_)
      w[i] = exp(x0+logcc-log(dp2*p1));
    else
       w[i] = exp(logcc-log(dp2*p1));
  }

  return _SUCCESS_;

}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movl %edx, 0xb4(%rsp)
movsd %xmm0, 0xa8(%rsp)
movq %rcx, 0xa0(%rsp)
movq %r8, 0x98(%rsp)
movl %r9d, 0x94(%rsp)
movl $0xa, 0x84(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x199b9d(%rip), %xmm0   # 0x1d4f58
movsd %xmm0, 0x10(%rsp)
movl $0x0, 0x90(%rsp)
movl 0x90(%rsp), %eax
cmpl 0xb4(%rsp), %eax
jge 0x3b469
movsd 0xa8(%rsp), %xmm1
cvtsi2sdl 0x90(%rsp), %xmm0
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0x196e46(%rip), %xmm1   # 0x1d2248
addsd %xmm1, %xmm0
movq 0xa0(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
cvtsi2sdl 0x90(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
cvtsi2sdl 0x90(%rsp), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x98(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x90(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x90(%rsp)
jmp 0x3b3cc
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
movl $0x1, 0x90(%rsp)
movl 0x90(%rsp), %eax
cmpl 0xb4(%rsp), %eax
jge 0x3b4c6
movq 0x98(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x82f0
addsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movl 0x90(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x90(%rsp)
jmp 0x3b47d
movsd 0x196d7a(%rip), %xmm0   # 0x1d2248
addsd 0xa8(%rsp), %xmm0
callq 0x82c0
addsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movl $0x0, 0x90(%rsp)
movl 0x90(%rsp), %eax
cmpl 0xb4(%rsp), %eax
jge 0x3b9ff
cmpl $0x0, 0x90(%rsp)
jne 0x3b590
movsd 0x196d2f(%rip), %xmm0   # 0x1d2248
addsd 0xa8(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movsd 0x199a6d(%rip), %xmm2   # 0x1d4fa0
mulsd %xmm2, %xmm1
movsd 0x198159(%rip), %xmm2   # 0x1d3698
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdl 0xb4(%rsp), %xmm2
movsd 0x199a40(%rip), %xmm1   # 0x1d4f98
mulsd %xmm1, %xmm2
movsd 0x196ce4(%rip), %xmm1   # 0x1d2248
addsd %xmm1, %xmm2
movsd 0xa8(%rsp), %xmm1
movsd 0x199a17(%rip), %xmm3   # 0x1d4f90
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
jmp 0x3b71a
cmpl $0x1, 0x90(%rsp)
jne 0x3b60a
movsd 0xa8(%rsp), %xmm0
movsd 0x1999d5(%rip), %xmm1   # 0x1d4f80
mulsd %xmm1, %xmm0
movsd 0x1999d1(%rip), %xmm1   # 0x1d4f88
addsd %xmm1, %xmm0
movsd 0xa8(%rsp), %xmm2
movsd 0x196c8c(%rip), %xmm1   # 0x1d2258
mulsd %xmm1, %xmm2
movsd 0x196c70(%rip), %xmm1   # 0x1d2248
addsd %xmm1, %xmm2
cvtsi2sdl 0xb4(%rsp), %xmm1
movsd 0x196d3b(%rip), %xmm3   # 0x1d2328
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
addsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
jmp 0x3b718
movl 0x90(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm0
movsd 0x199958(%rip), %xmm1   # 0x1d4f78
mulsd %xmm1, %xmm0
movsd 0x196c1c(%rip), %xmm1   # 0x1d2248
addsd %xmm1, %xmm0
movl 0x90(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm2
movsd 0x19992a(%rip), %xmm1   # 0x1d4f70
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
movl 0x90(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
movsd 0x1998fe(%rip), %xmm0   # 0x1d4f68
mulsd %xmm1, %xmm0
mulsd 0xa8(%rsp), %xmm0
movl 0x90(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
movsd 0x1998d3(%rip), %xmm2   # 0x1d4f60
mulsd %xmm2, %xmm1
movsd 0x196baf(%rip), %xmm2   # 0x1d2248
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x70(%rsp), %xmm0
addsd 0x68(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movsd 0x196bc4(%rip), %xmm2   # 0x1d2288
mulsd %xmm2, %xmm1
movsd 0x196b78(%rip), %xmm2   # 0x1d2248
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x60(%rsp), %xmm0
movsd 0x78(%rsp), %xmm2
movq 0xc0(%rsp), %rax
movl 0x90(%rsp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm2
movsd 0x78(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
jmp 0x3b71a
movl $0x1, 0x88(%rsp)
movl 0x88(%rsp), %eax
cmpl 0x84(%rsp), %eax
jg 0x3b934
movsd 0x196b07(%rip), %xmm0   # 0x1d2248
movsd %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x78(%rsp), %xmm0
subsd 0xa8(%rsp), %xmm0
movsd 0x196ae1(%rip), %xmm1   # 0x1d2248
subsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x196acf(%rip), %xmm0   # 0x1d2248
movsd %xmm0, 0x18(%rsp)
movl $0x1, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
cmpl 0xb4(%rsp), %eax
jge 0x3b8b4
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x78(%rsp), %xmm0
movq 0xa0(%rsp), %rax
movslq 0x8c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd 0x38(%rsp), %xmm2
movq 0x98(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x40(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x78(%rsp), %xmm1
movq 0xa0(%rsp), %rax
movslq 0x8c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x38(%rsp), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq 0x98(%rsp), %rax
movslq 0x8c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x28(%rsp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x3b78a
movsd 0x30(%rsp), %xmm0
divsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x58(%rsp), %xmm1
movsd 0x78(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x58(%rsp), %xmm1
movaps 0x196947(%rip), %xmm0   # 0x1d2230
pand %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movsd 0x78(%rsp), %xmm2
movaps 0x196930(%rip), %xmm3   # 0x1d2230
pand %xmm3, %xmm2
movsd 0x19693c(%rip), %xmm3   # 0x1d2248
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x3b91c
jmp 0x3b934
jmp 0x3b91e
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x3b725
movsd 0x78(%rsp), %xmm0
movq 0xc0(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
cmpl $0x1, 0x94(%rsp)
jne 0x3b9a5
movsd 0x78(%rsp), %xmm0
addsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
subsd %xmm1, %xmm0
callq 0x8670
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3b9e7
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x18(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
subsd %xmm1, %xmm0
callq 0x8670
movq 0xb8(%rsp), %rax
movslq 0x90(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3b9e9
movl 0x90(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x90(%rsp)
jmp 0x3b4f3
xorl %eax, %eax
addq $0xc8, %rsp
retq
nopl (%rax)