Search code examples
cassemblyoptimizationx86object-files

How to modify existing assembly code generated from C


I'm writing some methods in C that must run very efficiently, so I'd like to manually edit some of the assembly code that is automatically generated. I know how to read the assembly code using gdb or "objdump -d myfile.o", but can anyone tell me how to edit this code? (Will probably just be minor tweaks.)


Solution

  • Sure. It's called "inline assembly", and most compilers support it.

    Here's an example using GCC: