;; Tries to optimize a == b for U/Bytes
;; Replace sequence:
;;  sub 1
;;  jp nc, __LABEL | jp c, __LABEL
;; With:
;;  or a
;;  jp nz, __LABEL | jp z, __LABEL

OLEVEL: 1
OFLAG: 19

REPLACE {{
 sub 1
 $1 $2, $3
}}

DEFINE {{
  $4 = (($2 == nc) && nz) || z
}}

IF {{
  (($1 == jp) || ($1 == jr)) && (($2 == nc) || ($2 == c))
}}

WITH {{
 or a
 $1 $4, $3
}}
