Im trying to make sense of a small bit of assembly.
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%edx
movl 12(%ebp),%eax
movl %ebp,%esp
movl (%edx),%edx
addl %edx,(%eax)
movl %edx,%eax
popl %ebp
ret
Why is the sp being reset to the base pointer before the rest of the function? Why is the value in %edx being moved back into itself?