// File: /workspace/github_c_makefile_star2_O2/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, 0x50(%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
movsd %xmm0, 0x20(%rsp)
jne 0x3c548
movsd (%rdx), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd (%rcx), %xmm0
movsd %xmm0, 0x10(%rsp)
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x3c2d7
ucomisd %xmm0, %xmm2
ja 0x3c2eb
ucomisd %xmm1, %xmm2
jbe 0x3c5f4
ucomisd %xmm2, %xmm0
jbe 0x3c5f4
movq %r14, 0x28(%rsp)
movsd 0xac210(%rip), %xmm3    # 0xe8508
movl $0x3e9, %r14d           # imm = 0x3E9
pushq $0x1
popq %rbp
movsd 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
decl %r14d
je 0x3c632
movsd %xmm3, 0x40(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x20(%rsp)
addsd %xmm0, %xmm1
mulsd 0xa997c(%rip), %xmm1    # 0xe5cb0
movsd %xmm1, 0x30(%rsp)
movapd %xmm1, %xmm0
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
je 0x3c67f
incl (%r15)
movsd 0x38(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm0
subsd %xmm1, %xmm0
ucomisd 0xa8ede(%rip), %xmm0    # 0xe5258
jb 0x3c382
sqrtsd %xmm0, %xmm0
jmp 0x3c387
callq 0x82d0
movsd 0x30(%rsp), %xmm5
movsd 0x40(%rsp), %xmm6
ucomisd 0xa8ebd(%rip), %xmm0    # 0xe5258
jne 0x3c3a3
jnp 0x3c60f
movapd %xmm5, %xmm1
subsd 0x20(%rsp), %xmm1
movsd 0x10(%rsp), %xmm4
movsd 0x38(%rsp), %xmm2
cmplesd 0x8(%rsp), %xmm4
movapd %xmm4, %xmm3
andpd %xmm2, %xmm3
xorpd 0xa8e60(%rip), %xmm2    # 0xe5230
andnpd %xmm2, %xmm4
orpd %xmm3, %xmm4
divsd %xmm0, %xmm4
mulsd %xmm1, %xmm4
addsd %xmm5, %xmm4
movapd %xmm4, %xmm0
subsd %xmm6, %xmm0
andpd 0xa8e4c(%rip), %xmm0    # 0xe5240
movsd 0x50(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x3c60f
movapd %xmm4, 0x40(%rsp)
movapd %xmm4, %xmm0
movq %r12, %rdi
leaq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
je 0x3c6b7
incl (%r15)
movsd 0x58(%rsp), %xmm0
ucomisd 0xa8e22(%rip), %xmm0    # 0xe5258
jne 0x3c43e
jnp 0x3c6f9
movsd 0x38(%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0xa8df0(%rip), %xmm2    # 0xe5240
movapd 0x40(%rsp), %xmm3
jae 0x3c49c
xorpd 0xa8dd0(%rip), %xmm2    # 0xe5230
ucomisd %xmm2, %xmm1
movsd 0x30(%rsp), %xmm4
jne 0x3c4aa
jp 0x3c4aa
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm2
orpd 0xa8db0(%rip), %xmm2    # 0xe5230
ucomisd %xmm2, %xmm1
jne 0x3c4d6
jp 0x3c4d6
movsd 0x10(%rsp), %xmm1
movapd %xmm1, %xmm2
orpd 0xa8d96(%rip), %xmm2    # 0xe5230
jmp 0x3c4fa
ucomisd %xmm1, %xmm2
movsd 0x30(%rsp), %xmm4
jne 0x3c4aa
jnp 0x3c4bc
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movapd %xmm3, %xmm1
jmp 0x3c516
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0xa8d72(%rip), %xmm2    # 0xe5240
ucomisd %xmm1, %xmm2
jne 0x3c4d6
jnp 0x3c4e8
movsd %xmm0, 0x10(%rsp)
movapd %xmm3, %xmm1
movsd 0x20(%rsp), %xmm4
jmp 0x3c516
movsd 0x10(%rsp), %xmm1
movapd %xmm1, %xmm2
andpd 0xa8d46(%rip), %xmm2    # 0xe5240
ucomisd %xmm1, %xmm2
jne 0x3c506
jnp 0x3c70a
movsd %xmm0, 0x8(%rsp)
movapd %xmm3, %xmm4
movsd 0x18(%rsp), %xmm1
movapd %xmm1, %xmm0
subsd %xmm4, %xmm0
andpd 0xa8d1a(%rip), %xmm0    # 0xe5240
movsd 0x50(%rsp), %xmm2
ucomisd %xmm0, %xmm2
movapd %xmm4, %xmm0
jb 0x3c30d
movq 0x28(%rsp), %rax
movsd %xmm3, (%rax)
jmp 0x3c708
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
jne 0x3c593
leaq 0xa8e8e(%rip), %rsi     # 0xe53f0
leaq 0xaee75(%rip), %rdx     # 0xeb3de
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xa8ab2(%rip), %rsi     # 0xe5034
leaq 0xaee7c(%rip), %rdx     # 0xeb405
movq %rbx, %rdi
movl $0x546, %ecx            # imm = 0x546
jmp 0x3c5e2
leaq 0x10(%rsp), %rsi
movsd 0x18(%rsp), %xmm0
movq %r12, %rdi
movq %rbx, %rdx
callq *%r13
cmpl $0x1, %eax
jne 0x3c61d
leaq 0xa8e3d(%rip), %rsi     # 0xe53f0
leaq 0xaee5e(%rip), %rdx     # 0xeb418
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xa8a61(%rip), %rsi     # 0xe5034
leaq 0xaee2b(%rip), %rdx     # 0xeb405
movq %rbx, %rdi
movl $0x548, %ecx            # imm = 0x548
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbp
jmp 0x3c70a
ucomisd %xmm2, %xmm1
jne 0x3c71e
jp 0x3c71e
cvttsd2si 0x20(%rsp), %ebp
jmp 0x3c70a
movq 0x28(%rsp), %rax
movsd %xmm6, (%rax)
jmp 0x3c708
addl $0x2, (%r15)
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
jmp 0x3c2c7
leaq 0xacac5(%rip), %rsi     # 0xe90fe
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xa8f36(%rip), %rsi     # 0xe5585
leaq 0x860(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2e014
leaq 0xa89c9(%rip), %rsi     # 0xe5034
leaq 0xaed93(%rip), %rdx     # 0xeb405
movq %rbx, %rdi
movl $0x57f, %ecx            # imm = 0x57F
movq %r15, %r8
jmp 0x3c6f0
leaq 0xa8d6a(%rip), %rsi     # 0xe53f0
leaq 0xaedb2(%rip), %rdx     # 0xeb43f
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xa898e(%rip), %rsi     # 0xe5034
leaq 0xaed58(%rip), %rdx     # 0xeb405
movq %rbx, %rdi
movl $0x553, %ecx            # imm = 0x553
jmp 0x3c6ed
leaq 0xa8d32(%rip), %rsi     # 0xe53f0
leaq 0xaeda1(%rip), %rdx     # 0xeb466
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xa8956(%rip), %rsi     # 0xe5034
leaq 0xaed20(%rip), %rdx     # 0xeb405
movq %rbx, %rdi
movl $0x562, %ecx            # imm = 0x562
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
jmp 0x3c70a
movq 0x28(%rsp), %rax
movapd 0x40(%rsp), %xmm0
movsd %xmm0, (%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd %xmm2, %xmm0
jne 0x3c72e
jp 0x3c72e
cvttsd2si 0x18(%rsp), %ebp
jmp 0x3c70a
leaq 0xac9ea(%rip), %rsi     # 0xe911f
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xa8e3a(%rip), %rsi     # 0xe5585
leaq 0x860(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2e014
leaq 0xa88cd(%rip), %rsi     # 0xe5034
leaq 0xaec97(%rip), %rdx     # 0xeb405
movq %rbx, %rdi
movl $0x585, %ecx            # imm = 0x585
movq %r15, %r8
jmp 0x3c5e5