def METHOD_NAME():
  """Helper script for upgrading a profraw file to latest version."""
  if len(sys.argv) != 4:
    sys.stderr.write('Usage: %s <binary> <profraw> <output>\n' % sys.argv[0])
    return 1
  # First find llvm profile sections addresses in the elf, quick and dirty.
  process = subprocess.Popen(['readelf', '-S', sys.argv[1]],
                             stdout=subprocess.PIPE)
  output, err = process.communicate()
  if err:
    print('readelf failed')
    return 2
  for line in iter(output.split(b'\n')):
    if b'__llvm_prf_cnts' in line:
      sect_prf_cnts = int(line.split()[3], 16)
    elif b'__llvm_prf_data' in line:
      sect_prf_data = int(line.split()[3], 16)
  # Then open and read the input profraw file.
  with open(sys.argv[2], 'rb') as input_file:
    profraw_base = bytearray(input_file.read())
  # Do the upgrade, returning a bytes object.
  profraw_latest = upgrade(profraw_base, sect_prf_cnts, sect_prf_data)
  # Write the output to the file given to the command line.
  with open(sys.argv[3], 'wb') as output_file:
    output_file.write(profraw_latest)
  return 0