Guest User

Untitled

a guest
Jun 20th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. .data
  2.  
  3.  
  4. .section .rodata
  5.  
  6. .text
  7.  
  8. .globl calc3
  9.  
  10. calc3:
  11.  
  12. pushq %rbp
  13. movq %rsp, %rbp
  14. subq $32, %rsp
  15.  
  16. movss %xmm1, -8(%rbp)
  17.  
  18. cvtss2sd %xmm0, %xmm0
  19.  
  20. call sin
  21.  
  22. movss -8(%rbp), %xmm1
  23. movsd %xmm0, -8(%rbp)
  24. cvtss2sd %xmm1, %xmm0
  25. # movsd %xmm1, %xmm0
  26.  
  27. call cos
  28.  
  29. movsd -8(%rbp), %xmm1
  30.  
  31. addsd %xmm1, %xmm0
  32.  
  33. leave
  34. ret
  35.  
  36. #main,
  37.  
  38.  
  39. #include<stdio.h>
  40. #include<math.h>
  41.  
  42. double calc3(float a, float b);
  43.  
  44. double calc4(float a, float b) {
  45. return sin(a) + cos(b);
  46. }
  47.  
  48. int main() {
  49.  
  50.  
  51. float a = 12;
  52. float b = 2.8;
  53.  
  54. printf("\n\tChamada em assemby: \t%f\n\n", calc3(a, b));
  55. printf("\n\tChamada em c: \t\t%f\n\n", calc4(a, b));
  56.  
  57. return 0;
  58. }
Add Comment
Please, Sign In to add comment