def METHOD_NAME(bb_lines):
    # find last incref
    last_incref_pos = 0
    for pos, ln in enumerate(bb_lines):
        if _regex_incref.match(ln) is not None:
            last_incref_pos = pos + 1
    # find last decref
    last_decref_pos = 0
    for pos, ln in enumerate(bb_lines):
        if _regex_decref.match(ln) is not None:
            last_decref_pos = pos + 1
    last_pos = max(last_incref_pos, last_decref_pos)
    # find decrefs before last_pos
    decrefs = []
    head = []
    for ln in bb_lines[:last_pos]:
        if _regex_decref.match(ln) is not None:
            decrefs.append(ln)
        else:
            head.append(ln)
    # insert decrefs at last_pos
    return head + decrefs + bb_lines[last_pos:]