// File: /workspace/github_c_makefile_star2_O1/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)
movq %rdi, %r13
movq 0x10a0(%rsp), %rbx
testq %rdx, %rdx
sete %al
testq %rcx, %rcx
sete %sil
orb %al, %sil
jne 0x40ef4
movsd (%rdx), %xmm2
movsd %xmm2, 0x8(%rsp)
movsd (%rcx), %xmm2
movsd %xmm2, 0x10(%rsp)
movsd 0x8(%rsp), %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm3
movsd 0x10(%rsp), %xmm4
jbe 0x40c30
ucomisd %xmm4, %xmm2
ja 0x40c44
ucomisd %xmm3, %xmm2
jbe 0x40fa2
ucomisd %xmm2, %xmm4
jbe 0x40fa2
movq %r14, 0x20(%rsp)
movsd 0xb3927(%rip), %xmm4    # 0xf4578
movl $0x3e8, %r14d           # imm = 0x3E8
leaq 0x40(%rsp), %rbp
movsd %xmm4, 0x30(%rsp)
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x18(%rsp)
addsd %xmm0, %xmm1
mulsd 0xb1056(%rip), %xmm1    # 0xf1cd0
movsd %xmm1, 0x50(%rsp)
movapd %xmm1, %xmm0
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
je 0x40fdf
incl (%r15)
movsd 0x40(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm0
subsd %xmm1, %xmm0
ucomisd 0xb059a(%rip), %xmm0    # 0xf1258
jb 0x40cc6
sqrtsd %xmm0, %xmm0
jmp 0x40ccb
callq 0x82b0
movsd 0x18(%rsp), %xmm2
movapd 0xb0557(%rip), %xmm4    # 0xf1230
movapd 0xb055f(%rip), %xmm5    # 0xf1240
movsd 0x30(%rsp), %xmm8
ucomisd 0xb0568(%rip), %xmm0    # 0xf1258
jne 0x40cf8
jnp 0x40fbb
movsd 0x50(%rsp), %xmm7
movapd %xmm7, %xmm1
subsd %xmm2, %xmm1
movsd 0x10(%rsp), %xmm6
movsd 0x40(%rsp), %xmm2
cmplesd 0x8(%rsp), %xmm6
movapd %xmm6, %xmm3
andpd %xmm2, %xmm3
xorpd %xmm4, %xmm2
andnpd %xmm2, %xmm6
orpd %xmm3, %xmm6
divsd %xmm0, %xmm6
mulsd %xmm1, %xmm6
addsd %xmm7, %xmm6
movapd %xmm6, %xmm0
subsd %xmm8, %xmm0
andpd %xmm5, %xmm0
movsd 0x48(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x40fbb
movapd %xmm6, 0x30(%rsp)
movapd %xmm6, %xmm0
movq %r12, %rdi
leaq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
je 0x41017
incl (%r15)
movsd 0x58(%rsp), %xmm0
ucomisd 0xb04d0(%rip), %xmm0    # 0xf1258
jne 0x40d90
jnp 0x4105e
movsd 0x40(%rsp), %xmm2
movapd %xmm2, %xmm3
movapd 0xb049e(%rip), %xmm7    # 0xf1240
andpd %xmm7, %xmm3
movapd %xmm2, %xmm4
movapd 0xb047e(%rip), %xmm6    # 0xf1230
orpd %xmm6, %xmm4
xorpd %xmm1, %xmm1
cmpnlesd %xmm0, %xmm1
andpd %xmm1, %xmm4
movapd %xmm1, %xmm5
andnpd %xmm3, %xmm5
orpd %xmm4, %xmm5
ucomisd %xmm2, %xmm5
jne 0x40dd7
jnp 0x40df8
movsd %xmm2, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movapd 0x30(%rsp), %xmm4
movapd %xmm4, %xmm1
movsd 0x50(%rsp), %xmm0
jmp 0x40e82
movsd 0x8(%rsp), %xmm2
movapd %xmm2, %xmm3
andpd %xmm7, %xmm3
movapd %xmm2, %xmm4
orpd %xmm6, %xmm4
andpd %xmm1, %xmm4
movapd %xmm1, %xmm5
andnpd %xmm3, %xmm5
orpd %xmm4, %xmm5
ucomisd %xmm2, %xmm5
jne 0x40e26
jnp 0x40e3e
movsd %xmm0, 0x10(%rsp)
movapd 0x30(%rsp), %xmm4
movapd %xmm4, %xmm1
movsd 0x18(%rsp), %xmm0
jmp 0x40e82
movsd 0x10(%rsp), %xmm2
movapd %xmm2, %xmm3
andpd %xmm7, %xmm3
movapd %xmm2, %xmm4
orpd %xmm6, %xmm4
andpd %xmm1, %xmm4
andnpd %xmm3, %xmm1
orpd %xmm4, %xmm1
ucomisd %xmm2, %xmm1
jne 0x40e6c
jnp 0x41057
movsd %xmm0, 0x8(%rsp)
movapd 0x30(%rsp), %xmm4
movapd %xmm4, %xmm0
movsd 0x28(%rsp), %xmm1
movapd %xmm1, %xmm3
subsd %xmm0, %xmm3
andpd %xmm7, %xmm3
movsd 0x48(%rsp), %xmm2
ucomisd %xmm3, %xmm2
jae 0x4106f
decl %r14d
jne 0x40c5c
leaq 0xb4320(%rip), %rsi     # 0xf51ce
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0xb06c1(%rip), %rsi     # 0xf1585
leaq 0x860(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30c2c
leaq 0xb0154(%rip), %rsi     # 0xf1034
leaq 0xb662e(%rip), %rdx     # 0xf7515
movq %rbx, %rdi
movl $0x57f, %ecx            # imm = 0x57F
jmp 0x410e2
movsd %xmm1, 0x28(%rsp)
leaq 0x8(%rsp), %rsi
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
jne 0x40f4e
leaq 0xb04d6(%rip), %rsi     # 0xf13f0
leaq 0xb65cd(%rip), %rdx     # 0xf74ee
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xb00fa(%rip), %rsi     # 0xf1034
leaq 0xb65d4(%rip), %rdx     # 0xf7515
movq %rbx, %rdi
movl $0x546, %ecx            # imm = 0x546
jmp 0x4104d
leaq 0x10(%rsp), %rsi
movsd 0x28(%rsp), %xmm0
movq %r12, %rdi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
jne 0x40fca
leaq 0xb0482(%rip), %rsi     # 0xf13f0
leaq 0xb65b3(%rip), %rdx     # 0xf7528
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xb00a6(%rip), %rsi     # 0xf1034
leaq 0xb6580(%rip), %rdx     # 0xf7515
movq %rbx, %rdi
movl $0x548, %ecx            # imm = 0x548
jmp 0x4104d
ucomisd %xmm2, %xmm3
jne 0x4108c
jp 0x4108c
cvttsd2si %xmm0, %eax
jmp 0x4107a
movq 0x20(%rsp), %rax
movsd %xmm8, (%rax)
jmp 0x41078
addl $0x2, (%r15)
movsd 0x28(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
jmp 0x40c14
leaq 0xb040a(%rip), %rsi     # 0xf13f0
leaq 0xb6562(%rip), %rdx     # 0xf754f
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xb002e(%rip), %rsi     # 0xf1034
leaq 0xb6508(%rip), %rdx     # 0xf7515
movq %rbx, %rdi
movl $0x553, %ecx            # imm = 0x553
jmp 0x4104d
leaq 0xb03d2(%rip), %rsi     # 0xf13f0
leaq 0xb6551(%rip), %rdx     # 0xf7576
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xafff6(%rip), %rsi     # 0xf1034
leaq 0xb64d0(%rip), %rdx     # 0xf7515
movq %rbx, %rdi
movl $0x562, %ecx            # imm = 0x562
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
jmp 0x4107a
movq 0x20(%rsp), %rax
movapd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x41078
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, %xmm4
jne 0x4109a
jp 0x4109a
cvttsd2si %xmm1, %eax
jmp 0x4107a
leaq 0xb414e(%rip), %rsi     # 0xf51ef
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0xb04ce(%rip), %rsi     # 0xf1585
leaq 0x860(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30c2c
leaq 0xaff61(%rip), %rsi     # 0xf1034
leaq 0xb643b(%rip), %rdx     # 0xf7515
movq %rbx, %rdi
movl $0x585, %ecx            # imm = 0x585
movq %r15, %r8
jmp 0x41050