// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../tools/quadrature.c
// Function: gk_quad
int gk_quad(int (*test)(void * params_for_function, double q, double *psi),
	    int (*function)(void * params_for_function, double q, double *f0),
	    void * params_for_function,
	    qss_node* node,
	    double a,
	    double b,
	    int isindefinite){
  const double z_k[15]={-0.991455371120813,
			-0.949107912342759,
			-0.864864423359769,
			-0.741531185599394,
			-0.586087235467691,
			-0.405845151377397,
			-0.207784955007898,
			0.0,
			0.207784955007898,
			0.405845151377397,
			0.586087235467691,
			0.741531185599394,
			0.864864423359769,
			0.949107912342759,
			0.991455371120813};
  const double w_k[15]={0.022935322010529,
			0.063092092629979,
			0.104790010322250,
			0.140653259715525,
			0.169004726639267,
			0.190350578064785,
			0.204432940075298,
			0.209482141084728,
			0.204432940075298,
			0.190350578064785,
			0.169004726639267,
			0.140653259715525,
			0.104790010322250,
			0.063092092629979,
			0.022935322010529};
  const double w_g[7]={0.129484966168870,
		       0.279705391489277,
		       0.381830050505119,
		       0.417959183673469,
		       0.381830050505119,
		       0.279705391489277,
		       0.129484966168870};
  int i,j;
  double x,wg,wk,t,Ik,Ig,y,y2;

  /* 	Loop through abscissas, transform the interval and form the Kronrod
     15 point estimate of the integral.
     Every second time we update the Gauss 7 point quadrature estimate. */

  Ik=0.0;
  Ig=0.0;
  for (i=0;i<15;i++){
    /* Transform z into t in interval between a and b: */
    t = 0.5*(a*(1-z_k[i])+b*(1+z_k[i]));
    /* Modify weight such that it reflects the linear transformation above: */
    wk = 0.5*(b-a)*w_k[i];
    if (isindefinite==_TRUE_){
      /* Transform t into x in interval between 0 and inf: */
      x = 1.0/t-1.0;
      /* Modify weight accordingly: */
      wk = wk/(t*t);
    }
    else{
      x = t;
    }
    (*test)(params_for_function,x,&y);
    (*function)(params_for_function,x,&y2);
    wk *= y2;
    /* Update Kronrod integral: */
    Ik +=wk*y;
    /* If node->x and node->w is allocated, store values: */
    if (node->x!=NULL) node->x[i] = x;
    if (node->w!=NULL) node->w[i] = wk;
    /* If i is uneven, update Gauss integral: */
    if ((i%2)==1){
      j = (i-1)/2;
      /* Transform weight according to linear transformation: */
      wg = 0.5*(b-a)*w_g[j];
      if (isindefinite == _TRUE_){
        /* Transform weight according to non-linear transformation x = 1/t -1: */
        wg = wg/(t*t);
      }
      /* Update integral: */
      Ig +=wg*y*y2;
    }
  }
  node->err = pow(200*fabs(Ik-Ig),1.5);
  node->I = Ik;
  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %ebp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, 0x38(%rsp)
movq %rdi, %r12
movsd %xmm1, 0x48(%rsp)
movsd %xmm0, 0x40(%rsp)
subsd %xmm0, %xmm1
mulsd 0xcd3df(%rip), %xmm1    # 0xeecd0
movsd %xmm1, 0x10(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
movsd %xmm0, 0x8(%rsp)
leaq 0xcf6dd(%rip), %rax     # 0xf0ff0
movsd (%r13,%rax), %xmm1
movsd 0xcc93e(%rip), %xmm2    # 0xee260
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
addsd %xmm2, %xmm1
mulsd 0x48(%rsp), %xmm1
mulsd 0x40(%rsp), %xmm0
addsd %xmm1, %xmm0
mulsd 0xcd38a(%rip), %xmm0    # 0xeecd0
leaq 0xcf723(%rip), %rax     # 0xf1070
movsd (%r13,%rax), %xmm3
mulsd 0x10(%rsp), %xmm3
divsd %xmm0, %xmm2
addsd 0xcce82(%rip), %xmm2    # 0xee7e8
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
cmpl $0x1, %ebp
movsd %xmm1, 0x50(%rsp)
je 0x2197f
movapd %xmm0, %xmm2
jmp 0x21983
divsd %xmm1, %xmm3
movsd %xmm3, 0x18(%rsp)
movsd %xmm2, 0x20(%rsp)
movq %r14, %rdi
movapd %xmm2, %xmm0
leaq 0x30(%rsp), %rsi
callq *%r12
movq %r14, %rdi
movsd 0x20(%rsp), %xmm0
leaq 0x28(%rsp), %rsi
callq *0x38(%rsp)
movsd 0x18(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm0
mulsd %xmm1, %xmm0
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x219db
movsd 0x20(%rsp), %xmm2
movsd %xmm2, (%rax,%r15,8)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x219ea
movsd %xmm1, (%rax,%r15,8)
testb $0x1, %r15b
je 0x21a2d
leal -0x1(%r15), %eax
shrl %eax
leaq 0xcf6f3(%rip), %rcx     # 0xf10f0
movsd (%rcx,%rax,8), %xmm1
mulsd 0x10(%rsp), %xmm1
cmpl $0x1, %ebp
jne 0x21a13
divsd 0x50(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm1
movsd (%rsp), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rsp)
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
incq %r15
addq $0x8, %r13
cmpq $0xf, %r15
jne 0x21906
movsd %xmm0, 0x8(%rsp)
subsd (%rsp), %xmm0
andpd 0xcc7e1(%rip), %xmm0    # 0xee240
mulsd 0xcf569(%rip), %xmm0    # 0xf0fd0
movsd 0xcf559(%rip), %xmm1    # 0xf0fc8
callq 0x8620
movsd %xmm0, 0x8(%rbx)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx)
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq