Advertisement
Guest User

Untitled

a guest
Mar 8th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 0.61 KB | None | 0 0
  1. .constant
  2. c 100
  3. .end-constant
  4.  
  5. .method mul(x, y)
  6. .var
  7. i
  8. res
  9. .end-var
  10. ILOAD y
  11. ISTORE i
  12. BIPUSH 0
  13. ISTORE res
  14. lb_add: ILOAD res
  15. ILOAD x
  16. IADD
  17. ISTORE res
  18. IINC i -1
  19. ILOAD i
  20. IFEQ lb_done
  21. GOTO lb_add
  22. lb_done: ILOAD res
  23. IRETURN
  24. .end-method
  25.  
  26. .method pow(x, y)
  27. .var
  28. i
  29. res
  30. .end-var
  31. ILOAD y
  32. ISTORE i
  33. BIPUSH 1
  34. ISTORE res
  35. lb_mul: BIPUSH 0
  36. ILOAD res
  37. ILOAD x
  38. INVOKEVIRTUAL mul
  39. ISTORE res
  40. IINC i -1
  41. ILOAD i
  42. IFEQ lb_done
  43. GOTO lb_mul
  44. lb_done: ILOAD res
  45. IRETURN
  46. IRETURN
  47. .end-method
  48.  
  49. .main
  50. BIPUSH 0
  51. BIPUSH 2
  52. BIPUSH 4
  53. INVOKEVIRTUAL mul
  54. BIPUSH 0
  55. BIPUSH 2
  56. BIPUSH 4
  57. INVOKEVIRTUAL pow
  58. .end-main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement