// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/hyperspherical.c
// Function: fzero_ridder
int fzero_ridder(double (*func)(double, void *),
                  double x1,
                  double x2,
                  double xtol,
                  void *param,
                  double *Fx1,
                  double *Fx2,
                  double *xzero,
                  int *fevals){
   /**Using Ridders' method, return the root of a function func known to
      lie between x1 and x2. The root, returned as zriddr, will be found to
      an approximate accuracy xtol.
   */
   int j,MAXIT=1000;
    double ans,fh,fl,fm,fnew,s,xh,xl,xm,xnew;
    if ((Fx1!=NULL)&&(Fx2!=NULL)){
      fl = *Fx1;
      fh = *Fx2;
    }
    else{
      fl=(*func)(x1,param);
      fh=(*func)(x2,param);
      *fevals = (*fevals)+2;
    }
    if ((fl > 0.0 && fh < 0.0) || (fl < 0.0 && fh > 0.0)) {
      xl=x1;
      xh=x2;
      ans=-1.11e11;
      for (j=1;j<=MAXIT;j++) {
        xm=0.5*(xl+xh);
        fm=(*func)(xm,param);
        *fevals = (*fevals)+1;
        s=sqrt(fm*fm-fl*fh);
        if (s == 0.0){
          *xzero = ans;
          //printf("Success 1\n");
          return _SUCCESS_;
        }
        xnew=xm+(xm-xl)*((fl >= fh ? 1.0 : -1.0)*fm/s);
        if (fabs(xnew-ans) <= xtol) {
          *xzero = ans;
          return _SUCCESS_;
        }
        ans=xnew;
        fnew=(*func)(ans,param);
        *fevals = (*fevals)+1;
        if (fnew == 0.0){
          *xzero = ans;
          //printf("Success 2, ans=%g\n",ans);
          return _SUCCESS_;
        }
        if (NRSIGN(fm,fnew) != fm) {
          xl=xm;
          fl=fm;
          xh=ans;
          fh=fnew;
        } else if (NRSIGN(fl,fnew) != fl) {
          xh=ans;
          fh=fnew;
        } else if (NRSIGN(fh,fnew) != fh) {
          xl=ans;
          fl=fnew;
        } else return _FAILURE_;
        if (fabs(xh-xl) <= xtol) {
          *xzero = ans;
          //        printf("Success 3\n");
          return _SUCCESS_;
        }
      }
      fprintf(stderr,"zriddr exceed maximum iterations");
      return _FAILURE_;
    }
    else {
      if (fl == 0.0) return x1;
      if (fh == 0.0) return x2;
      fprintf(stderr,"root must be bracketed in zriddr.");
      return _FAILURE_;
    }
    fprintf(stderr,"Failure in Ridder\n");
    return _FAILURE_;
  }

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movsd %xmm0, 0xb0(%rsp)
movsd %xmm1, 0xa8(%rsp)
movsd %xmm2, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movq %r9, 0x78(%rsp)
movl $0x3e8, 0x70(%rsp)      # imm = 0x3E8
cmpq $0x0, 0x90(%rsp)
je 0x44fe3
cmpq $0x0, 0x88(%rsp)
je 0x44fe3
movq 0x90(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x88(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x45036
movq 0xb8(%rsp), %rax
movsd 0xb0(%rsp), %xmm0
movq 0x98(%rsp), %rdi
callq *%rax
movsd %xmm0, 0x58(%rsp)
movq 0xb8(%rsp), %rax
movsd 0xa8(%rsp), %xmm0
movq 0x98(%rsp), %rdi
callq *%rax
movsd %xmm0, 0x60(%rsp)
movq 0x78(%rsp), %rax
movl (%rax), %ecx
addl $0x2, %ecx
movq 0x78(%rsp), %rax
movl %ecx, (%rax)
movsd 0x58(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x45050
xorps %xmm0, %xmm0
ucomisd 0x60(%rsp), %xmm0
ja 0x45072
xorps %xmm0, %xmm0
ucomisd 0x58(%rsp), %xmm0
jbe 0x454bf
movsd 0x60(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x454bf
movsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x190520(%rip), %xmm0   # 0x1d55b8
movsd %xmm0, 0x68(%rsp)
movl $0x1, 0x74(%rsp)
movl 0x74(%rsp), %eax
cmpl 0x70(%rsp), %eax
jg 0x4549a
movsd 0x30(%rsp), %xmm1
addsd 0x38(%rsp), %xmm1
movsd 0x18dbc0(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0xb8(%rsp), %rax
movsd 0x28(%rsp), %xmm0
movq 0x98(%rsp), %rdi
callq *%rax
movsd %xmm0, 0x50(%rsp)
movq 0x78(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x78(%rsp), %rax
movl %ecx, (%rax)
movsd 0x50(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
movsd 0x58(%rsp), %xmm1
mulsd 0x60(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x45176
jp 0x45176
movsd 0x68(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0xc4(%rsp)
jmp 0x45528
movsd 0x28(%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
subsd 0x30(%rsp), %xmm0
movsd 0x58(%rsp), %xmm3
movsd 0x60(%rsp), %xmm2
movsd 0x18d0ac(%rip), %xmm5   # 0x1d2248
movsd 0x18d62c(%rip), %xmm4   # 0x1d27d0
cmplesd %xmm3, %xmm2
movaps %xmm2, %xmm3
andpd %xmm5, %xmm3
andnpd %xmm4, %xmm2
orpd %xmm3, %xmm2
mulsd 0x50(%rsp), %xmm2
divsd 0x40(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm1
subsd 0x68(%rsp), %xmm1
movaps 0x18d04b(%rip), %xmm0   # 0x1d2230
pand %xmm0, %xmm1
movsd 0xa0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x4521a
movsd 0x68(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0xc4(%rsp)
jmp 0x45528
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0xb8(%rsp), %rax
movsd 0x68(%rsp), %xmm0
movq 0x98(%rsp), %rdi
callq *%rax
movsd %xmm0, 0x48(%rsp)
movq 0x78(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x78(%rsp), %rax
movl %ecx, (%rax)
movsd 0x48(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x45288
jp 0x45288
movsd 0x68(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0xc4(%rsp)
jmp 0x45528
movsd 0x48(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x452b0
movsd 0x50(%rsp), %xmm0
movaps 0x18cf8c(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x452de
movsd 0x50(%rsp), %xmm0
movaps 0x18cf73(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
ucomisd 0x50(%rsp), %xmm0
jne 0x452f0
jp 0x452f0
jmp 0x45325
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x45440
movsd 0x48(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4534d
movsd 0x58(%rsp), %xmm0
movaps 0x18ceef(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x4537b
movsd 0x58(%rsp), %xmm0
movaps 0x18ced6(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
ucomisd 0x58(%rsp), %xmm0
jne 0x4538d
jp 0x4538d
jmp 0x453aa
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x4543e
movsd 0x48(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x453d2
movsd 0x60(%rsp), %xmm0
movaps 0x18ce6a(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x45400
movsd 0x60(%rsp), %xmm0
movaps 0x18ce51(%rip), %xmm1   # 0x1d2230
pand %xmm1, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
ucomisd 0x60(%rsp), %xmm0
jne 0x45412
jp 0x45412
jmp 0x4542c
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
jmp 0x4543c
movl $0x1, 0xc4(%rsp)
jmp 0x45528
jmp 0x4543e
jmp 0x45440
movsd 0x38(%rsp), %xmm1
subsd 0x30(%rsp), %xmm1
movaps 0x18cddd(%rip), %xmm0   # 0x1d2230
pand %xmm0, %xmm1
movsd 0xa0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x45488
movsd 0x68(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0xc4(%rsp)
jmp 0x45528
jmp 0x4548a
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x450a6
movq 0x1feb2f(%rip), %rax    # 0x243fd0
movq (%rax), %rdi
leaq 0x190d94(%rip), %rsi    # 0x1d623f
movb $0x0, %al
callq 0x84e0
movl $0x1, 0xc4(%rsp)
jmp 0x45528
movsd 0x58(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x454e2
jp 0x454e2
cvttsd2si 0xb0(%rsp), %eax
movl %eax, 0xc4(%rsp)
jmp 0x45528
movsd 0x60(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x45505
jp 0x45505
cvttsd2si 0xa8(%rsp), %eax
movl %eax, 0xc4(%rsp)
jmp 0x45528
movq 0x1feac4(%rip), %rax    # 0x243fd0
movq (%rax), %rdi
leaq 0x190d4a(%rip), %rsi    # 0x1d6260
movb $0x0, %al
callq 0x84e0
movl $0x1, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
addq $0xc8, %rsp
retq
nopw (%rax,%rax)