// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/quadrature.c
// Function: quadrature_gauss_legendre
int quadrature_gauss_legendre(
			      double *mu,
			      double *w8,
			      int n,
			      double tol,
			      ErrorMsg error_message) {

  int m,j,i,counter;
  double z1,z,pp,p3,p2,p1;

  m=(n+1)/2;
  for (i=1;i<=m;i++) {
    z=cos(_PI_*((double)i-0.25)/((double)n+0.5));
    counter=0;
    do {
      p1=1.0;
      p2=0.0;
      for (j=1;j<=n;j++) {
        p3=p2;
        p2=p1;
        p1=((2.0*j-1.0)*z*p2-(j-1.0)*p3)/j;
      }
      pp=n*(z*p1-p2)/(z*z-1.0);
      z1=z;
      z=z1-p1/pp;
      counter++;
      class_test(counter == _MAX_IT_,
		 error_message,
		 "maximum number of iteration reached: increase either _MAX_IT_ or tol\n");
    } while (fabs(z-z1) > tol);
    mu[i-1]=-z;
    mu[n-i]=z;
    w8[i-1]=2.0/((1.0-z*z)*pp*pp);
    w8[n-i]=w8[i-1];

  }
  return _SUCCESS_;
}

// Assembly:
subq $0x1078, %rsp           # imm = 0x1078
movq %rdi, 0x1068(%rsp)
movq %rsi, 0x1060(%rsp)
movl %edx, 0x105c(%rsp)
movsd %xmm0, 0x1050(%rsp)
movq %rcx, 0x1048(%rsp)
movl 0x105c(%rsp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x1044(%rsp)
movl $0x1, 0x103c(%rsp)
movl 0x103c(%rsp), %eax
cmpl 0x1044(%rsp), %eax
jg 0x3dfa5
cvtsi2sdl 0x103c(%rsp), %xmm1
movsd 0x1950d8(%rip), %xmm0   # 0x1d2cc0
subsd %xmm0, %xmm1
movsd 0x1973ec(%rip), %xmm0   # 0x1d4fe0
mulsd %xmm1, %xmm0
cvtsi2sdl 0x105c(%rsp), %xmm1
movsd 0x19507f(%rip), %xmm2   # 0x1d2c88
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x86a0
movsd %xmm0, 0x1028(%rsp)
movl $0x0, 0x1038(%rsp)
movsd 0x194616(%rip), %xmm0   # 0x1d2248
movsd %xmm0, 0x1008(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x1010(%rsp)
movl $0x1, 0x1040(%rsp)
movl 0x1040(%rsp), %eax
cmpl 0x105c(%rsp), %eax
jg 0x3dd1e
movsd 0x1010(%rsp), %xmm0
movsd %xmm0, 0x1018(%rsp)
movsd 0x1008(%rsp), %xmm0
movsd %xmm0, 0x1010(%rsp)
cvtsi2sdl 0x1040(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd 0x194b31(%rip), %xmm1   # 0x1d27d0
addsd %xmm1, %xmm0
mulsd 0x1028(%rsp), %xmm0
movsd 0x1010(%rsp), %xmm2
cvtsi2sdl 0x1040(%rsp), %xmm1
movsd 0x194582(%rip), %xmm3   # 0x1d2248
subsd %xmm3, %xmm1
mulsd 0x1018(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl 0x1040(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x1008(%rsp)
movl 0x1040(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1040(%rsp)
jmp 0x3dc52
cvtsi2sdl 0x105c(%rsp), %xmm0
movsd 0x1028(%rsp), %xmm1
movsd 0x1008(%rsp), %xmm3
movsd 0x1010(%rsp), %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 0x1028(%rsp), %xmm1
movsd 0x1028(%rsp), %xmm2
mulsd %xmm2, %xmm1
movsd 0x194a4d(%rip), %xmm2   # 0x1d27d0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x1020(%rsp)
movsd 0x1028(%rsp), %xmm0
movsd %xmm0, 0x1030(%rsp)
movsd 0x1030(%rsp), %xmm0
movsd 0x1008(%rsp), %xmm1
divsd 0x1020(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x1028(%rsp)
movl 0x1038(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1038(%rsp)
cmpl $0x2710, 0x1038(%rsp) # imm = 0x2710
jne 0x3de57
leaq 0x800(%rsp), %rdi
leaq 0x19759e(%rip), %rsi    # 0x1d5399
movb $0x0, %al
callq 0x5b9c0
movq %rsp, %rdi
leaq 0x800(%rsp), %rcx
leaq 0x19426e(%rip), %rsi    # 0x1d2082
leaq 0x1975c4(%rip), %rdx    # 0x1d53df
movb $0x0, %al
callq 0x5b9c0
movq 0x1048(%rsp), %rdi
movq %rsp, %r8
leaq 0x194200(%rip), %rsi    # 0x1d2034
leaq 0x1975b8(%rip), %rdx    # 0x1d53f3
movl $0x304, %ecx            # imm = 0x304
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x1074(%rsp)
jmp 0x3dfb0
jmp 0x3de59
movsd 0x1028(%rsp), %xmm0
subsd 0x1030(%rsp), %xmm0
movaps 0x1943be(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
ucomisd 0x1050(%rsp), %xmm0
ja 0x3dc2a
movsd 0x1028(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq 0x1068(%rsp), %rax
movl 0x103c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x1028(%rsp), %xmm0
movq 0x1068(%rsp), %rax
movl 0x105c(%rsp), %ecx
subl 0x103c(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x1028(%rsp), %xmm1
movsd 0x1028(%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm0, %xmm1
movsd 0x19432d(%rip), %xmm0   # 0x1d2248
addsd %xmm0, %xmm1
mulsd 0x1020(%rsp), %xmm1
mulsd 0x1020(%rsp), %xmm1
movsd 0x194d47(%rip), %xmm0   # 0x1d2c80
divsd %xmm1, %xmm0
movq 0x1060(%rsp), %rax
movl 0x103c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x1060(%rsp), %rax
movl 0x103c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x1060(%rsp), %rax
movl 0x105c(%rsp), %ecx
subl 0x103c(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x103c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x103c(%rsp)
jmp 0x3dbc3
movl $0x0, 0x1074(%rsp)
movl 0x1074(%rsp), %eax
addq $0x1078, %rsp           # imm = 0x1078
retq
nop