Created
March 27, 2024 22:33
-
-
Save doug65536/2b6305c84a5ef819ea7408d49eeffbca 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
extern int external; | |
int global; | |
int init_global = 42; | |
short other(); | |
int main(int argc, char **argv) | |
{ | |
int x = 4; | |
int y; | |
y = argc * x; | |
return y; | |
} |
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
.bss | |
# Global variable of type int | |
.global global | |
.balign 4 | |
global: | |
.space 4 | |
.data | |
# Global variable of type int | |
.global init_global | |
.balign 4 | |
init_global: | |
.int 42 | |
.text | |
.global main | |
main: | |
push %rbp | |
mov %rsp,%rbp | |
add $ -16,%rsp | |
mov %edi,-4(%rbp) | |
mov %rsi,-16(%rbp) | |
mov $ 4,%eax | |
push %rax | |
mov -4(%rbp),%eax | |
push %rax | |
pop %r10 | |
imul %rax,%r10 | |
mov %r10,%rax | |
mov %eax,-24(%rbp) | |
jmp .L2 | |
.L2: | |
leave | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment