          move-next)
     (move-next state)))
 
+(defn perform-mult
+  [{[op1 op2] :operands} state]
+  (let [result (* (resolve-value op1 state) (resolve-value op2 state))]
+    (->> state
+         (set-register op1 result)
+         (move-next))))
+
 (defn perform-jnz
   [{[op steps] :operands} state]
   (let [steps-value (resolve-value steps state)

    "dec" (perform-dec operation state)
    "jnz" (perform-jnz operation state)
    "tgl" (perform-tgl operation state)
    (throw (Exception. (str "Unknown operation" operation)))))

(defn execute-instructions

      (recur (perform-operation (instructions next) current-state))
      current-state)))


; several instructions in the original input are replaced with new "mult" instruction followed
; by setting a few registers to 0 and then jumping to the end of the multiplication (to keep the total number of instructions)
; the same as in the original input
(def input "cpy a b\ndec b\nmult a b\ncpy 0 c\ncpy 0 d\njnz 1 5\ndec c\njnz c -2\ndec d\njnz d -5\ndec b\ncpy b c\ncpy c d\ndec d\ninc c\njnz d -2\ntgl c\ncpy -16 c\njnz 1 c\ncpy 73 c\njnz 82 d\ninc a\ninc d\njnz d -2\ninc c\njnz c -5")

; Part 1
(->> input
     (monorail/parse-instructions)
     (get-initial-state)
     (set-register {:name "a"} 7)
     (execute-instructions)
     (:registers)
     (println "Part 1"))

; Part 2
(->> input
     (monorail/parse-instructions)
     (get-initial-state)
     (set-register {:name "a"} 12)
     (execute-instructions)
     (:registers)
     (println "Part 2"))
