// File: sus304[P]ForRocket/./lib/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp
// Function: unsigned long boost::numeric::odeint::detail::integrate_adaptive<boost::numeric::odeint::controlled_runge_kutta<boost::numeric::odeint::runge_kutta_dopri5<std::array<double, 14ul>, double, std::array<double, 14ul>, double, boost::numeric::odeint::array_algebra, boost::numeric::odeint::default_operations, boost::numeric::odeint::initially_resizer>, boost::numeric::odeint::default_error_checker<double, boost::numeric::odeint::array_algebra, boost::numeric::odeint::default_operations>, boost::numeric::odeint::default_step_adjuster<double, double>, boost::numeric::odeint::initially_resizer, boost::numeric::odeint::explicit_error_stepper_fsal_tag>, std::reference_wrapper<forrocket::DynamicsBase>, std::array<double, 14ul>, double, boost::numeric::odeint::null_observer>(boost::numeric::odeint::controlled_runge_kutta<boost::numeric::odeint::runge_kutta_dopri5<std::array<double, 14ul>, double, std::array<double, 14ul>, double, boost::numeric::odeint::array_algebra, boost::numeric::odeint::default_operations, boost::numeric::odeint::initially_resizer>, boost::numeric::odeint::default_error_checker<double, boost::numeric::odeint::array_algebra, boost::numeric::odeint::default_operations>, boost::numeric::odeint::default_step_adjuster<double, double>, boost::numeric::odeint::initially_resizer, boost::numeric::odeint::explicit_error_stepper_fsal_tag>, std::reference_wrapper<forrocket::DynamicsBase>, std::array<double, 14ul>&, double&, double, double&, boost::numeric::odeint::null_observer, boost::numeric::odeint::controlled_stepper_tag)
size_t integrate_adaptive(
        Stepper stepper , System system , State &start_state ,
        Time &start_time , Time end_time , Time &dt ,
        Observer observer , controlled_stepper_tag
)
{
    typename odeint::unwrap_reference< Observer >::type &obs = observer;
    typename odeint::unwrap_reference< Stepper >::type &st = stepper;

    failed_step_checker fail_checker;  // to throw a runtime_error if step size adjustment fails
    size_t count = 0;
    while( less_with_sign( start_time , end_time , dt ) )
    {
        obs( start_state , start_time );
        if( less_with_sign( end_time , static_cast<Time>(start_time + dt) , dt ) )
        {
            dt = end_time - start_time;
        }

        controlled_step_result res;
        do
        {
            res = st.try_step( system , start_state , start_time , dt );
            fail_checker();  // check number of failed steps
        }
        while( res == fail );
        fail_checker.reset();  // if we reach here, the step was successful -> reset fail checker

        ++count;
    }
    obs( start_state , start_time );
    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
leaq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
leaq -0x9(%rbp), %rcx
movq %rcx, -0x38(%rbp)
movq %rax, -0x40(%rbp)
leaq -0x48(%rbp), %rdi
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x7da20
movq $0x0, -0x50(%rbp)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x28(%rbp), %xmm1
movq -0x30(%rbp), %rax
movsd (%rax), %xmm2
callq 0x7da50
testb $0x1, %al
jne 0x7d8e6
jmp 0x7d987
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
callq 0x7dae0
movsd -0x28(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd (%rax), %xmm1
movq -0x30(%rbp), %rax
addsd (%rax), %xmm1
movq -0x30(%rbp), %rax
movsd (%rax), %xmm2
callq 0x7da50
testb $0x1, %al
jne 0x7d923
jmp 0x7d938
movsd -0x28(%rbp), %xmm0
movq -0x20(%rbp), %rax
subsd (%rax), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x7d93a
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x60(%rbp), %rsi
callq 0x7db00
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7db50
cmpl $0x1, -0x54(%rbp)
je 0x7d93a
leaq -0x48(%rbp), %rdi
callq 0x7dc80
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x7d8c3
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
callq 0x7dae0
movq -0x50(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)