Last active
March 26, 2019 14:02
-
-
Save Bigtalljosh/75f73c4e97eebb338080870042bf0a46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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