Skip to content

Instantly share code, notes, and snippets.

@Bigtalljosh
Last active March 26, 2019 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bigtalljosh/75f73c4e97eebb338080870042bf0a46 to your computer and use it in GitHub Desktop.
Save Bigtalljosh/75f73c4e97eebb338080870042bf0a46 to your computer and use it in GitHub Desktop.
int square(int num);
int main(int argc, const char* argv[])
{
int result = square(10);
}
int square(int num)
{
return num * num;
}
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov DWORD PTR [rbp-20], edi
mov QWORD PTR [rbp-32], rsi
mov edi, 10
call square(int)
mov DWORD PTR [rbp-4], eax
mov eax, 0
leave
ret
square(int):
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], edi
mov eax, DWORD PTR [rbp-4]
imul eax, DWORD PTR [rbp-4]
pop rbp
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment