``` SUBROUTINE SAXPY( N, SA, SX, INCX, SY, INCY ) 10

c          Y = A*X + Y  (X, Y = vectors, A = scalar)

c  INPUT--
c        N  Number of elements in input vectors X and Y
c       SA  Single precision scalar multiplier A
c       SX  Sing-prec array containing vector X
c     INCX  Spacing of elements of vector X in SX
c       SY  Sing-prec array containing vector Y
c     INCY  Spacing of elements of vector Y in SY

c OUTPUT--
c       SY   For I = 0 to N-1, overwrite  SY(LY+I*INCY) with
c                 SA*SX(LX+I*INCX) + SY(LY+I*INCY),
c            where LX = 1          if INCX .GE. 0,
c                     = (-INCX)*N  if INCX .LT. 0
c            and LY is defined analogously using INCY.
c ------------------------------------------------------------

c     .. Scalar Arguments ..

INTEGER   INCX, INCY, N
REAL      SA
c     ..
c     .. Array Arguments ..

REAL      SX( * ), SY( * )
c     ..
c     .. Local Scalars ..

INTEGER   I, IX, IY, M
c     ..
c     .. Intrinsic Functions ..

INTRINSIC MOD
c     ..

IF( N.LE.0 .OR. SA.EQ.0.0 ) RETURN

IF( INCX.EQ.INCY .AND. INCX.GT.1 ) THEN

DO 10 I = 1, 1 + ( N - 1 )*INCX, INCX
SY( I ) = SY( I ) + SA*SX( I )
10    CONTINUE

ELSE IF( INCX.EQ.INCY .AND. INCX.EQ.1 ) THEN

c                                        ** equal, unit increments
M  = MOD( N, 4 )

IF( M.NE.0 ) THEN
c                            ** clean-up loop so remaining vector length
c                            ** is a multiple of 4.
DO 20 I = 1, M
SY( I ) = SY( I ) + SA*SX( I )
20       CONTINUE

END IF
c                              ** unroll loop for speed
DO 30 I = M + 1, N, 4
SY( I ) = SY( I ) + SA*SX( I )
SY( I + 1 ) = SY( I + 1 ) + SA*SX( I + 1 )
SY( I + 2 ) = SY( I + 2 ) + SA*SX( I + 2 )
SY( I + 3 ) = SY( I + 3 ) + SA*SX( I + 3 )
30    CONTINUE

ELSE
c               ** nonequal or nonpositive increments.
IX = 1
IY = 1
IF( INCX.LT.0 ) IX = 1 + ( N - 1 )*( -INCX )
IF( INCY.LT.0 ) IY = 1 + ( N - 1 )*( -INCY )

DO 40 I = 1, N
SY( IY ) = SY( IY ) + SA*SX( IX )
IX = IX + INCX
IY = IY + INCY
40    CONTINUE

END IF

END
```