import re


def convert_c_source_to_bytes(input_cc_file):
  """Converts C++ source file to bytes (immutable).

  Args:
    input_cc_file: A .cc file to process.

  Returns:
    A bytearray corresponding to the input cc file array.
  """
  pattern = re.compile(r'(((0x[0-9a-fA-F]+),?)+)')
  model_bytearray = bytearray()

  with open(input_cc_file) as file_handle:
    for line in file_handle:
      values_match = pattern.search(line)

      if values_match is None:
        continue

      list_text = values_match.group(1)
      values_text = filter(None, list_text.split(','))

      values = [int(x, base=16) for x in values_text]
      model_bytearray.extend(values)

  return bytes(model_bytearray)