The method ASMAPI#findFirstInstructionBefore ignores the startIndex parameter and instead always starts searching from the end of the method.
|
for (int i = Math.max(method.instructions.size() - 1, startIndex); i >= 0; i--) { |
Math.max should be replaced with
Math.min to fix this.