Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int add(int a, int b) {
- return a + b;
- }
- int main() {
- return add(42, 1337);
- }
- .file "test.c"
- .text
- .globl add
- .type add, @function
- add:
- pushq %rbp
- movq %rsp, %rbp
- pushq %rdi
- pushq %rsi
- mov -8(%rbp), %eax
- pushq %rax
- mov -16(%rbp), %eax
- pushq %rax
- popq %rax
- popq %rcx
- addl %ecx, %eax
- push %rax
- popq %rax
- movq %rbp, %rsp
- popq %rbp
- ret
- .size add, .-add
- .text
- .globl main
- .type main, @function
- main:
- pushq %rbp
- movq %rsp, %rbp
- pushq %rbx
- movq %rsp, %rbx
- andq $-16, %rsp
- subq $8, %rsp
- pushq $add
- push $1337
- push $42
- popq %rdi
- popq %rsi
- movq 0(%rsp), %rax
- call *%rax
- movq %rbx, %rsp
- popq %rbx
- pushq %rax
- popq %rax
- movq %rbp, %rsp
- popq %rbp
- ret
- .size main, .-main
- .ident "Sortix CC"
- .section .note.GNU-stack,"",@progbits
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement