def extract_annealing_log(log):
    """
    Parses a VPR log line by line. Extracts the table with simulated annealing
    data. Returns the table header and data line lists as separate.
    """

    # Find a line starting with "# Placement"
    for i, line in enumerate(log):
        if line.startswith("# Placement"):
            log = log[i:]
            break
    else:
        return [], []

    # Find and cut the header
    header_lines = []
    for i, line in enumerate(log):
        if line.startswith("------"):
            header_lines = log[i:i+3]
            log = log[i+2:]
            break

    # Gather data lines until '# Placement took' is encountered
    data_lines = []
    for line in log:

        # Reached the end of the placement section
        if line.startswith("# Placement took"):
            break

        # Split into fields. All of them have to be numbers
        fields = line.strip().split()
        try:
            for f in fields:
                number = float(f)
        except ValueError:
            continue

        # Append the line in text format
        data_lines.append(line.strip())

    return header_lines, data_lines