Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2.     a: 7
  3.     b: 42
  4.     res: 0
  5.     check: 1
  6.     final: 0
  7. .text
  8.     zero $r0
  9.     lw $r0, $r1, a
  10.     lw $r0, $r2, b
  11.     j checker
  12. checker:
  13.     lw $r0, $r3, check
  14.     lt $r2, $r1, $r0
  15.     beq $r0, $r3, gcd
  16.     j gcdC
  17. gcd:
  18.     sub $r1, $r2, $r1
  19.     zero $r0
  20.     lw $r0, $r3, final
  21.     beq $r1, $r3, storea
  22.     j checker
  23. gcdC:
  24.     sub $r2, $r1, $r2
  25.     zero $r0
  26.     lw $r0, $r3, final
  27.     beq $r2, $r3, storeb
  28.     j checker
  29. storea:
  30.     zero $r0
  31.     sw $r0, $r1, res
  32. storeb:
  33.     zero $r0
  34.     sw $r0, $r2, res
  35.     zero $r0
  36.     zero $r1
  37.     zero $r3
  38. exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement