Simple X86 Assembly Code

Create an assembly code file: foo.s.

Run as foo.s -o foo.o to compile assembly code to object code.

Create a C file to call foo: callfoo.c

Run clang callfoo.c foo.o -o callfoo to compile those files into an executable file.

Run ./callfoo, you'll get the output as 3.