Quantum software engineering is emerging as a relevant field, as it deals with the challenges of producing the new quantum software, whose adoption is steadily increasing. Quantum annealing software has gained a certain market penetration, demonstrating a good performance for optimization problems. However, there are no reverse engineering techniques with which to discover the underlying optimization problem definitions (the Hamiltonian functions to be minimized). Problem definitions are, in turn, dynamically defined using classical software, and can evolve over time, which make their accurate comprehension and abstract representation difficult. This paper, therefore, presents a dynamic analysis technique for D-Wave (Python) programs with which to reverse Hamiltonian expressions, and which are additionally represented according to the Knowledge Discovery Metamodel. The usage of this standard makes it possible to represent the reversed Hamiltonians in combination with other parts of classical–quantum software systems. In order to facilitate its adoption, the proposed technique has been empirically validated through a case study with 27 D-Wave programs that demonstrates its effectiveness and efficiency. The main implication of this research is that the proposed technique helps modernize quantum annealing software alongside hybrid software systems.