
Constant Values Distribution Investigation in the C Programs Source Code
https://doi.org/10.31854/1813-324X-2024-10-5-118-128
EDN: KARAVM
Abstract
Currently, software engineering plays a key role in software development, one of the criteria for the development of which is the investigation of its factology and various scientific and practical patterns. An important aspect of this area is the logic of program execution, operating with internal data, and, in particular, constant values, the identification of patterns in which actualizes this research. The main applications of this pattern include obtaining fundamental knowledge about algorithms, creating new and expanding existing metrics for evaluating and comparing program code, developing methods for its optimization, using it in genetic programming, etc.
The purpose of this article is to obtain the frequency distribution of constant values in the source code of programs in the C programming language.
The essence of the presented approach is to create a method for statistical analysis of the text of the source codes of programs contained in the ExeBench dataset (which consists of a huge amount of source code of functions in the C programming language, their assembler code for various processor architectures, compilation errors and other information).
The proposed method is based on the use of algorithms for lexical and syntactic analysis of source code functions, semantic definition of constant types, and conversion of the recording of programming language symbols into the corresponding numeric or string values.
The method has an implementation in the form of a software tool in the Python programming language, given in the form of an intuitive pseudocode. Experiments using this prototype allowed us to obtain the desired distribution of constant values for the source code of programs in the C programming language. Analysis of the obtained results allowed us to make a number of important theoretical and practical conclusions regarding the most frequently used constants, the correspondence of the obtained distribution to the Zipf law and its proximity to the exponential function, the anomalous appearance of a number of constants in the Top 50, etc.
The scientific novelty of the proposed approach lies in the fact that the distribution of constant values for the source code of programs in the C programming language is obtained for the first time.
The theoretical significance consists in obtaining new fundamental knowledge regarding the features and patterns of source code constructions, which can be extended to other programming languages.
The practical significance consists in applying the distribution to a wide range of tasks, including the author's genetic reverse engineering, which in itself is a qualitatively new direction.
About the Author
K. E. IzrailovRussian Federation
References
1. Kastornov A.F.1, Kastornova V.A. Programming languages and their role in formation of subject domain of "Information Scientist. Pedagogical Informatics. 2016;1:59‒68. (in Russ.) EDN:VUUFHV
2. Konovalov G.G. Measuring the quality of clean code: Metrics and analysis tools. Tendentsii razvitiia nauki i obrazovaniia. 2023;102-5:25-28. (in Russ.) DOI:10.18411/trnio-10-2023-244. EDN:GDPWLC
3. Hlystov I.S., Zharova O.Y. Genetic programming. Electronic Journal: Science, Technology and Education. 2016;4(9):62‒67. (in Russ.) EDN:XHJVHH
4. Izrailov K. The Genetic Decompilation Concept of the Telecommunication Devices Machine Code. Proceedings of Telecommunication Universities. 2021;7(4):95‒109. (in Russ.) DOI:10.31854/1813-324X-2021-7-4-95-109. EDN:AIOFPM
5. Kotenko I., Izrailov K., Buinevich M. Analytical Modeling for Identification of the Machine Code Architecture of Cyberphysical Devices in Smart Homes. Sensors. 2022;22.(3):1017. DOI:10.3390/s22031017
6. Buynevich M.V., Izrailov K.E. Method for classification of files on the basis of machine training technology. Vestnik of St. Petersburg State University of Technology and Design. Series 1. Natural and technical sciences. 2020;1:34‒41. (in Russ.) DOI:10.46418/2079-8199_2020_1_6. EDN:MDPYTW
7. Izrailov K.E. Predicting the size of the source code of a binary program in the interests of its intellectual reverse engineering. Voprosy kiberbezopasnosti. 2024;4(62):13‒25. (in Russ.) DOI:10.21681/2311-3456-2024-4-13-25. EDN:NRFCND
8. Kucherova S.V. Zipf's law and its applications in the field of linguistics. Nekotorye voprosy analiza algebry geometrii i matematicheskogo obrazovaniia. 2020;10:107‒108. (in Russ.) EDN:QRNCOY
9. Leonov N., Buinevich M., Chechulin A. Top-20 Weakest from Cybersecurity Elements of the Industry Production and Technology Platform 4.0 Information Systems. Proceedings of the International Russian Smart Industry Conference, SmartIndustryCon, 25‒29 March 2024, Sochi, Russian. IEEE; 2024. p.668‒675. DOI:10.1109/SmartIndustryCon61328.2024.10515678
10. Fomin A.I. Estimation of the difficulty of the disassembled code of the executed programs. Natural and technical sciences. 2021;7(158):210‒211. (in Russ.) EDN:UBNPCY
11. Ormonova E.M. Determining the quality of the software product based on the theory of graphs. Science. Education. Technology. 2021;1(70):37‒44. (in Russ.) EDN:ITSANI
12. Lebedev V.V. Control flow flattening deobfuscation using symbolic execution. Applied Discrete Mathematics. Supplement. 2021;14:134‒138. (in Russ.) DOI:10.17223/2226308X/14/29. EDN:ITNATQ
13. Korolev V.Y., Smelyanskii R.L., Smelyanskii T.R., Shalimov A.V. On the estimation of the execution frequency of sequential program code snippets. Journal of Computer and Systems Sciences International. 2015;54(4):540‒545. DOI:10.1134/S10 6230715040097. EDN:UFCQZB
14. Armengol-Estapé J., Woodruff J., Brauckmann A., Magalhães J.W.S., O'Boyle M.F.P. ExeBench: an ML-scale dataset of executable C functions. Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming, 13 June 2022, New York, USA. ACM; 2022. p.50–59. DOI:10.1145/3520312.3534867
15. Toomey W. Ctcompare: Code clone detection using hashed token sequences. Proceedings of the 6th International Workshop on Software Clones, IWSC, 04 June 2012, Zurich, Switzerland. IEEE; 2012. p.92‒93. DOI:10.1109/IWSC.2012.6227881
16. Samuelsson C. Comparative evaluation of the stochastic simplex bisection algorithm and the SciPy.Optimize module. Proceedings of the Federated Conference on Computer Science and Information Systems, FedCSIS, 13‒16 September 2015, Lodz, Poland. IEEE; 2015. p.573‒578. DOI:10.15439/2015F47
17. Barlyaeva E.A. Human mental activity in metaphors and similies. Proceedings of Voronezh State University. Series: Linguistics and intercultural communication. 2016;3:15‒18. (in Russ.) EDN:WKNUBD
Review
For citations:
Izrailov K.E. Constant Values Distribution Investigation in the C Programs Source Code. Proceedings of Telecommunication Universities. 2024;10(5):119-129. (In Russ.) https://doi.org/10.31854/1813-324X-2024-10-5-118-128. EDN: KARAVM