// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/input.c
// Function: input_fzero_ridder
int input_fzero_ridder(int (*func)(double x,
                                   void *param,
                                   double *y,
                                   ErrorMsg error_message),
                       double x1,
                       double x2,
                       double xtol,
                       void *param,
                       double *Fx1,
                       double *Fx2,
                       double *xzero,
                       int *fevals,
                       ErrorMsg error_message){

  /** Summary: */

  /** Define local variables */
  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{
    class_call((*func)(x1, param, &fl, error_message),
               error_message, error_message);
    class_call((*func)(x2, param, &fh, error_message),
               error_message, error_message);

    *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);
      class_call((*func)(xm, param, &fm, error_message),
                 error_message, error_message);
      *fevals = (*fevals)+1;
      s=sqrt(fm*fm-fl*fh);
      if (s == 0.0){
        *xzero = ans;
        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;
      class_call((*func)(ans, param, &fnew, error_message),
                 error_message, error_message);
      *fevals = (*fevals)+1;
      if (fnew == 0.0){
        *xzero = 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;
        return _SUCCESS_;
      }
    }
    class_stop(error_message,"zriddr exceed maximum iterations");
  }

  else {
    if (fl == 0.0) return x1;
    if (fh == 0.0) return x2;
    class_stop(error_message,"root must be bracketed in zriddr.");
  }
  class_stop(error_message,"Failure in int.");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1068, %rsp           # imm = 0x1068
movq %r9, %r15
movq %r8, %r14
movq %rsi, %r12
movsd %xmm2, 0x48(%rsp)
movsd %xmm1, 0x18(%rsp)
movq %rdi, %r13
movq 0x10a0(%rsp), %rbx
testq %rdx, %rdx
sete %al
testq %rcx, %rcx
sete %sil
orb %al, %sil
jne 0x3fa8d
movsd (%rdx), %xmm1
movsd %xmm1, (%rsp)
movsd (%rcx), %xmm3
movsd %xmm3, 0x8(%rsp)
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x3f7e9
ucomisd %xmm3, %xmm2
ja 0x3f7fd
ucomisd %xmm1, %xmm2
jbe 0x3fb33
ucomisd %xmm2, %xmm3
jbe 0x3fb33
movq %r14, 0x20(%rsp)
movsd 0xb1d7e(%rip), %xmm4    # 0xf1588
movl $0x3e8, %r14d           # imm = 0x3E8
leaq 0x28(%rsp), %rbp
movsd 0x18(%rsp), %xmm1
movsd %xmm4, 0x30(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
addsd %xmm0, %xmm1
mulsd 0xaf497(%rip), %xmm1    # 0xeecd0
movsd %xmm1, 0x50(%rsp)
movapd %xmm1, %xmm0
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
je 0x3fb74
incl (%r15)
movsd 0x28(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
mulsd (%rsp), %xmm1
mulsd %xmm0, %xmm0
subsd %xmm1, %xmm0
ucomisd 0xae9dc(%rip), %xmm0    # 0xee258
jb 0x3f884
sqrtsd %xmm0, %xmm0
jmp 0x3f889
callq 0x82b0
movsd 0x10(%rsp), %xmm2
movsd 0x30(%rsp), %xmm6
ucomisd 0xae9bb(%rip), %xmm0    # 0xee258
jne 0x3f8a5
jnp 0x3fb4c
movsd 0x50(%rsp), %xmm5
movapd %xmm5, %xmm1
subsd %xmm2, %xmm1
movsd 0x8(%rsp), %xmm4
movsd 0x28(%rsp), %xmm2
cmplesd (%rsp), %xmm4
movapd %xmm4, %xmm3
andpd %xmm2, %xmm3
xorpd 0xae95b(%rip), %xmm2    # 0xee230
andnpd %xmm2, %xmm4
orpd %xmm3, %xmm4
divsd %xmm0, %xmm4
mulsd %xmm1, %xmm4
addsd %xmm5, %xmm4
movapd %xmm4, %xmm0
subsd %xmm6, %xmm0
andpd 0xae947(%rip), %xmm0    # 0xee240
movsd 0x48(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x3fb4c
movapd %xmm4, 0x30(%rsp)
movapd %xmm4, %xmm0
movq %r12, %rdi
leaq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
je 0x3fbac
incl (%r15)
movsd 0x58(%rsp), %xmm3
ucomisd 0xae91d(%rip), %xmm3    # 0xee258
jne 0x3f943
jnp 0x3fbf3
movsd 0x28(%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0xae8eb(%rip), %xmm2    # 0xee240
movapd 0x30(%rsp), %xmm4
jae 0x3f9a0
xorpd 0xae8cb(%rip), %xmm2    # 0xee230
ucomisd %xmm2, %xmm1
movsd 0x10(%rsp), %xmm0
jne 0x3f9ae
jp 0x3f9ae
movsd (%rsp), %xmm1
movapd %xmm1, %xmm2
orpd 0xae8ac(%rip), %xmm2    # 0xee230
ucomisd %xmm2, %xmm1
jne 0x3f9de
jp 0x3f9de
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm2
orpd 0xae892(%rip), %xmm2    # 0xee230
jmp 0x3f9fc
ucomisd %xmm1, %xmm2
movsd 0x10(%rsp), %xmm0
jne 0x3f9ae
jnp 0x3f9c5
movsd %xmm1, (%rsp)
movsd %xmm3, 0x8(%rsp)
movapd %xmm4, %xmm1
movsd 0x50(%rsp), %xmm0
jmp 0x3fa17
movsd (%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0xae86a(%rip), %xmm2    # 0xee240
ucomisd %xmm1, %xmm2
jne 0x3f9de
jnp 0x3f9ea
movsd %xmm3, 0x8(%rsp)
movapd %xmm4, %xmm1
jmp 0x3fa17
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0xae844(%rip), %xmm2    # 0xee240
ucomisd %xmm1, %xmm2
jne 0x3fa08
jnp 0x3fbec
movsd %xmm3, (%rsp)
movapd %xmm4, %xmm0
movsd 0x18(%rsp), %xmm1
movapd %xmm1, %xmm3
subsd %xmm0, %xmm3
andpd 0xae819(%rip), %xmm3    # 0xee240
movsd 0x48(%rsp), %xmm2
ucomisd %xmm3, %xmm2
jae 0x3fc04
decl %r14d
jne 0x3f81b
leaq 0xb2797(%rip), %rsi     # 0xf21de
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0xaeb28(%rip), %rsi     # 0xee585
leaq 0x860(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30af0
leaq 0xae5bb(%rip), %rsi     # 0xee034
leaq 0xb4abd(%rip), %rdx     # 0xf453d
movq %rbx, %rdi
movl $0x57f, %ecx            # imm = 0x57F
jmp 0x3fc79
movq %rsp, %rsi
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
jne 0x3fadf
leaq 0xae945(%rip), %rsi     # 0xee3f0
leaq 0xb4a64(%rip), %rdx     # 0xf4516
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xae569(%rip), %rsi     # 0xee034
leaq 0xb4a6b(%rip), %rdx     # 0xf453d
movq %rbx, %rdi
movl $0x546, %ecx            # imm = 0x546
jmp 0x3fbe2
leaq 0x8(%rsp), %rsi
movsd 0x18(%rsp), %xmm0
movq %r12, %rdi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
jne 0x3fb5a
leaq 0xae8f1(%rip), %rsi     # 0xee3f0
leaq 0xb4a4a(%rip), %rdx     # 0xf4550
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xae515(%rip), %rsi     # 0xee034
leaq 0xb4a17(%rip), %rdx     # 0xf453d
movq %rbx, %rdi
movl $0x548, %ecx            # imm = 0x548
jmp 0x3fbe2
ucomisd %xmm2, %xmm1
jne 0x3fc21
jp 0x3fc21
cvttsd2si %xmm0, %eax
jmp 0x3fc0f
movq 0x20(%rsp), %rax
movsd %xmm6, (%rax)
jmp 0x3fc0d
addl $0x2, (%r15)
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm3
movsd 0x10(%rsp), %xmm0
jmp 0x3f7d9
leaq 0xae875(%rip), %rsi     # 0xee3f0
leaq 0xb49f5(%rip), %rdx     # 0xf4577
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xae499(%rip), %rsi     # 0xee034
leaq 0xb499b(%rip), %rdx     # 0xf453d
movq %rbx, %rdi
movl $0x553, %ecx            # imm = 0x553
jmp 0x3fbe2
leaq 0xae83d(%rip), %rsi     # 0xee3f0
leaq 0xb49e4(%rip), %rdx     # 0xf459e
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xae461(%rip), %rsi     # 0xee034
leaq 0xb4963(%rip), %rdx     # 0xf453d
movq %rbx, %rdi
movl $0x562, %ecx            # imm = 0x562
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
jmp 0x3fc0f
movq 0x20(%rsp), %rax
movapd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x3fc0d
movq 0x20(%rsp), %rax
movsd %xmm4, (%rax)
xorl %eax, %eax
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd %xmm2, %xmm3
jne 0x3fc31
jp 0x3fc31
cvttsd2si 0x18(%rsp), %eax
jmp 0x3fc0f
leaq 0xb25c7(%rip), %rsi     # 0xf21ff
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0xae937(%rip), %rsi     # 0xee585
leaq 0x860(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30af0
leaq 0xae3ca(%rip), %rsi     # 0xee034
leaq 0xb48cc(%rip), %rdx     # 0xf453d
movq %rbx, %rdi
movl $0x585, %ecx            # imm = 0x585
movq %r15, %r8
jmp 0x3fbe5