Peeking Under the Hood: Week 1 of CS-410 (a.k.a. “... Assembly?”)

• 6–8 min read

I started Software Reverse Engineering this week. The readings were dense-but-good (school PDFs + Chapters 1–2 of Reversing: Secrets of Reverse Engineering by Eldad Eilam). Then I asked g++ to turn a baby C++ program into assembly and immediately regretted all my life choices.


The readings (and why my brain feels like it owes me rent)

Older textbook? Yes. Outdated? Not really. Eilam’s early chapters are like opening a classic car manual: the paint scheme might change, but pistons are still pistons. Same deal with binaries. You learn what’s actually happening, not just what your IDE wants you to believe is happening.


Takeaway: reverse engineering is less about “breaking stuff” and more about explaining software—structure, intent, side effects—when the source is gone or untrustworthy.


Assembly: the ancient alien hieroglyphs

This week we met assembly. Think: the English subtitles for what your CPU actually speaks. Functional. Blunt. Unapologetic. Looks terrifying at first glance. I’m not in love with it, but I’m convinced this is going to level up how I design and debug software. When you see how the sausage is made, you write better sausage. (We’re sticking with that metaphor. No refunds.)


The Assignment

We were given a small C++ program:

            
                #include <iostream>
                using namespace std;

                int main() {
                    int width = 10;
                    int height = 5;
                    int area;

                    area = width * height;

                    cout<<endl<< area;

                    return 0;
                }
                
            
        
then were instructed to run the file through the g++ compiler with a small command line instruction:
            
                g++ -S filename.cpp
            
        
The result was a mall .s file. This is the file that was filled with the alien hieroglyphs! It looked something like this:
            
                subq	$16, %rsp
                movl	$10, -12(%rbp)
                movl	$5, -8(%rbp)
                movl	-12(%rbp), %eax
                imull	-8(%rbp), %eax
                movl	%eax, -4(%rbp)
            
        
Now the fun begins! We were to match the C++ line to its assembly counterpart, and explain what those mysterious lines of code are doing. After flipping screens between resource material, C++ code, and assembly code, for the billionth time, I managed to scrape together a pretty decent mapping with real definitions. And as always, my little code reviewer, Dasha, supervised from the chair she is absolutely convinced is hers, offering subtle barks to keep me on my game!


A tiny example of how this stuff reads


                
                    C++                 Assembly                    English
                    int main()          main:                       Sets up the stack for the main function. 
                                            pushq %rbp              Creates space in memory for local variables, reserving 16 bytes.
                                            movq %rsp, %rbp
                                            subq $16, %rsp
                    
                    int width = 10;         movl $10, -12(%rbp)     Stores the value of 10 into memory, equal to 4 bytes, 
                                                                    leaving 12 bytes of empty reserve.

                    int height = 5;         movl $5, -6(%rbp)       Stores the value of 5 into memory, equal to 4 bytes, 
                                                                    leaving 8 bytes of empty reserve.
                
            
Once you map a few of these, it start to look less… alien. Still alien. But less.


Next week I'm pretty sure we're moving onto loops and function calls. If you’ve tangoed with assembly in the real world—malware analysis, performance tuning, weird crash dumps—tell me your war stories. How did you get comfortable? Any “wish I knew this on day one” tips?




← Back to blog