Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void func2(int a, int b, int c){
- printf("%d %d %d\n", a, b, c);
- }
- void func1(int c){
- func2(1,2,c);
- }
- int main(void){
- func1(3);
- return 0;
- }
- -----------
- func1 replaced with the following assembly
- _func1:
- # use ecx as the base pointer
- movl %esp, %ecx
- # allocate more stack in 16 byte increments
- subl $16, %esp
- # copy the return address to top of the stack
- movl (%ecx), %eax
- movl %eax, (%esp)
- # copy the old parameter
- movl 4(%ecx), %eax
- movl %eax, 12(%esp)
- # add the two new ones
- movl $2, 8(%esp)
- movl $1, 4(%esp)
- jmp _func2
Add Comment
Please, Sign In to add comment