The paper presents a control flow obfuscation method to discourage reverse engineering and malicious tampering of software codes. Given the original source codes and desired obfuscation criteria, the proposed method works by decomposing the source codes into fragments and then applying various transforms to the code fragments. As the output of our method, the transformed fragments are re-assembled and obfuscated with the designated obfuscation criteria. Moreover, since only control flows are obfuscated with a sequence of transformations that produce equivalent results of the original fragments, the final output can still preserve the same execution results as the original codes. The proposed method can be combined with other security technologies like watermarking or fingerprinting and thus help discouraging software piracy by making watermarked information embedded in software codes difficult to be reverse engineered or tampered.