Advertisement
asharma

remainder

Feb 26th, 2019
1,398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main:
  2.     addi x4, x0, 255
  3.  
  4.     addi sp, sp, 1600
  5.     addi sp, sp, -8
  6.     sd   x4, 0(sp)
  7.     jal  x1, make_even
  8.     addi x4, x4, -4
  9.     ld   x4, 0(sp)
  10.     addi sp, sp, 8
  11.     ld   x4, 0(sp)
  12.     # ecall x4, x4, 0
  13.     ORG 96
  14.  
  15.  
  16. make_even:
  17.     addi x5, x0, 2
  18.     rem  x6, x4, x5
  19.     beq  x6, x0, else
  20.     addi x4, x4, -1
  21.     sd   x4, 0(sp)
  22.     jalr x0, 0(x1)
  23.     # ORG 96
  24.  
  25. else:
  26.     jalr x0, 0(x1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement