def visit_fn(self, fn):
    if config.print_input_ir:
      print "=== Compiling to C with %s (entry function) ===" % self.__class__.__name__ 
      print fn
    c_fn_name = self.fresh_name(fn.name)
    uses = use_count(fn)
    self.push()
    
    
    dummy = self.fresh_name("dummy")
    args = self.fresh_name("args")
    
    if config.debug: 
      self.newline()
      self.printf("\\nStarting %s : %s..." % (c_fn_name, fn.type))
      
    for i, argname in enumerate(fn.arg_names):
      assert argname in uses, "Couldn't find arg %s in use-counts" % argname
      if uses[argname] <= 1:
        self.comment("Skipping unused argument %s" % argname)
        continue
      self.comment("Unpacking argument %s"  % argname)
      c_name = self.name(argname)
      t = fn.type_env[argname]
      self.comment("Getting arg #%d: %s : %s => %s" % (i+1, argname,  t, c_name) )
      self.append("PyObject* %s = PyTuple_GetItem(%s, %d);" % (c_name, args, i))
      
      self.check_type(c_name, t)
      if config.debug:
        self.printf("Printing arg #%d %s" % (i,c_name))
        self.print_pyobj_type(c_name, text = "Type: ")
        self.print_pyobj(c_name, text = "Value: ")
      
      if isinstance(t, (TupleT, NoneT, PtrT, ClosureT, ScalarT, ArrayT, SliceT)):
        #new_name = self.name(argname, overwrite = True)
        self.comment("Unboxing %s : %s" % (argname, t))
        var = self.unbox(c_name, t, target = argname)

        self.name_mappings[argname] = var
      

    self.enter_module_body()
    c_body = self.visit_block(fn.body, push=False)
    self.exit_module_body()
    c_body = self.indent(c_body )
    c_args = "PyObject* %s, PyObject* %s" % (dummy, args) #", ".join("PyObject* %s" % self.name(n) for n in fn.arg_names)
    c_sig = "PyObject* %(c_fn_name)s (%(c_args)s)" % locals() 
    fndef = "%s {\n\n %s}" % (c_sig, c_body)
    return c_fn_name, c_sig, fndef
dataset/ETHPy150Open iskandr/parakeet/parakeet/c_backend/pymodule_compiler.py/PyModuleCompiler.visit_fn/original