;; Replaces sequence:
;;  push af
;;  pop XY
;; with
;;  ld X, a
;; (also reverse order allowed)

OLEVEL: 3
OFLAG: 7

REPLACE {{
 push $1
 pop $2
}}

IF {{
  ($1 <> $2) && (($1 == af) || ($2 == af))
}}

DEFINE {{
  $3 = HIREG($1)
  $4 = HIREG($2)
}}

WITH {{
 ld $4, $3
}}
