Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Let's rewrite our "Arithmetic" program in C++. Corresponding assembly language instructions are put in comments:
int a, b;
int main(int argc, char* argv[])
{
a = 1; // mov [a], 1
b = 1; // mov [b], 1
b = b + a; // mov eax, [a]
// add [b], eax
++a; // inc eax
// mov [a], eax
b = a * b; // imul [b]
// mov [b], eax
// results: [a] = 2 and [b] = 4
return 0;
}