I want to write a function that does something like:
def addme(x, y):
return x + y
I know there is already an instruction for this, but I'm practicing how to pass args in a function. What would be the proper way to pass args? I have seen something like:
# addme(5,2)
push $2
push $5
call addme
add $16, %rsp
Is this the correct way to pass in args, by pushing them to the stack in reverse order and then after doing the function call resetting the stack pointer? I have also heard that the parameters are passed in %rdi, %rsi, .... Is one correct and the other is incorrect, or what is the proper way to do this?