Advertisement
bueddl

Untitled

Feb 1st, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .global _add
  2. .type _add, @function
  3.  
  4. .text
  5.  
  6. _add:
  7.     push %rbp
  8.     mov %rsp, %rbp
  9.     push %rax
  10.     push %rbx
  11.     push %rcx
  12.     mov 0x10(%rbp), %rax    # lhs
  13.     mov 0x18(%rbp), %rbx  # rhs
  14.     xor %rcx, %rcx              # i = 0
  15.     clc
  16.     pushf
  17. loop:
  18.     popf
  19.     movl (%rax, %rcx, 4), %esi  # rhs[i]
  20.     movl (%rbx, %rcx, 4), %edi  # lhs[i]
  21.     adc %esi, %edi
  22.     movl %edi, (%rbx, %rcx, 4)
  23.     inc %rcx
  24.     pushf
  25.     cmp %rcx, %rdx          # i != block_count
  26.     jnz loop
  27.     popf
  28.     pop %rcx
  29.     pop %rbx
  30.     pop %rax
  31.     pop %rbp
  32.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement