fork download
  1. // argumenty przekazywane przez stos,
  2. // za uporządkowanie stosu odpowiada wywołujący funkcję
  3. // wszystkie rejestry zachowywane przez wołanego
  4. .intel_syntax noprefix
  5. .globl main
  6. .text
  7.  
  8. main:
  9. mov eax, 10
  10.  
  11. push eax
  12. call silnia
  13. add esp, 4
  14.  
  15. push eax
  16. push offset msg
  17. call printf
  18. add esp, 8
  19.  
  20. mov eax, 0
  21. ret
  22.  
  23. silnia:
  24. push ebp
  25. mov ebp, esp
  26. push ecx
  27. push edx
  28. mov eax, [ebp+8]
  29. cmp eax, 0
  30. jne dalej
  31. mov eax, 1
  32. pop edx
  33. pop ecx
  34. pop ebp
  35. ret
  36. dalej:
  37. push eax
  38. dec eax
  39. push eax
  40. call silnia
  41. add esp, 4
  42. pop ecx
  43. mul ecx
  44. pop edx
  45. pop ecx
  46. pop ebp
  47. ret
  48.  
  49. .data
  50. msg: .asciz "silnia=%d\n"
  51.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:4:2: error: expected identifier or '(' before '.' token
  .intel_syntax noprefix
  ^
stdout
Standard output is empty