// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rsi, %r15
movsd %xmm1, 0x18(%rsp)
movapd %xmm0, %xmm1
movq %rdi, %r14
movsd (%rdi), %xmm0
movsd %xmm1, 0x8(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xab02
testl %eax, %eax
jne 0xaa20
movslq (%rbx), %rax
testq %rax, %rax
jle 0xa93e
movq 0x8(%rbx), %rcx
movq 0x20(%rbx), %rdx
xorpd %xmm1, %xmm1
xorl %esi, %esi
movsd 0x8(%rsp), %xmm2
movapd 0xe3922(%rip), %xmm3    # 0xee240
movsd (%rdx,%rsi,8), %xmm0
divsd (%rcx,%rsi,8), %xmm0
andpd %xmm3, %xmm0
maxsd %xmm1, %xmm0
incq %rsi
movapd %xmm0, %xmm1
cmpq %rsi, %rax
jne 0xa91e
jmp 0xa948
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm2
divsd 0x18(%rsp), %xmm0
movsd 0xe390a(%rip), %xmm1    # 0xee260
ucomisd %xmm0, %xmm1
jae 0xaa6e
mulsd 0xe3910(%rip), %xmm2    # 0xee278
movsd %xmm2, 0x10(%rsp)
movsd 0xe3912(%rip), %xmm1    # 0xee288
callq 0x8620
movsd 0x8(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm0
ucomisd 0xe38c9(%rip), %xmm1    # 0xee258
mulsd 0xe38f9(%rip), %xmm1    # 0xee290
jae 0xa9a3
minsd %xmm1, %xmm0
movapd %xmm0, %xmm1
jmp 0xa9a7
maxsd %xmm0, %xmm1
movsd (%r14), %xmm0
movapd %xmm1, %xmm2
addsd %xmm0, %xmm2
ucomisd %xmm0, %xmm2
jne 0xa8de
jp 0xa8de
leaq 0xe3c03(%rip), %rsi     # 0xee5ce
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movapd %xmm2, %xmm0
movb $0x1, %al
callq 0x30af0
leaq 0xe369d(%rip), %rsi     # 0xee082
leaq 0xe3bfd(%rip), %rdx     # 0xee5e9
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x68, %rbx
leaq 0xe3628(%rip), %rsi     # 0xee034
leaq 0xe3bb6(%rip), %rdx     # 0xee5c9
movq %rbx, %rdi
movl $0x9c, %ecx
movq %r15, %r8
jmp 0xaa5d
addq $0x68, %rbx
leaq 0xe39c5(%rip), %rsi     # 0xee3f0
leaq 0xe3b5d(%rip), %rdx     # 0xee58f
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0xe35e9(%rip), %rsi     # 0xee034
leaq 0xe3b77(%rip), %rdx     # 0xee5c9
movq %rbx, %rdi
movl $0x92, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
jmp 0xaaf0
ucomisd 0xe37f2(%rip), %xmm0    # 0xee268
jbe 0xaaa7
movsd 0xe37f8(%rip), %xmm1    # 0xee278
mulsd %xmm2, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0xe37ee(%rip), %xmm1    # 0xee280
callq 0x8620
movsd 0x8(%rsp), %xmm2
mulsd 0x10(%rsp), %xmm0
movl (%rbx), %eax
jmp 0xaab3
movsd 0xe37c1(%rip), %xmm0    # 0xee270
mulsd %xmm2, %xmm0
movsd %xmm0, (%r12)
movsd %xmm2, (%r15)
addsd (%r14), %xmm2
movsd %xmm2, (%r14)
testl %eax, %eax
jle 0xaaee
movq 0x10(%rbx), %rcx
movq 0x58(%rbx), %rdx
movl %eax, %esi
xorl %eax, %eax
xorl %edi, %edi
movsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%rcx,%rdi,8)
incq %rdi
cmpq %rdi, %rsi
jne 0xaada
jmp 0xaaf0
xorl %eax, %eax
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq