anchor.diff:      ! certain values)
       print_control = debug_c - 1
   
  -    ! Initialize the task
  -    task = 'START'
  +    ! Initialize the state and task
  +    state = 'START'
  +    task = state
   
       ! Loop to do tasks and coordinate the optimization
       do while ( &
  -         task(1:2) == 'FG' .or. &
  -         task(1:5) == 'NEW_X' .or. &
  -         task(1:5) == 'START')
  +         state(1:7) == 'EVAL_FG' .or. &
  +         state(1:5) == 'NEW_X' .or. &
  +         state(1:7) == 'WARNING' .or. &
  +         state(1:5) == 'START')
   
          ! Call L-BFGS-B code
          call setulb(dim_c, approximation_size_c, point, &
  
positive.code:     end if
    end function lbfgsb_minimize
  
    ! Converts Fortran strings to C strings ensuring length bounds, null
    ! chars, and all that.
    subroutine convert_f_c_string(string_f, string_c_length, string_c)
  
negative.code:   ! Public procedures
    public lbfgsb_minimize
  
    ! Public status codes describing the exit or error status of L-BFGS-B.
    ! Multiple statuses are necessary because success in optimization is
    ! more complex than a single flag or error.  There are four exit
    ! statuses and two runtime error statuses.
    !
    ! 1. Success.  Normal termination having converged.
    !
    ! 2. Approximate success.  Normal operation resulting in a more
    ! approximate answer.  For example, unable to meet termination
    ! tolerances.
    !
    ! 3. Warning.  The result could be OK, but there were some issues that
    ! may have reduced the quality of the result and require examination.
    ! For example, slight numerical problems, exceeding iteration or time
    ! bounds.
    !
    ! 4. Failure of optimization.  For example, a necessary condition of
    ! the algorithm was not met, severe numerical problems.  (This status
    ! includes failures to evaluate the objective function or objective
    ! gradient.)
    !
    ! 5. Usage error.  For example, invalid constraints, bad parameters.
    ! Responsibility is on the caller.
    !
    ! 6. Internal error.  Other runtime or programming/logic error which
    ! may be a bug.  Responsibility is on this package.
    enum, bind(c)
       ! Constants automatically increment
       enumerator :: &
            LBFGSB_STATUS_SUCCESS = 0, &
            LBFGSB_STATUS_APPROXIMATE, &
            LBFGSB_STATUS_WARNING, &
            LBFGSB_STATUS_FAILURE, &
            LBFGSB_STATUS_USAGE_ERROR, &
            LBFGSB_STATUS_INTERNAL_ERROR
    end enum
  
    ! Signatures for C callbacks for computing the objective function
  