PROCEDURE (osm$anapd) analyze_program_dynamics, anapd (
  target_text, tt: file = $required
  restructured_module, rm: file = $required
  file, files, f: list of file = $optional
  parameter, p: string = $optional
  library, libraries, l: list of file = $optional
  module, modules, m: list of program_name = $optional
  starting_procedure, sp: program_name = $optional
  restructured_module_name, rmn: program_name = $optional
  restructuring_commands, rc: file = $optional
  stack_size, ss: integer 1..2147483648 = 2000000
  status)

  MEASURE_PROGRAM_EXECUTION
    sp_parameter=' '
    IF $specified(starting_procedure) THEN
      sp_parameter=' starting_procedure=$string(starting_procedure)'
    IFEND
    m_parameter=' '
    IF $specified(modules) THEN
      m_parameter=' modules=$apply(modules $string(x))'
    IFEND

    include_command '    set_program_description target_text=target_text file=file library=library'//..
' stack_size=stack_size '//sp_parameter//m_parameter

    execute_instrumented_task parameter=parameter

    IF $specified(restructured_module_name) THEN
      create_restructured_module restructured_module=restructured_module ..
            restructured_module_name=$string(restructured_module_name) ..
            restructuring_commands=restructuring_commands
    ELSE
      create_restructured_module restructured_module=restructured_module ..
            restructuring_commands=restructuring_commands
    IFEND

  QUIT

PROCEND analyze_program_dynamics
