;; Replaces
;;
;; ld rr, nn
;;
;; With
;; inc / dec rr
;;
;; If the previous known value of rr is nn - / + 1


OLEVEL: 3
OFLAG: 108

REPLACE {{
   ld $1, $2
}}

DEFINE {{
   $3 = ($2 == GVAL($1) .+ 1) && "inc" || ($2 == GVAL($1) .- 1) && "dec"
}}

IF {{
    IS_REG16($1) && $3 <> ""
}}

WITH {{
  $3 $1
}}
