Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define p_mult
- '((fun (multiply x y)
- (vars
- []
- (return (* x y))))
- (fun (main)
- (vars
- [(x 6) (y 7)]
- (print (multiply x y))
- (return 0)))))
- '((jump _f_main)
- (data ST-PTR END-PROG)
- (data ST-PTR2 0)
- (label _f_multiply)
- (const _x0 3)
- (const _y0 4)
- (move (5 ST-PTR) (_x0 ST-PTR))
- (move (6 ST-PTR) (_y0 ST-PTR))
- (mul (7 ST-PTR) (5 ST-PTR) (6 ST-PTR))
- (move (1 ST-PTR) (7 ST-PTR))
- (jump (0 ST-PTR))
- (const frame-size-0 8)
- (label _f_main)
- (const _x1 3)
- (move (_x1 ST-PTR) 6)
- (const _y1 4)
- (move (_y1 ST-PTR) 7)
- (add ST-PTR2 ST-PTR frame-size-1)
- (const RETURN_LOC0 L0)
- (move (0 ST-PTR2) RETURN_LOC0)
- (move (2 ST-PTR2) ST-PTR)
- (move (7 ST-PTR) (_x1 ST-PTR))
- (move (3 ST-PTR2) (7 ST-PTR))
- (move (8 ST-PTR) (_y1 ST-PTR))
- (move (4 ST-PTR2) (8 ST-PTR))
- (move ST-PTR ST-PTR2)
- (jump _f_multiply)
- (label L0)
- (move ST-PTR2 ST-PTR)
- (move ST-PTR (2 ST-PTR))
- (move (8 ST-PTR) (1 ST-PTR2))
- (print-val (8 ST-PTR))
- (move (9 ST-PTR) 0)
- (move (1 ST-PTR) (9 ST-PTR))
- (jump (0 ST-PTR))
- (const frame-size-1 10)
- (label END-PROG)
- 1
- (data FILLER (5000 0)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement