You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
366B

  1. format ms64 coff
  2. section '.text' code readable executable
  3. use64
  4. public _loop
  5. _loop:
  6. mov rax, rcx
  7. @loop_loop:
  8. mul rcx
  9. nop
  10. nop
  11. nop
  12. loop @loop_loop ; lol
  13. ret
  14. public _tail_recursion
  15. _tail_recursion:
  16. test ecx, ecx
  17. je @is_0
  18. mov eax, ecx
  19. dec ecx
  20. @loop:
  21. test ecx, ecx
  22. jz @tr_end
  23. mul ecx
  24. dec ecx
  25. jnz @loop
  26. jmp @tr_end
  27. @is_0:
  28. mov eax, 1
  29. @tr_end:
  30. ret