Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * gcc -m32 -o code code.c
- * author: Antonio Costa aka Cooler_
- * contact: [email protected]
- * bugsec.com.br
- *
- * very simple calc test
- * */
- #include <stdio.h>
- #define w printf
- #define foo (int,int)
- #define num "%d\x0a"
- int add foo;
- int sub foo;
- int mul foo;
- int div foo;
- void
- main(void)
- {
- register int a=5,b=30;
- w("A=%d B=%d \x0a",a,b);
- w(num, add(a,b))&w(num, sub(a,b));
- w(num, mul(a,b))&w(num, div(a,b));
- }
- int add(int a, int b)
- {
- __asm__("movl 8(%ebp), %ebx\n"
- "movl 12(%ebp), %eax\n"
- "addl %ebx, %eax\n");
- }
- int sub(int a, int b)
- {
- __asm__("movl 8(%ebp), %ebx\n"
- "movl 12(%ebp), %eax\n"
- "subl %ebx, %eax\n");
- }
- int mul(int a, int b)
- {
- __asm__("movl 8(%ebp), %ebx\n"
- "movl 12(%ebp), %eax\n"
- "imul %ebx, %eax\n");
- }
- int div(int a, int b)
- {
- __asm__("movl 8(%ebp), %ebx\n"
- "movl 12(%ebp), %eax\n"
- "divl %ebx, %eax\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment