def next_line(inst, nxt, line):
    """
  Our interpretation of the line number tricks described in lnotabs_notes.txt.
  Note: the last clause is not an lnotabs rule, but necessary for exception and yield resume edges.
  """
    return (nxt.line if nxt.is_line_start or nxt.off < inst.off or line < 0
         else line)
