'Compile a code object to get its IR.'

def get_ir_of_code(self, fcode):

    glbls = self.func_ir.func_id.func.__globals__
    nfree = len(fcode.co_freevars)
    func_env = '\n'.join([('        c_%d    =    None' % i) for i in range(nfree)])
    func_clo = ','.join([('c_%d' % i) for i in range(nfree)])
    func_arg = ','.join([('x_%d' % i) for i in range(fcode.co_argcount)])
    func_text = ('def    g():\n%s\n        def    f(%s):\n                return    (%s)\n        return    f' % (func_env, func_arg, func_clo))
    loc = {}
    exec func_text in glbls, loc
    if ((utils.PYVERSION >= (3,)) and (utils.PYVERSION < (3, 6))):
        co_varnames = list(fcode.co_varnames)
        if (co_varnames[0] == '.0'):
            co_varnames[0] = 'implicit0'
        fcode = types.CodeType(fcode.co_argcount, fcode.co_kwonlyargcount, fcode.co_nlocals, fcode.co_stacksize, fcode.co_flags, fcode.co_code, fcode.co_consts, fcode.co_names, tuple(co_varnames), fcode.co_filename, fcode.co_name, fcode.co_firstlineno, fcode.co_lnotab, fcode.co_freevars, fcode.co_cellvars)
    f = loc['g']()
    f.__code__ = fcode
    f.__name__ = fcode.co_name
    ir = self.run_frontend(f)
    return ir
