input: def optimize_code(code: str) -> str:
      """Given a Python script as a string, this function optimizes the script by
      restructuring the code for better readability and performance. It returns the
      optimized script as a string.
  
      Example:
      >>> optimize_code('def getResult(a, b, c): return a + b + c')
      "@dataclass\\nclass Params:\\n a: int\\n b: int\\n c: int\\n\\ndef get_result(params: Params) -> int:\\n \\\"\\\"\\\"Returns the sum of the three given numbers\\\"\\\"\\\"\\n return params.a + params.b + params.c\\n"
      """
output:     import ast
      import astor
  
      class CodeOptimizer(ast.NodeTransformer):
          def visit_FunctionDef(self, node):
              # Convert function parameters to a dataclass
              params = [ast.arg(arg=arg.arg, annotation=arg.annotation) for arg in node.args.args]
              dataclass_def = ast.parse("@dataclass\nclass Params:\n    " + "\n    ".join(f"{param.arg}: {'int' if param.annotation is None else astor.to_source(param.annotation).strip()}" for param in params))
              new_func_def = ast.FunctionDef(
                  name=node.name,
                  args=ast.arguments(
                      args=[ast.arg(arg='params', annotation=ast.Name(id='Params', ctx=ast.Load()))],
                      vararg=None,
                      kwonlyargs=[],
                      kw_defaults=[],
                      kwarg=None,
                      defaults=[]
                  ),
                  body=[ast.parse(f"return params.{param.arg}").body[0] for param in params],
                  decorator_list=[],
                  returns=node.returns
              )
              return [dataclass_def.body[0], new_func_def]
  
      tree = ast.parse(code)
      optimizer = CodeOptimizer()
      optimized_tree = optimizer.visit(tree)
      ast.fix_missing_locations(optimized_tree)
      return astor.to_source(optimized_tree)