code: protected final int find_stack_map_index_before(int offset) {
  
      number_active_locals = initial_locals_count;
      running_offset = -1; // no +1 on first entry
      for (int i = 0; i < stack_map_table.length; i++) {
        running_offset = running_offset + stack_map_table[i].getByteCodeOffset() + 1;
        if (running_offset >= offset) {
          if (i == 0) {
            // reset offset to previous
            running_offset = -1;
            return -1;
          } else {
            // back up offset to previous
            running_offset = running_offset - stack_map_table[i].getByteCodeOffset() - 1;
            // return previous
            return i - 1;
          }
        }
  
        // Update number of active locals based on this StackMap entry.
        int frame_type = stack_map_table[i].getFrameType();
        if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) {
          number_active_locals += frame_type - 251;
        } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
          number_active_locals -= 251 - frame_type;
        } else if (frame_type == Const.FULL_FRAME) {
          number_active_locals = stack_map_table[i].getNumberOfLocals();
        }
        // All other frame_types do not modify locals.
      }
  
      if (stack_map_table.length == 0) {
        return -1;
      } else {
        return stack_map_table.length - 1;
      }
    }
docs: Find the index of the StackMap entry whose offset is the last one before the input argument.
  Return -1 if there isn't one. Also sets running_offset and number_active_locals.
  
  @param offset byte code offset
  @return the corresponding StackMapEntry index