1. A computer-implemented method for detecting malicious software programs, the method comprising: dividing, by a hardware processor, a code of a software program into a plurality of code blocks of a predetermined size; performing, by the hardware processor, an optimization of one or more of the plurality of code blocks, wherein the optimization of a code block includes: generating a converted code block by disassembling the code block into a low-level programming language; generating a simplified code block by replacing complex assembly instructions in the converted code block with basic instructions; generating a data flow model of the simplified code block; analyzing dependencies and interrelations of code elements of the data flow model; identifying obfuscated software code elements in the simplified code block based on the analysis of the data flow model; and generating an optimized code block by changing or removing one or more identified obfuscated code elements in the simplified code block; determining, by the hardware processor, a degree of code obfuscation of at least one optimized code block by comparing the number of instructions in the optimized code block with the number of instructions in the converted code block; and determining, by the hardware processor, whether the software program is malicious based on the degree of code obfuscation of at least one optimized code block and before completing the optimization of all code blocks of the software program.