// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/dei_rkck.c
// Function: generic_integrator
int generic_integrator(int (*derivs)(double x, double y[], double yprime[], void * parameters_and_workspace, ErrorMsg error_message),
		       double x1,
		       double x2,
		       double ystart[],
		       void * parameters_and_workspace_for_derivs,
		       double eps,
		       double hmin,
		       struct generic_integrator_workspace * pgi)

{
  int nstp,i;
  double x,hnext,hdid,h,h1;

  h1=x2-x1;
  x=x1;
  h=dsign(h1,x2-x1);
  for (i=0;i<pgi->n;i++) pgi->y[i]=ystart[i];
  for (nstp=1;nstp<=_MAXSTP_;nstp++) {
    class_call((*derivs)(x,pgi->y,pgi->dydx,parameters_and_workspace_for_derivs, pgi->error_message),
	       pgi->error_message,
	       pgi->error_message);
    for (i=0;i<pgi->n;i++)
      pgi->yscal[i]=fabs(pgi->y[i])+fabs(pgi->dydx[i]*h)+_TINY_;
    if ((x+h-x2)*(x+h-x1) > 0.0) h=x2-x;
    class_call(rkqs(&x,
		    h,
		    eps,
		    &hdid,
		    &hnext,
		    derivs,
		    parameters_and_workspace_for_derivs,
		    pgi),
	       pgi->error_message,
	       pgi->error_message);
    if ((x-x2)*(x2-x1) >= 0.0) {
      for (i=0;i<pgi->n;i++) ystart[i]=pgi->y[i];
      return _SUCCESS_;
    }
    class_test(fabs(hnext/x1) <= hmin,
	       pgi->error_message,
	       "Step size too small: step:%g, minimum:%g, in interval: [%g:%g]",
	       fabs(hnext/x1),
	       hmin,
	       x1,
	       x2);
    h=hnext;
  }

  class_stop(pgi->error_message,
	     "Too many integration steps needed within interval [%g : %g],\n the system of equations is probably buggy or featuring a discontinuity",x1,x2);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq %rcx, %r14
movsd %xmm3, 0x10(%rsp)
movsd %xmm2, 0x28(%rsp)
movq %rdx, %r12
movq %rsi, %r15
movapd %xmm1, %xmm3
movq %rdi, %r13
subsd %xmm0, %xmm1
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x20(%rsp)
movapd 0xdc15c(%rip), %xmm0    # 0xe5230
movapd %xmm1, 0x40(%rsp)
xorpd %xmm1, %xmm0
movl (%rcx), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x9100
movsd (%r15,%rcx,8), %xmm1
movq 0x10(%r14), %rdx
movsd %xmm1, (%rdx,%rcx,8)
incq %rcx
jmp 0x90e7
xorpd %xmm4, %xmm4
movapd 0x40(%rsp), %xmm2
cmpltsd %xmm2, %xmm4
movapd %xmm4, %xmm1
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm4
orpd %xmm1, %xmm4
leaq 0x68(%r14), %rbx
pushq $0x1
popq %rbp
movsd 0x8(%rsp), %xmm2
movsd %xmm3, 0x18(%rsp)
cmpl $0x186a1, %ebp          # imm = 0x186A1
je 0x92e1
movapd %xmm4, 0x50(%rsp)
movq 0x10(%r14), %rdi
movq 0x18(%r14), %rsi
movsd %xmm2, 0x30(%rsp)
movapd %xmm2, %xmm0
movq %r12, %rdx
movq %rbx, %rcx
callq *%r13
cmpl $0x1, %eax
je 0x9338
movl (%r14), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
xorl %ecx, %ecx
movsd 0x18(%rsp), %xmm3
movapd 0xdc0bb(%rip), %xmm2    # 0xe5240
movsd 0xdc0c3(%rip), %xmm4    # 0xe5250
movapd 0x50(%rsp), %xmm5
cmpq %rcx, %rax
je 0x91cc
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rsi
movsd (%rsi,%rcx,8), %xmm0
andpd %xmm2, %xmm0
movq 0x18(%r14), %rsi
movsd (%rsi,%rcx,8), %xmm1
mulsd %xmm5, %xmm1
andpd %xmm2, %xmm1
addsd %xmm0, %xmm1
addsd %xmm4, %xmm1
movsd %xmm1, (%rdx,%rcx,8)
incq %rcx
jmp 0x9193
movapd %xmm5, %xmm1
movsd 0x30(%rsp), %xmm4
addsd %xmm4, %xmm1
movapd %xmm1, %xmm0
subsd %xmm3, %xmm0
subsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movapd %xmm3, %xmm2
subsd %xmm4, %xmm2
xorpd %xmm0, %xmm0
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm5, %xmm0
orpd %xmm2, %xmm0
leaq 0x20(%rsp), %rdi
movsd 0x28(%rsp), %xmm1
leaq 0x68(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %r13, %rcx
movq %r12, %r8
movq %r14, %r9
callq 0x93e2
testl %eax, %eax
jne 0x936a
movsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm0
movsd 0x18(%rsp), %xmm3
subsd %xmm3, %xmm0
mulsd 0x40(%rsp), %xmm0
ucomisd 0xdc002(%rip), %xmm0    # 0xe5258
jae 0x93bd
movsd 0x38(%rsp), %xmm4
movapd %xmm4, %xmm0
divsd 0x8(%rsp), %xmm0
andpd 0xdbfcc(%rip), %xmm0    # 0xe5240
incl %ebp
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x9132
leaq 0xdc21d(%rip), %rsi     # 0xe54aa
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movb $0x4, %al
callq 0x2e014
leaq 0xdbdd3(%rip), %rsi     # 0xe5082
leaq 0xdc233(%rip), %rdx     # 0xe54e9
leaq 0x870(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xdbd62(%rip), %rsi     # 0xe5034
leaq 0xdc0a5(%rip), %rdx     # 0xe537e
pushq $0x7b
popq %rcx
movq %rbx, %rdi
jmp 0x9333
leaq 0xdc218(%rip), %rsi     # 0xe5500
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
movapd %xmm3, %xmm1
movb $0x2, %al
callq 0x2e014
leaq 0xdc27d(%rip), %rsi     # 0xe5585
leaq 0x870(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2e014
leaq 0xdbd10(%rip), %rsi     # 0xe5034
leaq 0xdc053(%rip), %rdx     # 0xe537e
movq %rbx, %rdi
movl $0x80, %ecx
movq %r15, %r8
jmp 0x93a1
leaq 0xdc0b1(%rip), %rsi     # 0xe53f0
leaq 0xdc0bc(%rip), %rdx     # 0xe5402
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xdbcd5(%rip), %rsi     # 0xe5034
leaq 0xdc018(%rip), %rdx     # 0xe537e
pushq $0x63
jmp 0x939a
leaq 0xdc07f(%rip), %rsi     # 0xe53f0
leaq 0xdc0e0(%rip), %rdx     # 0xe5458
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xdbca3(%rip), %rsi     # 0xe5034
leaq 0xdbfe6(%rip), %rdx     # 0xe537e
pushq $0x70
popq %rcx
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%r14), %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x93ab
movq 0x10(%r14), %rsi
movsd (%rsi,%rdx,8), %xmm0
movsd %xmm0, (%r15,%rdx,8)
incq %rdx
jmp 0x93c9