// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/dei_rkck.c
// Function: rkqs
int rkqs(double *x, double htry, double eps,
	 double *hdid, double *hnext,
	 int (*derivs)(double, double [], double [], void * parameters_and_workspace, ErrorMsg error_message),
	 void * parameters_and_workspace_for_derivs,
	 struct generic_integrator_workspace * pgi)
{

  int i;
  double errmax,h,htemp,xnew;

  h=htry;
  for (;;) {
    class_call(rkck(*x,h,derivs,parameters_and_workspace_for_derivs,pgi),
	       pgi->error_message,
	       pgi->error_message);
    errmax=0.0;
    for (i=0;i<pgi->n;i++) errmax=MAX(errmax,fabs(pgi->yerr[i]/pgi->yscal[i]));
    errmax /= eps;
    if (errmax <= 1.0) break;
    htemp=_SAFETY_*h*pow(errmax,_PSHRNK_);
    h=(h >= 0.0 ? MAX(htemp,0.1*h) : MIN(htemp,0.1*h));
    xnew=(*x)+h;
    class_test(xnew == *x,
	       pgi->error_message,
	       "stepsize underflow at x=%e",xnew);
  }
  if (errmax > _ERRCON_) *hnext=_SAFETY_*h*pow(errmax,_PGROW_);
  else *hnext=5.0*h;
  *x += (*hdid=h);
  for (i=0;i<pgi->n;i++) pgi->y[i]=pgi->ytemp[i];

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movq %r9, %rbx
movq %r8, %r13
movq %rcx, %rbp
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movsd %xmm1, 0x18(%rsp)
movapd %xmm0, %xmm1
movq %rdi, %r14
movsd (%rdi), %xmm0
xorl %r15d, %r15d
movsd %xmm1, 0x8(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x962a
testl %eax, %eax
jne 0x954e
movl (%rbx), %ecx
testl %ecx, %ecx
cmovlel %r15d, %ecx
xorpd %xmm0, %xmm0
xorl %eax, %eax
movsd 0x8(%rsp), %xmm2
movapd 0xdbdf0(%rip), %xmm3    # 0xe5240
cmpq %rax, %rcx
je 0x9478
movq 0x8(%rbx), %rdx
movq 0x20(%rbx), %rsi
movsd (%rsi,%rax,8), %xmm1
divsd (%rdx,%rax,8), %xmm1
andpd %xmm3, %xmm1
maxsd %xmm0, %xmm1
incq %rax
movapd %xmm1, %xmm0
jmp 0x9450
divsd 0x18(%rsp), %xmm0
movsd 0xdbdda(%rip), %xmm1    # 0xe5260
ucomisd %xmm0, %xmm1
jae 0x95a7
mulsd 0xdbde0(%rip), %xmm2    # 0xe5278
movsd %xmm2, (%rsp)
movsd 0xdbde3(%rip), %xmm1    # 0xe5288
callq 0x8650
movsd 0x8(%rsp), %xmm1
mulsd (%rsp), %xmm0
ucomisd 0xdbd9b(%rip), %xmm1    # 0xe5258
mulsd 0xdbdcb(%rip), %xmm1    # 0xe5290
jae 0x94d1
minsd %xmm1, %xmm0
movapd %xmm0, %xmm1
jmp 0x94d5
maxsd %xmm0, %xmm1
movsd (%r14), %xmm0
movapd %xmm1, %xmm2
addsd %xmm0, %xmm2
ucomisd %xmm0, %xmm2
jne 0x9418
jp 0x9418
leaq 0xdc0d5(%rip), %rsi     # 0xe55ce
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movapd %xmm2, %xmm0
movb $0x1, %al
callq 0x2e014
leaq 0xdbb6f(%rip), %rsi     # 0xe5082
leaq 0xdc0cf(%rip), %rdx     # 0xe55e9
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x68, %rbx
leaq 0xdbafa(%rip), %rsi     # 0xe5034
leaq 0xdc088(%rip), %rdx     # 0xe55c9
movq %rbx, %rdi
movl $0x9c, %ecx
movq %r15, %r8
jmp 0x958b
addq $0x68, %rbx
leaq 0xdbe97(%rip), %rsi     # 0xe53f0
leaq 0xdc02f(%rip), %rdx     # 0xe558f
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xdbabb(%rip), %rsi     # 0xe5034
leaq 0xdc049(%rip), %rdx     # 0xe55c9
movq %rbx, %rdi
movl $0x92, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd 0xdbcb9(%rip), %xmm0    # 0xe5268
jbe 0x95e5
movsd 0xdbcbf(%rip), %xmm1    # 0xe5278
mulsd %xmm2, %xmm1
movsd %xmm1, (%rsp)
movsd 0xdbcb6(%rip), %xmm1    # 0xe5280
callq 0x8650
movsd 0x8(%rsp), %xmm2
mulsd (%rsp), %xmm0
movl (%rbx), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
jmp 0x95f1
movsd 0xdbc83(%rip), %xmm0    # 0xe5270
mulsd %xmm2, %xmm0
movq 0x10(%rsp), %rax
movsd %xmm0, (%rax)
movsd %xmm2, (%r12)
addsd (%r14), %xmm2
movsd %xmm2, (%r14)
xorl %eax, %eax
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x9595
movq 0x10(%rbx), %rsi
movq 0x58(%rbx), %rdi
movsd (%rdi,%rdx,8), %xmm0
movsd %xmm0, (%rsi,%rdx,8)
incq %rdx
jmp 0x960e