C2ASM is a lightweight C program that compiles C source files and prints their assembly output in Intel syntax. It is designed as a learning tool to explore how C code translates into assembly instructions.
This project currently supports GCC and Clang and is ideal for anyone learning C, assembly, or compiler behavior.
- Detects installed compilers (GCC or Clang).
- Generates assembly using
-Swith Intel syntax (-masm=intel). - Dynamic compiler selection: prompts user if both GCC and Clang are installed.
- Watch mode: automatically recompiles when source file changes and shows diff.
- Focus mode: highlight specific functions or symbols while dimming other lines.
- Strip mode: removes common assembly noise (
.cfi,.file,.ident). - Instruction count: shows the number of instructions per function.
- Save assembly: writes output to
.sfiles instead of only printing to console.
- Detects installed compiler(s) (GCC/Clang).
- Builds a dynamic compile command for the source file(s).
- Executes the compiler command, capturing assembly output.
- Processes output according to user flags (focus, strip, size, save).
- In watch mode, automatically detects file changes and shows differences in assembly.
- GCC or Clang installed on your system.
- Terminal environment
- C compiler capable of generating Intel-syntax assembly (
-masm=intel).
make # Build the project
make run # Run ASM Explorer
make clean # Remove executable and temporary files./asm_explorer [options] <source_file> -- [compiler flags]| Option | Description |
|---|---|
--help |
Show usage information |
--watch |
Recompile when source file changes and show diff |
--focus <SYM> |
Highlight a specific function or symbol |
--strip |
Remove common assembly noise (.cfi, .file, .ident) |
--size |
Show instruction count per function |
--Sasm |
Save assembly output to .s file(s) |
./asm_explorer dir/file.c./asm_explorer --strip dir/file.c./asm_explorer --focus foo --size dir/file.c./asm_explorer --watch dir/file.c -- -Wall -Wextra -g -IincludeDesigned primarily for learning and exploring C-to-assembly translation.
- Platform support: Watch mode currently relies on Linux
inotify(macOS/Windows support would requirekqueue/file-polling adjustments). - Planned improvements:
- Cleaner, more structured assembly output formatting
- Cross-platform file monitoring
- Dynamic support for multiple source files
- Advanced symbol focus and filtering options
This is an intentionally lightweight, learning-stage CLI tool built to explore C and assembly internals. Some features (such as watch mode and edge-case argument handling) have known platform and input limitations, and output formatting is kept minimal.
BOADU NERISON PHILIP