PROGRAM test_opt_args
    USE opt_args
    INTEGER x, y, z
    INTEGER, POINTER :: p(:)

    CALL opt_arg_init()

    NULLIFY(p)
    CALL get_vals(x, y, p)
    WRITE(*,*) 'get_vals(x, y, p)'
    WRITE(*,*) '  x: ', x
    WRITE(*,*) '  y: ', y
    IF(ASSOCIATED(p)) THEN
       WRITE(*,*) '  p: ', p
    ELSE
       WRITE(*,*) '  p:       <null>'
    ENDIF

    NULLIFY(p)
    CALL get_vals(x, y)
    WRITE(*,*) 'get_vals(x, y)'
    WRITE(*,*) '  x: ', x
    WRITE(*,*) '  y: ', y
    IF(ASSOCIATED(p)) THEN
       WRITE(*,*) '  p: ', p
    ELSE
       WRITE(*,*) '  p:       <null>'
    ENDIF

END PROGRAM test_opt_args
