...

/

Disassembly Output in the Code Optimization Mode

Disassembly Output in the Code Optimization Mode

Learn how to reconstruct a code in C/C++ language with the help of GDB disassembly output in optimization mode.

We'll cover the following...

Disassembly output with optimization

We can add flags for optimizing the code while compiling our source file. A flag -O is used for the optimization of code, and the -O1 flag further optimizes the code size and execution time. There are other flags for optimization, such as -O2 and -O3, which reduce the code size and execution time even more.

Source code

Here, we give a C/C++ code for our project of reconstructing a program through the GDB disassembly output in the optimization mode.

int a, b;
int *pa, *pb;
int main(int argc, char* argv[])
{
pa = &a;
pb = &b;
*pa = 1;
*pb = 1;
*pb = *pb + *pa;
++*pa;
*pb = *pb * *pa;
return 0;
}
...