I have the following assembly (x64) function:
400700: sub rsp,0x18
400704: mov QWORD PTR [rsp+0x8],rdi
400709: cmp QWORD PTR [rsp+0x8],0x0
40070f: jne 400718 <bar+0x18>
400711: mov eax,0x0
400716: jmp 400734 <bar+0x34>
400718: mov rax,QWORD PTR [rsp+0x8]
40071d: sub rax,0x1
400721: mov rdi,rax
400724: call 400700 <bar>
400729: mov rdx,rax
40072c: mov rax,QWORD PTR [rsp+0x8]
400731: add rax,rdx
400734: add rsp,0x18
400738: ret
I've figured out that the beginning part is just the header for any assembly program. Also, I think that the two QWORD are either from longs or characters. I'm guessing that the jne jump is probably a conditional statement, but I'm not too sure. It looks like the function is recursive since it has a line that calls "bar" again.
My guess for the overall function is that it takes two longs and recursively adds them (Fibonacci, maybe?). I don't have much reasoning for this guess though, and I could be incorrect.
Could anyone please help me solve this problem? Or, if there's a way for me to pass in parameters (I don't even know what kind of argument the function takes) and see the output, then I can try to backtrack and figure out what the program is doing.
Thanks