basic blocks decomposition and some simple optimizations were made