Assuming you are using GCC (which usually comes with CodeBlocks), then you need to read these instructions.
You can also create assembly listings files (with .s extension) which contain a full compilable assembly code (in a human readable listing). Then, you can assemble the assembly listings file into an object file (with .o extension) and then link it to the rest of your application.
Actually creating fully functioning functions in assembly is not a simple task, even for the simplest function. The easiest, if you are looking to optimize, is to write your function in C, and then compile as
$ gcc -S my_source.c -o my_source.s to generate the assembly listing for your source file, and then manually optimize the assembly code before completing the compilation into the object file.
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.