                  (goto-if-nil-else-pop jmp)
                  (goto-if-not-nil-else-pop jmp)
                  ;; - Instructions with argument -
-                 (constant op1)
                  (call op1)
                  (stack-set op1)
-                 (var-ref op1 byte-varref)
-                 (var-set op1 byte-varset)
                  ;; - Instructions without argument -
                  (setcar op0)
                  (setcdr op0)

            arg (if (eq 'op0 (goism--ir-info-kind op-info))
                    nil
                  (pop! pkg)))
      (push (goism--ir-lap-instr tags op-info op arg) output))
    (nreverse output)))

(defun goism--ir-lap-instr (tags op-info op arg)
  ;; Patterns in `pcase' are sorted by frequency order.
  (pcase (goism--ir-info-kind op-info)
    (`op0 (list (goism--ir-info-data op-info)))
    (`op1 (let ((lap-op (goism--ir-info-data op-info)))
            (cons lap-op arg)))
    (`stack-ref (if (= arg 0)
                    (list 'byte-dup)
                  (cons 'byte-stack-ref arg)))
    (`discard (if (= arg 1)
                  (list 'byte-discard)
                (cons 'byte-discardN arg)))
    (`label (goism--ir-tag-ref tags arg))
    (`jmp (let* ((lap-op (goism--ir-info-data op-info))
                 (tag (goism--ir-tag-ref tags arg)))
            (cons lap-op tag)))
    (`concat (if (and (<= arg 4) (/= 1 arg))
                 (list (aref (goism--ir-info-data op-info) arg))
               (cons 'byte-concatN arg)))

    (_
     (error "Unexpected op kind for `%s'" op))))

;; {{ end }}
