Facebook
From Scanty Duck, 2 Months ago, written in Plain Text.
This paste is a reply to Re: Untitled from Silly Porcupine - view diff
Embed
Download Paste or View Raw
Hits: 159
  1. global suma
  2. extern printf
  3.  
  4. section .text
  5.  
  6. suma:
  7.        
  8. push    r12
  9. push    r15
  10.  
  11. mov     r12,0 ;na sume parz
  12. mov     r15,0 ;na sume nieparz
  13. dec     rsi
  14.  
  15. petla:
  16. dec     rsi
  17. jb      end_while
  18. mov     rax, qword [rdi+rsi*4] ;element tablicy do rax
  19. jp      parz
  20. jnp     nieparz
  21.  
  22.  
  23. parz:
  24. add     r12,[rax]
  25. jmp     petla
  26.  
  27. nieparz:
  28. add     r15,[rax]
  29. jmp     petla
  30.  
  31. end_while:
  32. mov     [rdx], r12
  33. mov     [rdx+4], r15
  34.  
  35. pop     r15
  36. pop     r12
  37. ret