def METHOD_NAME(tyctx, inst):
    sig = return_type(inst)
    def codegen(cgctx, builder, sig, llargs):
        name = overloadable_function.__name__
        struct_ptr = cgutils.create_struct_proxy(inst)(cgctx, builder,
                                                       value=llargs[0])
        # Get the 'state' and 'fnptr_next_(type)' members of the struct
        state = struct_ptr.state
        next_double_addr = getattr(struct_ptr, f'fnptr_{name}')
        # LLVM IR types needed
        ll_void_ptr_t = cgctx.get_value_type(types.voidptr)
        ll_return_t = cgctx.get_value_type(return_type)
        ll_uintp_t = cgctx.get_value_type(types.uintp)
        # Convert the stored Generator function address to a pointer
        next_fn_fnptr = builder.inttoptr(
            next_double_addr, ll_void_ptr_t)
        # Add the function to the module
        fnty = ir.FunctionType(ll_return_t, (ll_uintp_t,))
        next_fn = cgutils.get_or_insert_function(
            builder.module, fnty, name)
        # Bit cast the function pointer to the function type
        fnptr_as_fntype = builder.bitcast(next_fn_fnptr, next_fn.type)
        # call it with the "state" address as the arg
        ret = builder.call(fnptr_as_fntype, (state,))
        return ret
    return sig, codegen