SHARE
TWEET

Untitled

a guest Jan 24th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2.     arr1    dq  1, 2, 3, 4, 5
  3.     arr2    dq  5, 6, 7, 8, 9
  4.  
  5. section .bss
  6.     arr3    resq    5
  7.     result  resq    1
  8.  
  9. section .text
  10.     global _start
  11.  
  12. _start:
  13.     mov ecx, 5
  14.     mov rbx, 0
  15.  
  16. _sumTwoValues:
  17.     mov rax, qword[arr1 + rbx * 8]
  18.     add rax, qword[arr2 + rbx * 8]
  19.     mov qword[arr3 + rbx * 8], rax
  20.     push rax
  21.     inc rbx
  22.     loop _sumTwoValues
  23.  
  24. _beforeSumAll:
  25.     mov ecx, 5
  26.     mov rbx, 0
  27.     mov rax, 0
  28.  
  29. _sumAll:
  30.     pop rsi
  31.     add rax, rsi
  32.     inc rbx
  33.     loop _sumAll
  34.  
  35. _writeResult
  36.     mov qword[result], rax
  37.  
  38. _end:
  39.         mov rax, 60
  40.         mov rdi, 0
  41.         syscall
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top