I am learning assembly, and I am having trouble understanding what is wrong this my code. I am trying to pass a value (4 in this example) to a function in C, which just prints this value. But, when I run the code, it prints 1 instead of 4. I am running 64-bit on Ubuntu, and I am compiling with GCC.
Here is the assembly:
.extern myprint
.text
.global main
main:
push $4
call myprint
mov $1, %eax
int $0x80
And here is the function in C:
#include <stdio.h>
int myprint(int n) {
printf("%d\n", n);
return 0;
}