/* valaccodedelegatemodule.c generated by valac, the Vala compiler
 * generated from valaccodedelegatemodule.vala, do not modify */

/* valaccodedelegatemodule.vala
 *
 * Copyright (C) 2006-2010  Jürg Billeter
 * Copyright (C) 2006-2008  Raffaele Sandrini
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 *	Raffaele Sandrini <raffaele@sandrini.ch>
 */

#include "valacodegen.h"
#include <vala.h>
#include <valaccode.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <valagee.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
#define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))

static gpointer vala_ccode_delegate_module_parent_class = NULL;

static void vala_ccode_delegate_module_real_generate_delegate_declaration (ValaCCodeBaseModule* base,
                                                                    ValaDelegate* d,
                                                                    ValaCCodeFile* decl_space);
static void vala_ccode_delegate_module_real_visit_delegate (ValaCodeVisitor* base,
                                                     ValaDelegate* d);
static gchar* vala_ccode_delegate_module_real_get_delegate_target_cname (ValaCCodeBaseModule* base,
                                                                  const gchar* delegate_cname);
static ValaCCodeExpression* vala_ccode_delegate_module_real_get_delegate_target_cexpression (ValaCCodeBaseModule* base,
                                                                                      ValaExpression* delegate_expr,
                                                                                      ValaCCodeExpression** delegate_target_destroy_notify);
static ValaCCodeExpression* vala_ccode_delegate_module_real_get_delegate_target_cvalue (ValaCCodeBaseModule* base,
                                                                                 ValaTargetValue* value);
static ValaCCodeExpression* vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue (ValaCCodeBaseModule* base,
                                                                                                ValaTargetValue* value);
static gchar* vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* base,
                                                                                 const gchar* delegate_cname);
static ValaCCodeExpression* vala_ccode_delegate_module_real_get_implicit_cast_expression (ValaCCodeBaseModule* base,
                                                                                   ValaCCodeExpression* source_cexpr,
                                                                                   ValaDataType* expression_type,
                                                                                   ValaDataType* target_type,
                                                                                   ValaCodeNode* node);
static ValaCCodeParameter* vala_ccode_delegate_module_real_generate_parameter (ValaCCodeMethodModule* base,
                                                                        ValaParameter* param,
                                                                        ValaCCodeFile* decl_space,
                                                                        ValaMap* cparam_map,
                                                                        ValaMap* carg_map);
static GType vala_ccode_delegate_module_get_type_once (void);

static gpointer
_vala_code_node_ref0 (gpointer self)
{
	return self ? vala_code_node_ref (self) : NULL;
}

static void
vala_ccode_delegate_module_real_generate_delegate_declaration (ValaCCodeBaseModule* base,
                                                               ValaDelegate* d,
                                                               ValaCCodeFile* decl_space)
{
	ValaCCodeDelegateModule * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	ValaDataType* _tmp3_;
	ValaDataType* _tmp4_;
	ValaDataType* creturn_type = NULL;
	ValaDataType* _tmp5_;
	gboolean _tmp6_ = FALSE;
	ValaDataType* _tmp7_;
	ValaDataType* _tmp24_;
	ValaHashMap* cparam_map = NULL;
	GHashFunc _tmp25_;
	GEqualFunc _tmp26_;
	GEqualFunc _tmp27_;
	ValaHashMap* _tmp28_;
	ValaCCodeFunctionDeclarator* cfundecl = NULL;
	gchar* _tmp29_;
	gchar* _tmp30_;
	ValaCCodeFunctionDeclarator* _tmp31_;
	ValaCCodeFunctionDeclarator* _tmp32_;
	ValaDataType* _tmp45_;
	ValaDataType* _tmp46_;
	gboolean _tmp114_;
	gboolean _tmp115_;
	gboolean _tmp124_;
	gboolean _tmp125_;
	gint last_pos = 0;
	gint min_pos = 0;
	ValaCCodeTypeDefinition* ctypedef = NULL;
	ValaDataType* _tmp144_;
	gchar* _tmp145_;
	gchar* _tmp146_;
	ValaCCodeFunctionDeclarator* _tmp147_;
	ValaCCodeTypeDefinition* _tmp148_;
	ValaCCodeTypeDefinition* _tmp149_;
	ValaVersionAttribute* _tmp150_;
	ValaVersionAttribute* _tmp151_;
	gboolean _tmp152_;
	gboolean _tmp153_;
	ValaCCodeTypeDefinition* _tmp162_;
	self = (ValaCCodeDelegateModule*) base;
	g_return_if_fail (d != NULL);
	g_return_if_fail (decl_space != NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) d);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_ccode_base_module_add_symbol_declaration ((ValaCCodeBaseModule*) self, decl_space, (ValaSymbol*) d, _tmp1_);
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = vala_delegate_get_sender_type (d);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != NULL) {
		return;
	}
	_tmp5_ = vala_ccode_base_module_get_callable_creturn_type ((ValaCallable*) d);
	creturn_type = _tmp5_;
	_tmp7_ = creturn_type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_DELEGATE_TYPE)) {
		ValaDataType* _tmp8_;
		ValaDelegate* _tmp9_;
		ValaDelegate* _tmp10_;
		_tmp8_ = creturn_type;
		_tmp9_ = vala_delegate_type_get_delegate_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
		_tmp10_ = _tmp9_;
		_tmp6_ = _tmp10_ == d;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		ValaCodeContext* _tmp11_;
		ValaCodeContext* _tmp12_;
		ValaNamespace* _tmp13_;
		ValaNamespace* _tmp14_;
		ValaScope* _tmp15_;
		ValaScope* _tmp16_;
		ValaSymbol* _tmp17_;
		ValaSymbol* _tmp18_;
		ValaScope* _tmp19_;
		ValaScope* _tmp20_;
		ValaSymbol* _tmp21_;
		ValaDelegate* _tmp22_;
		ValaDelegateType* _tmp23_;
		_tmp11_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp12_ = _tmp11_;
		_tmp13_ = vala_code_context_get_root (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = vala_symbol_get_scope ((ValaSymbol*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = vala_scope_lookup (_tmp16_, "GLib");
		_tmp18_ = _tmp17_;
		_tmp19_ = vala_symbol_get_scope (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = vala_scope_lookup (_tmp20_, "Callback");
		_tmp22_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, VALA_TYPE_DELEGATE, ValaDelegate);
		_tmp23_ = vala_delegate_type_new (_tmp22_, NULL);
		_vala_code_node_unref0 (creturn_type);
		creturn_type = (ValaDataType*) _tmp23_;
		_vala_code_node_unref0 (_tmp22_);
		_vala_code_node_unref0 (_tmp18_);
	}
	_tmp24_ = creturn_type;
	vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp24_, decl_space);
	_tmp25_ = g_direct_hash;
	_tmp26_ = g_direct_equal;
	_tmp27_ = g_direct_equal;
	_tmp28_ = vala_hash_map_new (G_TYPE_INT, NULL, NULL, VALA_TYPE_CCODE_PARAMETER, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp25_, _tmp26_, _tmp27_);
	cparam_map = _tmp28_;
	_tmp29_ = vala_get_ccode_name ((ValaCodeNode*) d);
	_tmp30_ = _tmp29_;
	_tmp31_ = vala_ccode_function_declarator_new (_tmp30_);
	_tmp32_ = _tmp31_;
	_g_free0 (_tmp30_);
	cfundecl = _tmp32_;
	{
		ValaList* _param_list = NULL;
		ValaList* _tmp33_;
		gint _param_size = 0;
		ValaList* _tmp34_;
		gint _tmp35_;
		gint _tmp36_;
		gint _param_index = 0;
		_tmp33_ = vala_callable_get_parameters ((ValaCallable*) d);
		_param_list = _tmp33_;
		_tmp34_ = _param_list;
		_tmp35_ = vala_collection_get_size ((ValaCollection*) _tmp34_);
		_tmp36_ = _tmp35_;
		_param_size = _tmp36_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp37_;
			gint _tmp38_;
			ValaParameter* param = NULL;
			ValaList* _tmp39_;
			gpointer _tmp40_;
			ValaParameter* _tmp41_;
			ValaHashMap* _tmp42_;
			ValaCCodeParameter* _tmp43_;
			ValaCCodeParameter* _tmp44_;
			_param_index = _param_index + 1;
			_tmp37_ = _param_index;
			_tmp38_ = _param_size;
			if (!(_tmp37_ < _tmp38_)) {
				break;
			}
			_tmp39_ = _param_list;
			_tmp40_ = vala_list_get (_tmp39_, _param_index);
			param = (ValaParameter*) _tmp40_;
			_tmp41_ = param;
			_tmp42_ = cparam_map;
			_tmp43_ = vala_ccode_method_module_generate_parameter ((ValaCCodeMethodModule*) self, _tmp41_, decl_space, (ValaMap*) _tmp42_, NULL);
			_tmp44_ = _tmp43_;
			_vala_ccode_node_unref0 (_tmp44_);
			_vala_code_node_unref0 (param);
		}
	}
	_tmp45_ = vala_callable_get_return_type ((ValaCallable*) d);
	_tmp46_ = _tmp45_;
	if (vala_data_type_is_real_non_null_struct_type (_tmp46_)) {
		ValaCCodeParameter* cparam = NULL;
		ValaDataType* _tmp47_;
		ValaDataType* _tmp48_;
		gchar* _tmp49_;
		gchar* _tmp50_;
		gchar* _tmp51_;
		gchar* _tmp52_;
		ValaCCodeParameter* _tmp53_;
		ValaCCodeParameter* _tmp54_;
		ValaHashMap* _tmp55_;
		ValaCCodeParameter* _tmp56_;
		_tmp47_ = vala_callable_get_return_type ((ValaCallable*) d);
		_tmp48_ = _tmp47_;
		_tmp49_ = vala_get_ccode_name ((ValaCodeNode*) _tmp48_);
		_tmp50_ = _tmp49_;
		_tmp51_ = g_strconcat (_tmp50_, "*", NULL);
		_tmp52_ = _tmp51_;
		_tmp53_ = vala_ccode_parameter_new ("result", _tmp52_);
		_tmp54_ = _tmp53_;
		_g_free0 (_tmp52_);
		_g_free0 (_tmp50_);
		cparam = _tmp54_;
		_tmp55_ = cparam_map;
		_tmp56_ = cparam;
		vala_map_set ((ValaMap*) _tmp55_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), _tmp56_);
		_vala_ccode_node_unref0 (cparam);
	} else {
		gboolean _tmp57_ = FALSE;
		if (vala_get_ccode_array_length ((ValaCodeNode*) d)) {
			ValaDataType* _tmp58_;
			ValaDataType* _tmp59_;
			_tmp58_ = vala_callable_get_return_type ((ValaCallable*) d);
			_tmp59_ = _tmp58_;
			_tmp57_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp59_, VALA_TYPE_ARRAY_TYPE);
		} else {
			_tmp57_ = FALSE;
		}
		if (_tmp57_) {
			ValaArrayType* array_type = NULL;
			ValaDataType* _tmp60_;
			ValaDataType* _tmp61_;
			ValaArrayType* _tmp62_;
			gchar* length_ctype = NULL;
			gchar* _tmp63_;
			gchar* _tmp64_;
			gchar* _tmp65_;
			gchar* _tmp66_;
			_tmp60_ = vala_callable_get_return_type ((ValaCallable*) d);
			_tmp61_ = _tmp60_;
			_tmp62_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp61_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
			array_type = _tmp62_;
			_tmp63_ = vala_get_ccode_array_length_type ((ValaCodeNode*) d);
			_tmp64_ = _tmp63_;
			_tmp65_ = g_strconcat (_tmp64_, "*", NULL);
			_tmp66_ = _tmp65_;
			_g_free0 (_tmp64_);
			length_ctype = _tmp66_;
			{
				gint dim = 0;
				dim = 1;
				{
					gboolean _tmp67_ = FALSE;
					_tmp67_ = TRUE;
					while (TRUE) {
						ValaArrayType* _tmp69_;
						gint _tmp70_;
						gint _tmp71_;
						ValaCCodeParameter* cparam = NULL;
						gchar* _tmp72_;
						gchar* _tmp73_;
						const gchar* _tmp74_;
						ValaCCodeParameter* _tmp75_;
						ValaCCodeParameter* _tmp76_;
						ValaHashMap* _tmp77_;
						ValaCCodeParameter* _tmp78_;
						if (!_tmp67_) {
							gint _tmp68_;
							_tmp68_ = dim;
							dim = _tmp68_ + 1;
						}
						_tmp67_ = FALSE;
						_tmp69_ = array_type;
						_tmp70_ = vala_array_type_get_rank (_tmp69_);
						_tmp71_ = _tmp70_;
						if (!(dim <= _tmp71_)) {
							break;
						}
						_tmp72_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
						_tmp73_ = _tmp72_;
						_tmp74_ = length_ctype;
						_tmp75_ = vala_ccode_parameter_new (_tmp73_, _tmp74_);
						_tmp76_ = _tmp75_;
						_g_free0 (_tmp73_);
						cparam = _tmp76_;
						_tmp77_ = cparam_map;
						_tmp78_ = cparam;
						vala_map_set ((ValaMap*) _tmp77_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) d) + (0.01 * dim), FALSE)), _tmp78_);
						_vala_ccode_node_unref0 (cparam);
					}
				}
			}
			_g_free0 (length_ctype);
			_vala_code_node_unref0 (array_type);
		} else {
			gboolean _tmp79_ = FALSE;
			if (vala_get_ccode_delegate_target ((ValaCodeNode*) d)) {
				ValaDataType* _tmp80_;
				ValaDataType* _tmp81_;
				_tmp80_ = vala_callable_get_return_type ((ValaCallable*) d);
				_tmp81_ = _tmp80_;
				_tmp79_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp81_, VALA_TYPE_DELEGATE_TYPE);
			} else {
				_tmp79_ = FALSE;
			}
			if (_tmp79_) {
				ValaDelegateType* deleg_type = NULL;
				ValaDataType* _tmp82_;
				ValaDataType* _tmp83_;
				ValaDelegateType* _tmp84_;
				ValaDelegateType* _tmp85_;
				ValaDelegate* _tmp86_;
				ValaDelegate* _tmp87_;
				gboolean _tmp88_;
				gboolean _tmp89_;
				_tmp82_ = vala_callable_get_return_type ((ValaCallable*) d);
				_tmp83_ = _tmp82_;
				_tmp84_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp83_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
				deleg_type = _tmp84_;
				_tmp85_ = deleg_type;
				_tmp86_ = vala_delegate_type_get_delegate_symbol (_tmp85_);
				_tmp87_ = _tmp86_;
				_tmp88_ = vala_delegate_get_has_target (_tmp87_);
				_tmp89_ = _tmp88_;
				if (_tmp89_) {
					ValaDataType* _tmp90_;
					ValaCCodeParameter* cparam = NULL;
					gchar* _tmp91_;
					gchar* _tmp92_;
					ValaDataType* _tmp93_;
					gchar* _tmp94_;
					gchar* _tmp95_;
					gchar* _tmp96_;
					gchar* _tmp97_;
					ValaCCodeParameter* _tmp98_;
					ValaCCodeParameter* _tmp99_;
					ValaHashMap* _tmp100_;
					ValaCCodeParameter* _tmp101_;
					ValaDelegateType* _tmp102_;
					_tmp90_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
					vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp90_, decl_space);
					_tmp91_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
					_tmp92_ = _tmp91_;
					_tmp93_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
					_tmp94_ = vala_get_ccode_name ((ValaCodeNode*) _tmp93_);
					_tmp95_ = _tmp94_;
					_tmp96_ = g_strconcat (_tmp95_, "*", NULL);
					_tmp97_ = _tmp96_;
					_tmp98_ = vala_ccode_parameter_new (_tmp92_, _tmp97_);
					_tmp99_ = _tmp98_;
					_g_free0 (_tmp97_);
					_g_free0 (_tmp95_);
					_g_free0 (_tmp92_);
					cparam = _tmp99_;
					_tmp100_ = cparam_map;
					_tmp101_ = cparam;
					vala_map_set ((ValaMap*) _tmp100_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) d), FALSE)), _tmp101_);
					_tmp102_ = deleg_type;
					if (vala_data_type_is_disposable ((ValaDataType*) _tmp102_)) {
						ValaDelegateType* _tmp103_;
						gchar* _tmp104_;
						gchar* _tmp105_;
						ValaDelegateType* _tmp106_;
						gchar* _tmp107_;
						gchar* _tmp108_;
						gchar* _tmp109_;
						gchar* _tmp110_;
						ValaCCodeParameter* _tmp111_;
						ValaHashMap* _tmp112_;
						ValaCCodeParameter* _tmp113_;
						_tmp103_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
						vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, (ValaDataType*) _tmp103_, decl_space);
						_tmp104_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
						_tmp105_ = _tmp104_;
						_tmp106_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
						_tmp107_ = vala_get_ccode_name ((ValaCodeNode*) _tmp106_);
						_tmp108_ = _tmp107_;
						_tmp109_ = g_strconcat (_tmp108_, "*", NULL);
						_tmp110_ = _tmp109_;
						_tmp111_ = vala_ccode_parameter_new (_tmp105_, _tmp110_);
						_vala_ccode_node_unref0 (cparam);
						cparam = _tmp111_;
						_g_free0 (_tmp110_);
						_g_free0 (_tmp108_);
						_g_free0 (_tmp105_);
						_tmp112_ = cparam_map;
						_tmp113_ = cparam;
						vala_map_set ((ValaMap*) _tmp112_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) d), FALSE)), _tmp113_);
					}
					_vala_ccode_node_unref0 (cparam);
				}
				_vala_code_node_unref0 (deleg_type);
			}
		}
	}
	_tmp114_ = vala_delegate_get_has_target (d);
	_tmp115_ = _tmp114_;
	if (_tmp115_) {
		ValaDataType* _tmp116_;
		ValaCCodeParameter* cparam = NULL;
		ValaDataType* _tmp117_;
		gchar* _tmp118_;
		gchar* _tmp119_;
		ValaCCodeParameter* _tmp120_;
		ValaCCodeParameter* _tmp121_;
		ValaHashMap* _tmp122_;
		ValaCCodeParameter* _tmp123_;
		_tmp116_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
		vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp116_, decl_space);
		_tmp117_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
		_tmp118_ = vala_get_ccode_name ((ValaCodeNode*) _tmp117_);
		_tmp119_ = _tmp118_;
		_tmp120_ = vala_ccode_parameter_new ("user_data", _tmp119_);
		_tmp121_ = _tmp120_;
		_g_free0 (_tmp119_);
		cparam = _tmp121_;
		_tmp122_ = cparam_map;
		_tmp123_ = cparam;
		vala_map_set ((ValaMap*) _tmp122_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_instance_pos ((ValaCodeNode*) d), FALSE)), _tmp123_);
		_vala_ccode_node_unref0 (cparam);
	}
	_tmp124_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) d);
	_tmp125_ = _tmp124_;
	if (_tmp125_) {
		ValaErrorType* _tmp126_;
		ValaCCodeParameter* cparam = NULL;
		ValaCCodeParameter* _tmp127_;
		ValaHashMap* _tmp128_;
		ValaCCodeParameter* _tmp129_;
		_tmp126_ = ((ValaCCodeBaseModule*) self)->gerror_type;
		vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, (ValaDataType*) _tmp126_, decl_space);
		_tmp127_ = vala_ccode_parameter_new ("error", "GError**");
		cparam = _tmp127_;
		_tmp128_ = cparam_map;
		_tmp129_ = cparam;
		vala_map_set ((ValaMap*) _tmp128_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) d), FALSE)), _tmp129_);
		_vala_ccode_node_unref0 (cparam);
	}
	last_pos = -1;
	while (TRUE) {
		ValaCCodeFunctionDeclarator* _tmp140_;
		ValaHashMap* _tmp141_;
		gpointer _tmp142_;
		ValaCCodeParameter* _tmp143_;
		min_pos = -1;
		{
			ValaIterator* _pos_it = NULL;
			ValaHashMap* _tmp130_;
			ValaSet* _tmp131_;
			ValaSet* _tmp132_;
			ValaIterator* _tmp133_;
			ValaIterator* _tmp134_;
			_tmp130_ = cparam_map;
			_tmp131_ = vala_map_get_keys ((ValaMap*) _tmp130_);
			_tmp132_ = _tmp131_;
			_tmp133_ = vala_iterable_iterator ((ValaIterable*) _tmp132_);
			_tmp134_ = _tmp133_;
			_vala_iterable_unref0 (_tmp132_);
			_pos_it = _tmp134_;
			while (TRUE) {
				ValaIterator* _tmp135_;
				gint pos = 0;
				ValaIterator* _tmp136_;
				gpointer _tmp137_;
				gboolean _tmp138_ = FALSE;
				_tmp135_ = _pos_it;
				if (!vala_iterator_next (_tmp135_)) {
					break;
				}
				_tmp136_ = _pos_it;
				_tmp137_ = vala_iterator_get (_tmp136_);
				pos = (gint) ((gintptr) _tmp137_);
				if (pos > last_pos) {
					gboolean _tmp139_ = FALSE;
					if (min_pos == -1) {
						_tmp139_ = TRUE;
					} else {
						_tmp139_ = pos < min_pos;
					}
					_tmp138_ = _tmp139_;
				} else {
					_tmp138_ = FALSE;
				}
				if (_tmp138_) {
					min_pos = pos;
				}
			}
			_vala_iterator_unref0 (_pos_it);
		}
		if (min_pos == -1) {
			break;
		}
		_tmp140_ = cfundecl;
		_tmp141_ = cparam_map;
		_tmp142_ = vala_map_get ((ValaMap*) _tmp141_, (gpointer) ((gintptr) min_pos));
		_tmp143_ = (ValaCCodeParameter*) _tmp142_;
		vala_ccode_function_declarator_add_parameter (_tmp140_, _tmp143_);
		_vala_ccode_node_unref0 (_tmp143_);
		last_pos = min_pos;
	}
	_tmp144_ = creturn_type;
	_tmp145_ = vala_get_ccode_name ((ValaCodeNode*) _tmp144_);
	_tmp146_ = _tmp145_;
	_tmp147_ = cfundecl;
	_tmp148_ = vala_ccode_type_definition_new (_tmp146_, (ValaCCodeDeclarator*) _tmp147_);
	_tmp149_ = _tmp148_;
	_g_free0 (_tmp146_);
	ctypedef = _tmp149_;
	_tmp150_ = vala_symbol_get_version ((ValaSymbol*) d);
	_tmp151_ = _tmp150_;
	_tmp152_ = vala_version_attribute_get_deprecated (_tmp151_);
	_tmp153_ = _tmp152_;
	if (_tmp153_) {
		ValaCodeContext* _tmp154_;
		ValaCodeContext* _tmp155_;
		ValaProfile _tmp156_;
		ValaProfile _tmp157_;
		ValaCCodeTypeDefinition* _tmp158_;
		ValaCCodeTypeDefinition* _tmp159_;
		ValaCCodeModifiers _tmp160_;
		ValaCCodeModifiers _tmp161_;
		_tmp154_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp155_ = _tmp154_;
		_tmp156_ = vala_code_context_get_profile (_tmp155_);
		_tmp157_ = _tmp156_;
		if (_tmp157_ == VALA_PROFILE_GOBJECT) {
			vala_ccode_file_add_include (decl_space, "glib.h", FALSE);
		}
		_tmp158_ = ctypedef;
		_tmp159_ = ctypedef;
		_tmp160_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) _tmp159_);
		_tmp161_ = _tmp160_;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp159_, _tmp161_ | VALA_CCODE_MODIFIERS_DEPRECATED);
	}
	_tmp162_ = ctypedef;
	vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp162_);
	_vala_ccode_node_unref0 (ctypedef);
	_vala_ccode_node_unref0 (cfundecl);
	_vala_map_unref0 (cparam_map);
	_vala_code_node_unref0 (creturn_type);
}

static void
vala_ccode_delegate_module_real_visit_delegate (ValaCodeVisitor* base,
                                                ValaDelegate* d)
{
	ValaCCodeDelegateModule * self;
	ValaCCodeFile* _tmp0_;
	self = (ValaCCodeDelegateModule*) base;
	g_return_if_fail (d != NULL);
	_tmp0_ = ((ValaCCodeBaseModule*) self)->cfile;
	vala_ccode_base_module_generate_delegate_declaration ((ValaCCodeBaseModule*) self, d, _tmp0_);
	if (!vala_symbol_is_internal_symbol ((ValaSymbol*) d)) {
		ValaCCodeFile* _tmp1_;
		_tmp1_ = ((ValaCCodeBaseModule*) self)->header_file;
		vala_ccode_base_module_generate_delegate_declaration ((ValaCCodeBaseModule*) self, d, _tmp1_);
	}
	if (!vala_symbol_is_private_symbol ((ValaSymbol*) d)) {
		ValaCCodeFile* _tmp2_;
		_tmp2_ = ((ValaCCodeBaseModule*) self)->internal_header_file;
		vala_ccode_base_module_generate_delegate_declaration ((ValaCCodeBaseModule*) self, d, _tmp2_);
	}
	vala_code_node_accept_children ((ValaCodeNode*) d, (ValaCodeVisitor*) self);
}

static gchar*
vala_ccode_delegate_module_real_get_delegate_target_cname (ValaCCodeBaseModule* base,
                                                           const gchar* delegate_cname)
{
	ValaCCodeDelegateModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (delegate_cname != NULL, NULL);
	_tmp0_ = g_strdup_printf ("%s_target", delegate_cname);
	result = _tmp0_;
	return result;
}

static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_delegate_target_cexpression (ValaCCodeBaseModule* base,
                                                                 ValaExpression* delegate_expr,
                                                                 ValaCCodeExpression** delegate_target_destroy_notify)
{
	ValaCCodeDelegateModule * self;
	ValaCCodeExpression* _vala_delegate_target_destroy_notify = NULL;
	ValaTargetValue* _tmp0_;
	ValaTargetValue* _tmp1_;
	ValaCCodeExpression* _tmp2_;
	ValaTargetValue* _tmp3_;
	ValaTargetValue* _tmp4_;
	ValaCCodeExpression* _tmp5_;
	ValaCCodeExpression* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (delegate_expr != NULL, NULL);
	_tmp0_ = vala_expression_get_target_value (delegate_expr);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cvalue ((ValaCCodeBaseModule*) self, _tmp1_);
	_vala_ccode_node_unref0 (_vala_delegate_target_destroy_notify);
	_vala_delegate_target_destroy_notify = _tmp2_;
	_tmp3_ = vala_expression_get_target_value (delegate_expr);
	_tmp4_ = _tmp3_;
	_tmp5_ = vala_ccode_base_module_get_delegate_target_cvalue ((ValaCCodeBaseModule*) self, _tmp4_);
	result = _tmp5_;
	if (delegate_target_destroy_notify) {
		*delegate_target_destroy_notify = _vala_delegate_target_destroy_notify;
	} else {
		_vala_ccode_node_unref0 (_vala_delegate_target_destroy_notify);
	}
	return result;
}

static gpointer
_vala_ccode_node_ref0 (gpointer self)
{
	return self ? vala_ccode_node_ref (self) : NULL;
}

static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_delegate_target_cvalue (ValaCCodeBaseModule* base,
                                                            ValaTargetValue* value)
{
	ValaCCodeDelegateModule * self;
	ValaCCodeExpression* _tmp0_;
	ValaCCodeExpression* _tmp1_;
	ValaCCodeExpression* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (value, VALA_TYPE_GLIB_VALUE, ValaGLibValue)->delegate_target_cvalue;
	_tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue (ValaCCodeBaseModule* base,
                                                                           ValaTargetValue* value)
{
	ValaCCodeDelegateModule * self;
	ValaCCodeExpression* _tmp0_;
	ValaCCodeExpression* _tmp1_;
	ValaCCodeExpression* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (value, VALA_TYPE_GLIB_VALUE, ValaGLibValue)->delegate_target_destroy_notify_cvalue;
	_tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* base,
                                                                          const gchar* delegate_cname)
{
	ValaCCodeDelegateModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (delegate_cname != NULL, NULL);
	_tmp0_ = g_strdup_printf ("%s_target_destroy_notify", delegate_cname);
	result = _tmp0_;
	return result;
}

static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_implicit_cast_expression (ValaCCodeBaseModule* base,
                                                              ValaCCodeExpression* source_cexpr,
                                                              ValaDataType* expression_type,
                                                              ValaDataType* target_type,
                                                              ValaCodeNode* node)
{
	ValaCCodeDelegateModule * self;
	gboolean _tmp0_ = FALSE;
	ValaCCodeExpression* _tmp30_;
	ValaCCodeExpression* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (source_cexpr != NULL, NULL);
	if (G_TYPE_CHECK_INSTANCE_TYPE (target_type, VALA_TYPE_DELEGATE_TYPE)) {
		_tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (expression_type, VALA_TYPE_METHOD_TYPE);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ValaDelegateType* dt = NULL;
		ValaDelegateType* _tmp1_;
		ValaMethodType* mt = NULL;
		ValaMethodType* _tmp2_;
		ValaMethod* method = NULL;
		ValaMethodType* _tmp3_;
		ValaMethod* _tmp4_;
		ValaMethod* _tmp5_;
		ValaMethod* _tmp6_;
		ValaMethod* _tmp7_;
		ValaMethod* _tmp8_;
		ValaMethod* _tmp9_;
		ValaMethod* _tmp21_;
		_tmp1_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (target_type, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
		dt = _tmp1_;
		_tmp2_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (expression_type, VALA_TYPE_METHOD_TYPE, ValaMethodType));
		mt = _tmp2_;
		_tmp3_ = mt;
		_tmp4_ = vala_method_type_get_method_symbol (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _vala_code_node_ref0 (_tmp5_);
		method = _tmp6_;
		_tmp7_ = method;
		_tmp8_ = vala_method_get_base_method (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_ != NULL) {
			ValaMethod* _tmp10_;
			ValaMethod* _tmp11_;
			ValaMethod* _tmp12_;
			ValaMethod* _tmp13_;
			_tmp10_ = method;
			_tmp11_ = vala_method_get_base_method (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _vala_code_node_ref0 (_tmp12_);
			_vala_code_node_unref0 (method);
			method = _tmp13_;
		} else {
			ValaMethod* _tmp14_;
			ValaMethod* _tmp15_;
			ValaMethod* _tmp16_;
			_tmp14_ = method;
			_tmp15_ = vala_method_get_base_interface_method (_tmp14_);
			_tmp16_ = _tmp15_;
			if (_tmp16_ != NULL) {
				ValaMethod* _tmp17_;
				ValaMethod* _tmp18_;
				ValaMethod* _tmp19_;
				ValaMethod* _tmp20_;
				_tmp17_ = method;
				_tmp18_ = vala_method_get_base_interface_method (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = _vala_code_node_ref0 (_tmp19_);
				_vala_code_node_unref0 (method);
				method = _tmp20_;
			}
		}
		_tmp21_ = method;
		if (vala_method_is_variadic (_tmp21_)) {
			ValaSourceReference* _tmp22_;
			ValaSourceReference* _tmp23_;
			_tmp22_ = vala_code_node_get_source_reference (node);
			_tmp23_ = _tmp22_;
			vala_report_warning (_tmp23_, "internal: Variadic method requires a direct cast to delegate");
		} else {
			ValaMethod* _tmp24_;
			ValaDelegateType* _tmp25_;
			gchar* _tmp26_;
			gchar* _tmp27_;
			ValaCCodeIdentifier* _tmp28_;
			ValaCCodeExpression* _tmp29_;
			_tmp24_ = method;
			_tmp25_ = dt;
			_tmp26_ = vala_ccode_delegate_module_generate_delegate_wrapper (self, _tmp24_, _tmp25_, node);
			_tmp27_ = _tmp26_;
			_tmp28_ = vala_ccode_identifier_new (_tmp27_);
			_tmp29_ = (ValaCCodeExpression*) _tmp28_;
			_g_free0 (_tmp27_);
			result = _tmp29_;
			_vala_code_node_unref0 (method);
			_vala_code_node_unref0 (mt);
			_vala_code_node_unref0 (dt);
			return result;
		}
		_vala_code_node_unref0 (method);
		_vala_code_node_unref0 (mt);
		_vala_code_node_unref0 (dt);
	}
	_tmp30_ = VALA_CCODE_BASE_MODULE_CLASS (vala_ccode_delegate_module_parent_class)->get_implicit_cast_expression ((ValaCCodeBaseModule*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_CCODE_ARRAY_MODULE, ValaCCodeArrayModule), source_cexpr, expression_type, target_type, node);
	result = _tmp30_;
	return result;
}

static gpointer
_vala_iterable_ref0 (gpointer self)
{
	return self ? vala_iterable_ref (self) : NULL;
}

gchar*
vala_ccode_delegate_module_generate_delegate_wrapper (ValaCCodeDelegateModule* self,
                                                      ValaMethod* m,
                                                      ValaDelegateType* dt,
                                                      ValaCodeNode* node)
{
	ValaDelegate* d = NULL;
	ValaDelegate* _tmp0_;
	ValaDelegate* _tmp1_;
	ValaDelegate* _tmp2_;
	gchar* delegate_name = NULL;
	ValaSignal* sig = NULL;
	ValaDelegate* _tmp3_;
	ValaSymbol* _tmp4_;
	ValaSymbol* _tmp5_;
	ValaSignal* _tmp6_;
	ValaDynamicSignal* dynamic_sig = NULL;
	ValaSignal* _tmp7_;
	ValaDynamicSignal* _tmp8_;
	ValaDynamicSignal* _tmp9_;
	gchar* wrapper_name = NULL;
	gchar* _tmp26_;
	gchar* _tmp27_;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	const gchar* _tmp31_;
	ValaDataType* creturn_type = NULL;
	ValaDelegate* _tmp32_;
	ValaDataType* _tmp33_;
	ValaCCodeFunction* function = NULL;
	const gchar* _tmp34_;
	ValaDataType* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	ValaCCodeFunction* _tmp38_;
	ValaCCodeFunction* _tmp39_;
	ValaCCodeFunction* _tmp40_;
	ValaCCodeFunction* _tmp41_;
	ValaHashMap* cparam_map = NULL;
	GHashFunc _tmp42_;
	GEqualFunc _tmp43_;
	GEqualFunc _tmp44_;
	ValaHashMap* _tmp45_;
	ValaDelegate* _tmp46_;
	gboolean _tmp47_;
	gboolean _tmp48_;
	ValaDelegate* _tmp57_;
	ValaDataType* _tmp58_;
	ValaDataType* _tmp59_;
	ValaList* d_params = NULL;
	ValaDelegate* _tmp69_;
	ValaList* _tmp70_;
	ValaList* _tmp71_;
	gboolean _tmp103_ = FALSE;
	ValaDelegate* _tmp104_;
	gboolean _tmp182_;
	gboolean _tmp183_;
	gint last_pos = 0;
	gint min_pos = 0;
	ValaHashMap* carg_map = NULL;
	GHashFunc _tmp202_;
	GEqualFunc _tmp203_;
	GEqualFunc _tmp204_;
	ValaHashMap* _tmp205_;
	gint i = 0;
	gboolean _tmp206_ = FALSE;
	ValaMemberBinding _tmp207_;
	ValaMemberBinding _tmp208_;
	gboolean first = FALSE;
	gboolean _tmp369_ = FALSE;
	gboolean _tmp416_;
	gboolean _tmp417_;
	ValaCCodeFunctionCall* ccall = NULL;
	gchar* _tmp421_;
	gchar* _tmp422_;
	ValaCCodeIdentifier* _tmp423_;
	ValaCCodeIdentifier* _tmp424_;
	ValaCCodeFunctionCall* _tmp425_;
	ValaCCodeFunctionCall* _tmp426_;
	gboolean _tmp441_;
	gboolean _tmp442_;
	gboolean _tmp449_ = FALSE;
	ValaDataType* _tmp450_;
	ValaDataType* _tmp451_;
	gboolean _tmp493_ = FALSE;
	ValaDelegate* _tmp494_;
	gboolean _tmp495_;
	gboolean _tmp496_;
	gboolean _tmp534_ = FALSE;
	gboolean _tmp535_ = FALSE;
	ValaDataType* _tmp536_;
	ValaDataType* _tmp537_;
	ValaCCodeFile* _tmp551_;
	ValaCCodeFunction* _tmp552_;
	ValaCCodeFile* _tmp553_;
	ValaCCodeFunction* _tmp554_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	g_return_val_if_fail (dt != NULL, NULL);
	_tmp0_ = vala_delegate_type_get_delegate_symbol (dt);
	_tmp1_ = _tmp0_;
	_tmp2_ = _vala_code_node_ref0 (_tmp1_);
	d = _tmp2_;
	_tmp3_ = d;
	_tmp4_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, VALA_TYPE_SIGNAL) ? ((ValaSignal*) _tmp5_) : NULL);
	sig = _tmp6_;
	_tmp7_ = sig;
	_tmp8_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_DYNAMIC_SIGNAL) ? ((ValaDynamicSignal*) _tmp7_) : NULL);
	dynamic_sig = _tmp8_;
	_tmp9_ = dynamic_sig;
	if (_tmp9_ != NULL) {
		ValaDynamicSignal* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = dynamic_sig;
		_tmp11_ = vala_ccode_base_module_get_dynamic_signal_cname ((ValaCCodeBaseModule*) self, _tmp10_);
		_g_free0 (delegate_name);
		delegate_name = _tmp11_;
	} else {
		ValaSignal* _tmp12_;
		_tmp12_ = sig;
		if (_tmp12_ != NULL) {
			ValaSignal* _tmp13_;
			ValaSymbol* _tmp14_;
			ValaSymbol* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			ValaSignal* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			_tmp13_ = sig;
			_tmp14_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = vala_get_ccode_lower_case_prefix (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = sig;
			_tmp19_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp18_, NULL);
			_tmp20_ = _tmp19_;
			_tmp21_ = g_strconcat (_tmp17_, _tmp20_, NULL);
			_g_free0 (delegate_name);
			delegate_name = _tmp21_;
			_g_free0 (_tmp20_);
			_g_free0 (_tmp17_);
		} else {
			ValaDelegate* _tmp22_;
			gchar* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			_tmp22_ = d;
			_tmp23_ = vala_get_ccode_name ((ValaCodeNode*) _tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = vala_symbol_camel_case_to_lower_case (_tmp24_);
			_g_free0 (delegate_name);
			delegate_name = _tmp25_;
			_g_free0 (_tmp24_);
		}
	}
	_tmp26_ = vala_get_ccode_name ((ValaCodeNode*) m);
	_tmp27_ = _tmp26_;
	_tmp28_ = delegate_name;
	_tmp29_ = g_strdup_printf ("_%s_%s", _tmp27_, _tmp28_);
	_tmp30_ = _tmp29_;
	_g_free0 (_tmp27_);
	wrapper_name = _tmp30_;
	_tmp31_ = wrapper_name;
	if (!vala_ccode_base_module_add_wrapper ((ValaCCodeBaseModule*) self, _tmp31_)) {
		result = wrapper_name;
		_vala_code_node_unref0 (dynamic_sig);
		_vala_code_node_unref0 (sig);
		_g_free0 (delegate_name);
		_vala_code_node_unref0 (d);
		return result;
	}
	_tmp32_ = d;
	_tmp33_ = vala_ccode_base_module_get_callable_creturn_type ((ValaCallable*) _tmp32_);
	creturn_type = _tmp33_;
	_tmp34_ = wrapper_name;
	_tmp35_ = creturn_type;
	_tmp36_ = vala_get_ccode_name ((ValaCodeNode*) _tmp35_);
	_tmp37_ = _tmp36_;
	_tmp38_ = vala_ccode_function_new (_tmp34_, _tmp37_);
	_tmp39_ = _tmp38_;
	_g_free0 (_tmp37_);
	function = _tmp39_;
	_tmp40_ = function;
	vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp40_, VALA_CCODE_MODIFIERS_STATIC);
	_tmp41_ = function;
	vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, _tmp41_);
	_tmp42_ = g_direct_hash;
	_tmp43_ = g_direct_equal;
	_tmp44_ = g_direct_equal;
	_tmp45_ = vala_hash_map_new (G_TYPE_INT, NULL, NULL, VALA_TYPE_CCODE_PARAMETER, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp42_, _tmp43_, _tmp44_);
	cparam_map = _tmp45_;
	_tmp46_ = d;
	_tmp47_ = vala_delegate_get_has_target (_tmp46_);
	_tmp48_ = _tmp47_;
	if (_tmp48_) {
		ValaCCodeParameter* cparam = NULL;
		ValaDataType* _tmp49_;
		gchar* _tmp50_;
		gchar* _tmp51_;
		ValaCCodeParameter* _tmp52_;
		ValaCCodeParameter* _tmp53_;
		ValaHashMap* _tmp54_;
		ValaDelegate* _tmp55_;
		ValaCCodeParameter* _tmp56_;
		_tmp49_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
		_tmp50_ = vala_get_ccode_name ((ValaCodeNode*) _tmp49_);
		_tmp51_ = _tmp50_;
		_tmp52_ = vala_ccode_parameter_new ("self", _tmp51_);
		_tmp53_ = _tmp52_;
		_g_free0 (_tmp51_);
		cparam = _tmp53_;
		_tmp54_ = cparam_map;
		_tmp55_ = d;
		_tmp56_ = cparam;
		vala_map_set ((ValaMap*) _tmp54_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_instance_pos ((ValaCodeNode*) _tmp55_), FALSE)), _tmp56_);
		_vala_ccode_node_unref0 (cparam);
	}
	_tmp57_ = d;
	_tmp58_ = vala_delegate_get_sender_type (_tmp57_);
	_tmp59_ = _tmp58_;
	if (_tmp59_ != NULL) {
		ValaParameter* param = NULL;
		ValaDelegate* _tmp60_;
		ValaDataType* _tmp61_;
		ValaDataType* _tmp62_;
		ValaParameter* _tmp63_;
		ValaParameter* _tmp64_;
		ValaCCodeFile* _tmp65_;
		ValaHashMap* _tmp66_;
		ValaCCodeParameter* _tmp67_;
		ValaCCodeParameter* _tmp68_;
		_tmp60_ = d;
		_tmp61_ = vala_delegate_get_sender_type (_tmp60_);
		_tmp62_ = _tmp61_;
		_tmp63_ = vala_parameter_new ("_sender", _tmp62_, NULL);
		param = _tmp63_;
		_tmp64_ = param;
		_tmp65_ = ((ValaCCodeBaseModule*) self)->cfile;
		_tmp66_ = cparam_map;
		_tmp67_ = vala_ccode_method_module_generate_parameter ((ValaCCodeMethodModule*) self, _tmp64_, _tmp65_, (ValaMap*) _tmp66_, NULL);
		_tmp68_ = _tmp67_;
		_vala_ccode_node_unref0 (_tmp68_);
		_vala_code_node_unref0 (param);
	}
	_tmp69_ = d;
	_tmp70_ = vala_callable_get_parameters ((ValaCallable*) _tmp69_);
	_tmp71_ = _vala_iterable_ref0 (_tmp70_);
	d_params = _tmp71_;
	{
		ValaList* _param_list = NULL;
		ValaList* _tmp72_;
		gint _param_size = 0;
		ValaList* _tmp73_;
		gint _tmp74_;
		gint _tmp75_;
		gint _param_index = 0;
		_tmp72_ = d_params;
		_param_list = _tmp72_;
		_tmp73_ = _param_list;
		_tmp74_ = vala_collection_get_size ((ValaCollection*) _tmp73_);
		_tmp75_ = _tmp74_;
		_param_size = _tmp75_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp76_;
			gint _tmp77_;
			ValaParameter* param = NULL;
			ValaList* _tmp78_;
			gpointer _tmp79_;
			gboolean _tmp80_ = FALSE;
			gboolean _tmp81_ = FALSE;
			ValaDynamicSignal* _tmp82_;
			ValaParameter* _tmp98_;
			ValaCCodeFile* _tmp99_;
			ValaHashMap* _tmp100_;
			ValaCCodeParameter* _tmp101_;
			ValaCCodeParameter* _tmp102_;
			_param_index = _param_index + 1;
			_tmp76_ = _param_index;
			_tmp77_ = _param_size;
			if (!(_tmp76_ < _tmp77_)) {
				break;
			}
			_tmp78_ = _param_list;
			_tmp79_ = vala_list_get (_tmp78_, _param_index);
			param = (ValaParameter*) _tmp79_;
			_tmp82_ = dynamic_sig;
			if (_tmp82_ != NULL) {
				ValaParameter* _tmp83_;
				ValaDataType* _tmp84_;
				ValaDataType* _tmp85_;
				_tmp83_ = param;
				_tmp84_ = vala_variable_get_variable_type ((ValaVariable*) _tmp83_);
				_tmp85_ = _tmp84_;
				_tmp81_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp85_, VALA_TYPE_ARRAY_TYPE);
			} else {
				_tmp81_ = FALSE;
			}
			if (_tmp81_) {
				ValaParameter* _tmp86_;
				ValaDataType* _tmp87_;
				ValaDataType* _tmp88_;
				ValaDataType* _tmp89_;
				ValaDataType* _tmp90_;
				ValaTypeSymbol* _tmp91_;
				ValaTypeSymbol* _tmp92_;
				ValaDataType* _tmp93_;
				ValaTypeSymbol* _tmp94_;
				ValaTypeSymbol* _tmp95_;
				_tmp86_ = param;
				_tmp87_ = vala_variable_get_variable_type ((ValaVariable*) _tmp86_);
				_tmp88_ = _tmp87_;
				_tmp89_ = vala_array_type_get_element_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp88_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
				_tmp90_ = _tmp89_;
				_tmp91_ = vala_data_type_get_type_symbol (_tmp90_);
				_tmp92_ = _tmp91_;
				_tmp93_ = ((ValaCCodeBaseModule*) self)->string_type;
				_tmp94_ = vala_data_type_get_type_symbol (_tmp93_);
				_tmp95_ = _tmp94_;
				_tmp80_ = _tmp92_ == _tmp95_;
			} else {
				_tmp80_ = FALSE;
			}
			if (_tmp80_) {
				ValaParameter* _tmp96_;
				ValaParameter* _tmp97_;
				_tmp96_ = param;
				vala_code_node_set_attribute_bool ((ValaCodeNode*) _tmp96_, "CCode", "array_length", FALSE, NULL);
				_tmp97_ = param;
				vala_code_node_set_attribute_bool ((ValaCodeNode*) _tmp97_, "CCode", "array_null_terminated", TRUE, NULL);
			}
			_tmp98_ = param;
			_tmp99_ = ((ValaCCodeBaseModule*) self)->cfile;
			_tmp100_ = cparam_map;
			_tmp101_ = vala_ccode_method_module_generate_parameter ((ValaCCodeMethodModule*) self, _tmp98_, _tmp99_, (ValaMap*) _tmp100_, NULL);
			_tmp102_ = _tmp101_;
			_vala_ccode_node_unref0 (_tmp102_);
			_vala_code_node_unref0 (param);
		}
	}
	_tmp104_ = d;
	if (vala_get_ccode_array_length ((ValaCodeNode*) _tmp104_)) {
		ValaDelegate* _tmp105_;
		ValaDataType* _tmp106_;
		ValaDataType* _tmp107_;
		_tmp105_ = d;
		_tmp106_ = vala_callable_get_return_type ((ValaCallable*) _tmp105_);
		_tmp107_ = _tmp106_;
		_tmp103_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp107_, VALA_TYPE_ARRAY_TYPE);
	} else {
		_tmp103_ = FALSE;
	}
	if (_tmp103_) {
		ValaArrayType* array_type = NULL;
		ValaDelegate* _tmp108_;
		ValaDataType* _tmp109_;
		ValaDataType* _tmp110_;
		ValaArrayType* _tmp111_;
		gchar* length_ctype = NULL;
		ValaDelegate* _tmp112_;
		gchar* _tmp113_;
		gchar* _tmp114_;
		gchar* _tmp115_;
		gchar* _tmp116_;
		_tmp108_ = d;
		_tmp109_ = vala_callable_get_return_type ((ValaCallable*) _tmp108_);
		_tmp110_ = _tmp109_;
		_tmp111_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp110_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
		array_type = _tmp111_;
		_tmp112_ = d;
		_tmp113_ = vala_get_ccode_array_length_type ((ValaCodeNode*) _tmp112_);
		_tmp114_ = _tmp113_;
		_tmp115_ = g_strconcat (_tmp114_, "*", NULL);
		_tmp116_ = _tmp115_;
		_g_free0 (_tmp114_);
		length_ctype = _tmp116_;
		{
			gint dim = 0;
			dim = 1;
			{
				gboolean _tmp117_ = FALSE;
				_tmp117_ = TRUE;
				while (TRUE) {
					ValaArrayType* _tmp119_;
					gint _tmp120_;
					gint _tmp121_;
					ValaCCodeParameter* cparam = NULL;
					gchar* _tmp122_;
					gchar* _tmp123_;
					const gchar* _tmp124_;
					ValaCCodeParameter* _tmp125_;
					ValaCCodeParameter* _tmp126_;
					ValaHashMap* _tmp127_;
					ValaDelegate* _tmp128_;
					ValaCCodeParameter* _tmp129_;
					if (!_tmp117_) {
						gint _tmp118_;
						_tmp118_ = dim;
						dim = _tmp118_ + 1;
					}
					_tmp117_ = FALSE;
					_tmp119_ = array_type;
					_tmp120_ = vala_array_type_get_rank (_tmp119_);
					_tmp121_ = _tmp120_;
					if (!(dim <= _tmp121_)) {
						break;
					}
					_tmp122_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
					_tmp123_ = _tmp122_;
					_tmp124_ = length_ctype;
					_tmp125_ = vala_ccode_parameter_new (_tmp123_, _tmp124_);
					_tmp126_ = _tmp125_;
					_g_free0 (_tmp123_);
					cparam = _tmp126_;
					_tmp127_ = cparam_map;
					_tmp128_ = d;
					_tmp129_ = cparam;
					vala_map_set ((ValaMap*) _tmp127_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) _tmp128_) + (0.01 * dim), FALSE)), _tmp129_);
					_vala_ccode_node_unref0 (cparam);
				}
			}
		}
		_g_free0 (length_ctype);
		_vala_code_node_unref0 (array_type);
	} else {
		ValaDelegate* _tmp130_;
		ValaDataType* _tmp131_;
		ValaDataType* _tmp132_;
		_tmp130_ = d;
		_tmp131_ = vala_callable_get_return_type ((ValaCallable*) _tmp130_);
		_tmp132_ = _tmp131_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp132_, VALA_TYPE_DELEGATE_TYPE)) {
			ValaDelegateType* deleg_type = NULL;
			ValaDelegate* _tmp133_;
			ValaDataType* _tmp134_;
			ValaDataType* _tmp135_;
			ValaDelegateType* _tmp136_;
			gboolean _tmp137_ = FALSE;
			ValaDelegate* _tmp138_;
			_tmp133_ = d;
			_tmp134_ = vala_callable_get_return_type ((ValaCallable*) _tmp133_);
			_tmp135_ = _tmp134_;
			_tmp136_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp135_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
			deleg_type = _tmp136_;
			_tmp138_ = d;
			if (vala_get_ccode_delegate_target ((ValaCodeNode*) _tmp138_)) {
				ValaDelegateType* _tmp139_;
				ValaDelegate* _tmp140_;
				ValaDelegate* _tmp141_;
				gboolean _tmp142_;
				gboolean _tmp143_;
				_tmp139_ = deleg_type;
				_tmp140_ = vala_delegate_type_get_delegate_symbol (_tmp139_);
				_tmp141_ = _tmp140_;
				_tmp142_ = vala_delegate_get_has_target (_tmp141_);
				_tmp143_ = _tmp142_;
				_tmp137_ = _tmp143_;
			} else {
				_tmp137_ = FALSE;
			}
			if (_tmp137_) {
				ValaCCodeParameter* cparam = NULL;
				gchar* _tmp144_;
				gchar* _tmp145_;
				ValaDataType* _tmp146_;
				gchar* _tmp147_;
				gchar* _tmp148_;
				gchar* _tmp149_;
				gchar* _tmp150_;
				ValaCCodeParameter* _tmp151_;
				ValaCCodeParameter* _tmp152_;
				ValaHashMap* _tmp153_;
				ValaDelegate* _tmp154_;
				ValaCCodeParameter* _tmp155_;
				ValaDelegateType* _tmp156_;
				_tmp144_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
				_tmp145_ = _tmp144_;
				_tmp146_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
				_tmp147_ = vala_get_ccode_name ((ValaCodeNode*) _tmp146_);
				_tmp148_ = _tmp147_;
				_tmp149_ = g_strconcat (_tmp148_, "*", NULL);
				_tmp150_ = _tmp149_;
				_tmp151_ = vala_ccode_parameter_new (_tmp145_, _tmp150_);
				_tmp152_ = _tmp151_;
				_g_free0 (_tmp150_);
				_g_free0 (_tmp148_);
				_g_free0 (_tmp145_);
				cparam = _tmp152_;
				_tmp153_ = cparam_map;
				_tmp154_ = d;
				_tmp155_ = cparam;
				vala_map_set ((ValaMap*) _tmp153_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) _tmp154_), FALSE)), _tmp155_);
				_tmp156_ = deleg_type;
				if (vala_data_type_is_disposable ((ValaDataType*) _tmp156_)) {
					gchar* _tmp157_;
					gchar* _tmp158_;
					ValaDelegateType* _tmp159_;
					gchar* _tmp160_;
					gchar* _tmp161_;
					gchar* _tmp162_;
					gchar* _tmp163_;
					ValaCCodeParameter* _tmp164_;
					ValaHashMap* _tmp165_;
					ValaDelegate* _tmp166_;
					ValaCCodeParameter* _tmp167_;
					_tmp157_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
					_tmp158_ = _tmp157_;
					_tmp159_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
					_tmp160_ = vala_get_ccode_name ((ValaCodeNode*) _tmp159_);
					_tmp161_ = _tmp160_;
					_tmp162_ = g_strconcat (_tmp161_, "*", NULL);
					_tmp163_ = _tmp162_;
					_tmp164_ = vala_ccode_parameter_new (_tmp158_, _tmp163_);
					_vala_ccode_node_unref0 (cparam);
					cparam = _tmp164_;
					_g_free0 (_tmp163_);
					_g_free0 (_tmp161_);
					_g_free0 (_tmp158_);
					_tmp165_ = cparam_map;
					_tmp166_ = d;
					_tmp167_ = cparam;
					vala_map_set ((ValaMap*) _tmp165_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) _tmp166_), FALSE)), _tmp167_);
				}
				_vala_ccode_node_unref0 (cparam);
			}
			_vala_code_node_unref0 (deleg_type);
		} else {
			ValaDelegate* _tmp168_;
			ValaDataType* _tmp169_;
			ValaDataType* _tmp170_;
			_tmp168_ = d;
			_tmp169_ = vala_callable_get_return_type ((ValaCallable*) _tmp168_);
			_tmp170_ = _tmp169_;
			if (vala_data_type_is_real_non_null_struct_type (_tmp170_)) {
				ValaCCodeParameter* cparam = NULL;
				ValaDelegate* _tmp171_;
				ValaDataType* _tmp172_;
				ValaDataType* _tmp173_;
				gchar* _tmp174_;
				gchar* _tmp175_;
				gchar* _tmp176_;
				gchar* _tmp177_;
				ValaCCodeParameter* _tmp178_;
				ValaCCodeParameter* _tmp179_;
				ValaHashMap* _tmp180_;
				ValaCCodeParameter* _tmp181_;
				_tmp171_ = d;
				_tmp172_ = vala_callable_get_return_type ((ValaCallable*) _tmp171_);
				_tmp173_ = _tmp172_;
				_tmp174_ = vala_get_ccode_name ((ValaCodeNode*) _tmp173_);
				_tmp175_ = _tmp174_;
				_tmp176_ = g_strdup_printf ("%s*", _tmp175_);
				_tmp177_ = _tmp176_;
				_tmp178_ = vala_ccode_parameter_new ("result", _tmp177_);
				_tmp179_ = _tmp178_;
				_g_free0 (_tmp177_);
				_g_free0 (_tmp175_);
				cparam = _tmp179_;
				_tmp180_ = cparam_map;
				_tmp181_ = cparam;
				vala_map_set ((ValaMap*) _tmp180_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), _tmp181_);
				_vala_ccode_node_unref0 (cparam);
			}
		}
	}
	_tmp182_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) m);
	_tmp183_ = _tmp182_;
	if (_tmp183_) {
		ValaCCodeParameter* cparam = NULL;
		ValaCCodeParameter* _tmp184_;
		ValaHashMap* _tmp185_;
		ValaDelegate* _tmp186_;
		ValaCCodeParameter* _tmp187_;
		_tmp184_ = vala_ccode_parameter_new ("error", "GError**");
		cparam = _tmp184_;
		_tmp185_ = cparam_map;
		_tmp186_ = d;
		_tmp187_ = cparam;
		vala_map_set ((ValaMap*) _tmp185_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) _tmp186_), FALSE)), _tmp187_);
		_vala_ccode_node_unref0 (cparam);
	}
	last_pos = -1;
	while (TRUE) {
		ValaCCodeFunction* _tmp198_;
		ValaHashMap* _tmp199_;
		gpointer _tmp200_;
		ValaCCodeParameter* _tmp201_;
		min_pos = -1;
		{
			ValaIterator* _pos_it = NULL;
			ValaHashMap* _tmp188_;
			ValaSet* _tmp189_;
			ValaSet* _tmp190_;
			ValaIterator* _tmp191_;
			ValaIterator* _tmp192_;
			_tmp188_ = cparam_map;
			_tmp189_ = vala_map_get_keys ((ValaMap*) _tmp188_);
			_tmp190_ = _tmp189_;
			_tmp191_ = vala_iterable_iterator ((ValaIterable*) _tmp190_);
			_tmp192_ = _tmp191_;
			_vala_iterable_unref0 (_tmp190_);
			_pos_it = _tmp192_;
			while (TRUE) {
				ValaIterator* _tmp193_;
				gint pos = 0;
				ValaIterator* _tmp194_;
				gpointer _tmp195_;
				gboolean _tmp196_ = FALSE;
				_tmp193_ = _pos_it;
				if (!vala_iterator_next (_tmp193_)) {
					break;
				}
				_tmp194_ = _pos_it;
				_tmp195_ = vala_iterator_get (_tmp194_);
				pos = (gint) ((gintptr) _tmp195_);
				if (pos > last_pos) {
					gboolean _tmp197_ = FALSE;
					if (min_pos == -1) {
						_tmp197_ = TRUE;
					} else {
						_tmp197_ = pos < min_pos;
					}
					_tmp196_ = _tmp197_;
				} else {
					_tmp196_ = FALSE;
				}
				if (_tmp196_) {
					min_pos = pos;
				}
			}
			_vala_iterator_unref0 (_pos_it);
		}
		if (min_pos == -1) {
			break;
		}
		_tmp198_ = function;
		_tmp199_ = cparam_map;
		_tmp200_ = vala_map_get ((ValaMap*) _tmp199_, (gpointer) ((gintptr) min_pos));
		_tmp201_ = (ValaCCodeParameter*) _tmp200_;
		vala_ccode_function_add_parameter (_tmp198_, _tmp201_);
		_vala_ccode_node_unref0 (_tmp201_);
		last_pos = min_pos;
	}
	_tmp202_ = g_direct_hash;
	_tmp203_ = g_direct_equal;
	_tmp204_ = g_direct_equal;
	_tmp205_ = vala_hash_map_new (G_TYPE_INT, NULL, NULL, VALA_TYPE_CCODE_EXPRESSION, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp202_, _tmp203_, _tmp204_);
	carg_map = _tmp205_;
	i = 0;
	_tmp207_ = vala_method_get_binding (m);
	_tmp208_ = _tmp207_;
	if (_tmp208_ == VALA_MEMBER_BINDING_INSTANCE) {
		_tmp206_ = TRUE;
	} else {
		gboolean _tmp209_;
		gboolean _tmp210_;
		_tmp209_ = vala_method_get_closure (m);
		_tmp210_ = _tmp209_;
		_tmp206_ = _tmp210_;
	}
	if (_tmp206_) {
		ValaCCodeExpression* arg = NULL;
		ValaDelegate* _tmp211_;
		gboolean _tmp212_;
		gboolean _tmp213_;
		ValaHashMap* _tmp242_;
		ValaCCodeExpression* _tmp243_;
		_tmp211_ = d;
		_tmp212_ = vala_delegate_get_has_target (_tmp211_);
		_tmp213_ = _tmp212_;
		if (_tmp213_) {
			ValaCCodeIdentifier* _tmp214_;
			gboolean _tmp215_ = FALSE;
			gboolean _tmp216_;
			gboolean _tmp217_;
			_tmp214_ = vala_ccode_identifier_new ("self");
			_vala_ccode_node_unref0 (arg);
			arg = (ValaCCodeExpression*) _tmp214_;
			_tmp216_ = vala_method_get_closure (m);
			_tmp217_ = _tmp216_;
			if (!_tmp217_) {
				ValaParameter* _tmp218_;
				ValaParameter* _tmp219_;
				_tmp218_ = vala_method_get_this_parameter (m);
				_tmp219_ = _tmp218_;
				_tmp215_ = _tmp219_ != NULL;
			} else {
				_tmp215_ = FALSE;
			}
			if (_tmp215_) {
				ValaCCodeExpression* _tmp220_;
				ValaParameter* _tmp221_;
				ValaParameter* _tmp222_;
				ValaDataType* _tmp223_;
				ValaDataType* _tmp224_;
				ValaCCodeExpression* _tmp225_;
				_tmp220_ = arg;
				_tmp221_ = vala_method_get_this_parameter (m);
				_tmp222_ = _tmp221_;
				_tmp223_ = vala_variable_get_variable_type ((ValaVariable*) _tmp222_);
				_tmp224_ = _tmp223_;
				_tmp225_ = vala_ccode_base_module_convert_from_generic_pointer ((ValaCCodeBaseModule*) self, _tmp220_, _tmp224_);
				_vala_ccode_node_unref0 (arg);
				arg = _tmp225_;
			}
		} else {
			gboolean _tmp226_ = FALSE;
			ValaList* _tmp227_;
			gint _tmp228_;
			gint _tmp229_;
			_tmp227_ = d_params;
			_tmp228_ = vala_collection_get_size ((ValaCollection*) _tmp227_);
			_tmp229_ = _tmp228_;
			if (_tmp229_ == 0) {
				_tmp226_ = TRUE;
			} else {
				gboolean _tmp230_;
				gboolean _tmp231_;
				_tmp230_ = vala_method_get_closure (m);
				_tmp231_ = _tmp230_;
				_tmp226_ = _tmp231_;
			}
			if (_tmp226_) {
				ValaSourceReference* _tmp232_ = NULL;
				ValaCCodeInvalidExpression* _tmp235_;
				if (node != NULL) {
					ValaSourceReference* _tmp233_;
					ValaSourceReference* _tmp234_;
					_tmp233_ = vala_code_node_get_source_reference (node);
					_tmp234_ = _tmp233_;
					_tmp232_ = _tmp234_;
				} else {
					_tmp232_ = NULL;
				}
				vala_report_error (_tmp232_, "internal: Cannot create delegate wrapper");
				_tmp235_ = vala_ccode_invalid_expression_new ();
				_vala_ccode_node_unref0 (arg);
				arg = (ValaCCodeExpression*) _tmp235_;
			} else {
				ValaList* _tmp236_;
				gpointer _tmp237_;
				ValaParameter* _tmp238_;
				gchar* _tmp239_;
				gchar* _tmp240_;
				ValaCCodeIdentifier* _tmp241_;
				_tmp236_ = d_params;
				_tmp237_ = vala_list_get (_tmp236_, 0);
				_tmp238_ = (ValaParameter*) _tmp237_;
				_tmp239_ = vala_get_ccode_name ((ValaCodeNode*) _tmp238_);
				_tmp240_ = _tmp239_;
				_tmp241_ = vala_ccode_identifier_new (_tmp240_);
				_vala_ccode_node_unref0 (arg);
				arg = (ValaCCodeExpression*) _tmp241_;
				_g_free0 (_tmp240_);
				_vala_code_node_unref0 (_tmp238_);
				i = 1;
			}
		}
		_tmp242_ = carg_map;
		_tmp243_ = arg;
		vala_map_set ((ValaMap*) _tmp242_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_instance_pos ((ValaCodeNode*) m), FALSE)), _tmp243_);
		_vala_ccode_node_unref0 (arg);
	}
	first = TRUE;
	{
		ValaList* _param_list = NULL;
		ValaList* _tmp244_;
		gint _param_size = 0;
		ValaList* _tmp245_;
		gint _tmp246_;
		gint _tmp247_;
		gint _param_index = 0;
		_tmp244_ = vala_callable_get_parameters ((ValaCallable*) m);
		_param_list = _tmp244_;
		_tmp245_ = _param_list;
		_tmp246_ = vala_collection_get_size ((ValaCollection*) _tmp245_);
		_tmp247_ = _tmp246_;
		_param_size = _tmp247_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp248_;
			gint _tmp249_;
			ValaParameter* param = NULL;
			ValaList* _tmp250_;
			gpointer _tmp251_;
			gboolean _tmp252_ = FALSE;
			gboolean _tmp253_ = FALSE;
			ValaCCodeExpression* arg = NULL;
			ValaList* _tmp268_;
			gpointer _tmp269_;
			ValaParameter* _tmp270_;
			gchar* _tmp271_;
			gchar* _tmp272_;
			ValaCCodeIdentifier* _tmp273_;
			ValaList* _tmp274_;
			gpointer _tmp275_;
			ValaParameter* _tmp276_;
			ValaDataType* _tmp277_;
			ValaDataType* _tmp278_;
			gboolean _tmp279_;
			ValaHashMap* _tmp285_;
			ValaParameter* _tmp286_;
			ValaCCodeExpression* _tmp287_;
			gboolean _tmp288_ = FALSE;
			ValaParameter* _tmp289_;
			gint _tmp368_;
			_param_index = _param_index + 1;
			_tmp248_ = _param_index;
			_tmp249_ = _param_size;
			if (!(_tmp248_ < _tmp249_)) {
				break;
			}
			_tmp250_ = _param_list;
			_tmp251_ = vala_list_get (_tmp250_, _param_index);
			param = (ValaParameter*) _tmp251_;
			if (first) {
				ValaDelegate* _tmp254_;
				ValaDataType* _tmp255_;
				ValaDataType* _tmp256_;
				_tmp254_ = d;
				_tmp255_ = vala_delegate_get_sender_type (_tmp254_);
				_tmp256_ = _tmp255_;
				_tmp253_ = _tmp256_ != NULL;
			} else {
				_tmp253_ = FALSE;
			}
			if (_tmp253_) {
				ValaList* _tmp257_;
				gint _tmp258_;
				gint _tmp259_;
				ValaDelegate* _tmp260_;
				ValaList* _tmp261_;
				gint _tmp262_;
				gint _tmp263_;
				_tmp257_ = vala_callable_get_parameters ((ValaCallable*) m);
				_tmp258_ = vala_collection_get_size ((ValaCollection*) _tmp257_);
				_tmp259_ = _tmp258_;
				_tmp260_ = d;
				_tmp261_ = vala_callable_get_parameters ((ValaCallable*) _tmp260_);
				_tmp262_ = vala_collection_get_size ((ValaCollection*) _tmp261_);
				_tmp263_ = _tmp262_;
				_tmp252_ = _tmp259_ == (_tmp263_ + 1);
			} else {
				_tmp252_ = FALSE;
			}
			if (_tmp252_) {
				ValaHashMap* _tmp264_;
				ValaParameter* _tmp265_;
				ValaCCodeIdentifier* _tmp266_;
				ValaCCodeIdentifier* _tmp267_;
				_tmp264_ = carg_map;
				_tmp265_ = param;
				_tmp266_ = vala_ccode_identifier_new ("_sender");
				_tmp267_ = _tmp266_;
				vala_map_set ((ValaMap*) _tmp264_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (_tmp265_), FALSE)), (ValaCCodeExpression*) _tmp267_);
				_vala_ccode_node_unref0 (_tmp267_);
				first = FALSE;
				_vala_code_node_unref0 (param);
				continue;
			}
			_tmp268_ = d_params;
			_tmp269_ = vala_list_get (_tmp268_, i);
			_tmp270_ = (ValaParameter*) _tmp269_;
			_tmp271_ = vala_get_ccode_name ((ValaCodeNode*) _tmp270_);
			_tmp272_ = _tmp271_;
			_tmp273_ = vala_ccode_identifier_new (_tmp272_);
			_vala_ccode_node_unref0 (arg);
			arg = (ValaCCodeExpression*) _tmp273_;
			_g_free0 (_tmp272_);
			_vala_code_node_unref0 (_tmp270_);
			_tmp274_ = d_params;
			_tmp275_ = vala_list_get (_tmp274_, i);
			_tmp276_ = (ValaParameter*) _tmp275_;
			_tmp277_ = vala_variable_get_variable_type ((ValaVariable*) _tmp276_);
			_tmp278_ = _tmp277_;
			_tmp279_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp278_, VALA_TYPE_GENERIC_TYPE);
			_vala_code_node_unref0 (_tmp276_);
			if (_tmp279_) {
				ValaCCodeExpression* _tmp280_;
				ValaParameter* _tmp281_;
				ValaDataType* _tmp282_;
				ValaDataType* _tmp283_;
				ValaCCodeExpression* _tmp284_;
				_tmp280_ = arg;
				_tmp281_ = param;
				_tmp282_ = vala_variable_get_variable_type ((ValaVariable*) _tmp281_);
				_tmp283_ = _tmp282_;
				_tmp284_ = vala_ccode_base_module_convert_from_generic_pointer ((ValaCCodeBaseModule*) self, _tmp280_, _tmp283_);
				_vala_ccode_node_unref0 (arg);
				arg = _tmp284_;
			}
			_tmp285_ = carg_map;
			_tmp286_ = param;
			_tmp287_ = arg;
			vala_map_set ((ValaMap*) _tmp285_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (_tmp286_), FALSE)), _tmp287_);
			_tmp289_ = param;
			if (vala_get_ccode_array_length ((ValaCodeNode*) _tmp289_)) {
				ValaParameter* _tmp290_;
				ValaDataType* _tmp291_;
				ValaDataType* _tmp292_;
				_tmp290_ = param;
				_tmp291_ = vala_variable_get_variable_type ((ValaVariable*) _tmp290_);
				_tmp292_ = _tmp291_;
				_tmp288_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp292_, VALA_TYPE_ARRAY_TYPE);
			} else {
				_tmp288_ = FALSE;
			}
			if (_tmp288_) {
				ValaArrayType* array_type = NULL;
				ValaParameter* _tmp293_;
				ValaDataType* _tmp294_;
				ValaDataType* _tmp295_;
				ValaArrayType* _tmp296_;
				_tmp293_ = param;
				_tmp294_ = vala_variable_get_variable_type ((ValaVariable*) _tmp293_);
				_tmp295_ = _tmp294_;
				_tmp296_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp295_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
				array_type = _tmp296_;
				{
					gint dim = 0;
					dim = 1;
					{
						gboolean _tmp297_ = FALSE;
						_tmp297_ = TRUE;
						while (TRUE) {
							ValaArrayType* _tmp299_;
							gint _tmp300_;
							gint _tmp301_;
							ValaCCodeExpression* clength = NULL;
							ValaList* _tmp302_;
							gpointer _tmp303_;
							ValaParameter* _tmp304_;
							gboolean _tmp305_;
							ValaHashMap* _tmp331_;
							ValaParameter* _tmp332_;
							ValaCCodeExpression* _tmp333_;
							if (!_tmp297_) {
								gint _tmp298_;
								_tmp298_ = dim;
								dim = _tmp298_ + 1;
							}
							_tmp297_ = FALSE;
							_tmp299_ = array_type;
							_tmp300_ = vala_array_type_get_rank (_tmp299_);
							_tmp301_ = _tmp300_;
							if (!(dim <= _tmp301_)) {
								break;
							}
							_tmp302_ = d_params;
							_tmp303_ = vala_list_get (_tmp302_, i);
							_tmp304_ = (ValaParameter*) _tmp303_;
							_tmp305_ = vala_get_ccode_array_null_terminated ((ValaCodeNode*) _tmp304_);
							_vala_code_node_unref0 (_tmp304_);
							if (_tmp305_) {
								ValaCCodeFunctionCall* len_call = NULL;
								ValaCCodeIdentifier* _tmp306_;
								ValaCCodeIdentifier* _tmp307_;
								ValaCCodeFunctionCall* _tmp308_;
								ValaCCodeFunctionCall* _tmp309_;
								ValaCCodeFunctionCall* _tmp310_;
								ValaList* _tmp311_;
								gpointer _tmp312_;
								ValaParameter* _tmp313_;
								const gchar* _tmp314_;
								const gchar* _tmp315_;
								ValaCCodeIdentifier* _tmp316_;
								ValaCCodeIdentifier* _tmp317_;
								ValaCCodeFunctionCall* _tmp318_;
								ValaCCodeExpression* _tmp319_;
								((ValaCCodeBaseModule*) self)->requires_array_length = TRUE;
								_tmp306_ = vala_ccode_identifier_new ("_vala_array_length");
								_tmp307_ = _tmp306_;
								_tmp308_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp307_);
								_tmp309_ = _tmp308_;
								_vala_ccode_node_unref0 (_tmp307_);
								len_call = _tmp309_;
								_tmp310_ = len_call;
								_tmp311_ = d_params;
								_tmp312_ = vala_list_get (_tmp311_, i);
								_tmp313_ = (ValaParameter*) _tmp312_;
								_tmp314_ = vala_symbol_get_name ((ValaSymbol*) _tmp313_);
								_tmp315_ = _tmp314_;
								_tmp316_ = vala_ccode_identifier_new (_tmp315_);
								_tmp317_ = _tmp316_;
								vala_ccode_function_call_add_argument (_tmp310_, (ValaCCodeExpression*) _tmp317_);
								_vala_ccode_node_unref0 (_tmp317_);
								_vala_code_node_unref0 (_tmp313_);
								_tmp318_ = len_call;
								_tmp319_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp318_);
								_vala_ccode_node_unref0 (clength);
								clength = _tmp319_;
								_vala_ccode_node_unref0 (len_call);
							} else {
								ValaList* _tmp320_;
								gpointer _tmp321_;
								ValaParameter* _tmp322_;
								gboolean _tmp323_;
								_tmp320_ = d_params;
								_tmp321_ = vala_list_get (_tmp320_, i);
								_tmp322_ = (ValaParameter*) _tmp321_;
								_tmp323_ = !vala_get_ccode_array_length ((ValaCodeNode*) _tmp322_);
								_vala_code_node_unref0 (_tmp322_);
								if (_tmp323_) {
									ValaCCodeConstant* _tmp324_;
									_tmp324_ = vala_ccode_constant_new ("-1");
									_vala_ccode_node_unref0 (clength);
									clength = (ValaCCodeExpression*) _tmp324_;
								} else {
									ValaList* _tmp325_;
									gpointer _tmp326_;
									ValaParameter* _tmp327_;
									gchar* _tmp328_;
									gchar* _tmp329_;
									ValaCCodeIdentifier* _tmp330_;
									_tmp325_ = d_params;
									_tmp326_ = vala_list_get (_tmp325_, i);
									_tmp327_ = (ValaParameter*) _tmp326_;
									_tmp328_ = vala_ccode_base_module_get_variable_array_length_cname ((ValaCCodeBaseModule*) self, (ValaVariable*) _tmp327_, dim);
									_tmp329_ = _tmp328_;
									_tmp330_ = vala_ccode_identifier_new (_tmp329_);
									_vala_ccode_node_unref0 (clength);
									clength = (ValaCCodeExpression*) _tmp330_;
									_g_free0 (_tmp329_);
									_vala_code_node_unref0 (_tmp327_);
								}
							}
							_tmp331_ = carg_map;
							_tmp332_ = param;
							_tmp333_ = clength;
							vala_map_set ((ValaMap*) _tmp331_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) _tmp332_) + (0.01 * dim), FALSE)), _tmp333_);
							_vala_ccode_node_unref0 (clength);
						}
					}
				}
				_vala_code_node_unref0 (array_type);
			} else {
				gboolean _tmp334_ = FALSE;
				ValaParameter* _tmp335_;
				_tmp335_ = param;
				if (vala_get_ccode_delegate_target ((ValaCodeNode*) _tmp335_)) {
					ValaParameter* _tmp336_;
					ValaDataType* _tmp337_;
					ValaDataType* _tmp338_;
					_tmp336_ = param;
					_tmp337_ = vala_variable_get_variable_type ((ValaVariable*) _tmp336_);
					_tmp338_ = _tmp337_;
					_tmp334_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp338_, VALA_TYPE_DELEGATE_TYPE);
				} else {
					_tmp334_ = FALSE;
				}
				if (_tmp334_) {
					ValaDelegateType* deleg_type = NULL;
					ValaParameter* _tmp339_;
					ValaDataType* _tmp340_;
					ValaDataType* _tmp341_;
					ValaDelegateType* _tmp342_;
					ValaDelegateType* _tmp343_;
					ValaDelegate* _tmp344_;
					ValaDelegate* _tmp345_;
					gboolean _tmp346_;
					gboolean _tmp347_;
					_tmp339_ = param;
					_tmp340_ = vala_variable_get_variable_type ((ValaVariable*) _tmp339_);
					_tmp341_ = _tmp340_;
					_tmp342_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp341_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
					deleg_type = _tmp342_;
					_tmp343_ = deleg_type;
					_tmp344_ = vala_delegate_type_get_delegate_symbol (_tmp343_);
					_tmp345_ = _tmp344_;
					_tmp346_ = vala_delegate_get_has_target (_tmp345_);
					_tmp347_ = _tmp346_;
					if (_tmp347_) {
						ValaCCodeIdentifier* ctarget = NULL;
						ValaList* _tmp348_;
						gpointer _tmp349_;
						ValaParameter* _tmp350_;
						gchar* _tmp351_;
						gchar* _tmp352_;
						ValaCCodeIdentifier* _tmp353_;
						ValaCCodeIdentifier* _tmp354_;
						ValaHashMap* _tmp355_;
						ValaParameter* _tmp356_;
						ValaCCodeIdentifier* _tmp357_;
						ValaDelegateType* _tmp358_;
						_tmp348_ = d_params;
						_tmp349_ = vala_list_get (_tmp348_, i);
						_tmp350_ = (ValaParameter*) _tmp349_;
						_tmp351_ = vala_get_ccode_delegate_target_name ((ValaVariable*) _tmp350_);
						_tmp352_ = _tmp351_;
						_tmp353_ = vala_ccode_identifier_new (_tmp352_);
						_tmp354_ = _tmp353_;
						_g_free0 (_tmp352_);
						_vala_code_node_unref0 (_tmp350_);
						ctarget = _tmp354_;
						_tmp355_ = carg_map;
						_tmp356_ = param;
						_tmp357_ = ctarget;
						vala_map_set ((ValaMap*) _tmp355_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) _tmp356_), FALSE)), (ValaCCodeExpression*) _tmp357_);
						_tmp358_ = deleg_type;
						if (vala_data_type_is_disposable ((ValaDataType*) _tmp358_)) {
							ValaCCodeIdentifier* ctarget_destroy_notify = NULL;
							ValaList* _tmp359_;
							gpointer _tmp360_;
							ValaParameter* _tmp361_;
							gchar* _tmp362_;
							gchar* _tmp363_;
							ValaCCodeIdentifier* _tmp364_;
							ValaCCodeIdentifier* _tmp365_;
							ValaHashMap* _tmp366_;
							ValaCCodeIdentifier* _tmp367_;
							_tmp359_ = d_params;
							_tmp360_ = vala_list_get (_tmp359_, i);
							_tmp361_ = (ValaParameter*) _tmp360_;
							_tmp362_ = vala_get_ccode_delegate_target_destroy_notify_name ((ValaVariable*) _tmp361_);
							_tmp363_ = _tmp362_;
							_tmp364_ = vala_ccode_identifier_new (_tmp363_);
							_tmp365_ = _tmp364_;
							_g_free0 (_tmp363_);
							_vala_code_node_unref0 (_tmp361_);
							ctarget_destroy_notify = _tmp365_;
							_tmp366_ = carg_map;
							_tmp367_ = ctarget_destroy_notify;
							vala_map_set ((ValaMap*) _tmp366_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp367_);
							_vala_ccode_node_unref0 (ctarget_destroy_notify);
						}
						_vala_ccode_node_unref0 (ctarget);
					}
					_vala_code_node_unref0 (deleg_type);
				}
			}
			_tmp368_ = i;
			i = _tmp368_ + 1;
			_vala_ccode_node_unref0 (arg);
			_vala_code_node_unref0 (param);
		}
	}
	if (vala_get_ccode_array_length ((ValaCodeNode*) m)) {
		ValaDataType* _tmp370_;
		ValaDataType* _tmp371_;
		_tmp370_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp371_ = _tmp370_;
		_tmp369_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp371_, VALA_TYPE_ARRAY_TYPE);
	} else {
		_tmp369_ = FALSE;
	}
	if (_tmp369_) {
		ValaArrayType* array_type = NULL;
		ValaDataType* _tmp372_;
		ValaDataType* _tmp373_;
		ValaArrayType* _tmp374_;
		_tmp372_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp373_ = _tmp372_;
		_tmp374_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp373_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
		array_type = _tmp374_;
		{
			gint dim = 0;
			dim = 1;
			{
				gboolean _tmp375_ = FALSE;
				_tmp375_ = TRUE;
				while (TRUE) {
					ValaArrayType* _tmp377_;
					gint _tmp378_;
					gint _tmp379_;
					ValaCCodeExpression* clength = NULL;
					ValaDelegate* _tmp380_;
					ValaHashMap* _tmp385_;
					ValaCCodeExpression* _tmp386_;
					if (!_tmp375_) {
						gint _tmp376_;
						_tmp376_ = dim;
						dim = _tmp376_ + 1;
					}
					_tmp375_ = FALSE;
					_tmp377_ = array_type;
					_tmp378_ = vala_array_type_get_rank (_tmp377_);
					_tmp379_ = _tmp378_;
					if (!(dim <= _tmp379_)) {
						break;
					}
					_tmp380_ = d;
					if (!vala_get_ccode_array_length ((ValaCodeNode*) _tmp380_)) {
						ValaCCodeConstant* _tmp381_;
						_tmp381_ = vala_ccode_constant_new ("NULL");
						_vala_ccode_node_unref0 (clength);
						clength = (ValaCCodeExpression*) _tmp381_;
					} else {
						gchar* _tmp382_;
						gchar* _tmp383_;
						ValaCCodeIdentifier* _tmp384_;
						_tmp382_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
						_tmp383_ = _tmp382_;
						_tmp384_ = vala_ccode_identifier_new (_tmp383_);
						_vala_ccode_node_unref0 (clength);
						clength = (ValaCCodeExpression*) _tmp384_;
						_g_free0 (_tmp383_);
					}
					_tmp385_ = carg_map;
					_tmp386_ = clength;
					vala_map_set ((ValaMap*) _tmp385_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) m) + (0.01 * dim), FALSE)), _tmp386_);
					_vala_ccode_node_unref0 (clength);
				}
			}
		}
		_vala_code_node_unref0 (array_type);
	} else {
		gboolean _tmp387_ = FALSE;
		if (vala_get_ccode_delegate_target ((ValaCodeNode*) m)) {
			ValaDataType* _tmp388_;
			ValaDataType* _tmp389_;
			_tmp388_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp389_ = _tmp388_;
			_tmp387_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp389_, VALA_TYPE_DELEGATE_TYPE);
		} else {
			_tmp387_ = FALSE;
		}
		if (_tmp387_) {
			ValaDelegateType* deleg_type = NULL;
			ValaDataType* _tmp390_;
			ValaDataType* _tmp391_;
			ValaDelegateType* _tmp392_;
			ValaDelegateType* _tmp393_;
			ValaDelegate* _tmp394_;
			ValaDelegate* _tmp395_;
			gboolean _tmp396_;
			gboolean _tmp397_;
			_tmp390_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp391_ = _tmp390_;
			_tmp392_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp391_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
			deleg_type = _tmp392_;
			_tmp393_ = deleg_type;
			_tmp394_ = vala_delegate_type_get_delegate_symbol (_tmp393_);
			_tmp395_ = _tmp394_;
			_tmp396_ = vala_delegate_get_has_target (_tmp395_);
			_tmp397_ = _tmp396_;
			if (_tmp397_) {
				ValaCCodeIdentifier* ctarget = NULL;
				gchar* _tmp398_;
				gchar* _tmp399_;
				ValaCCodeIdentifier* _tmp400_;
				ValaCCodeIdentifier* _tmp401_;
				ValaHashMap* _tmp402_;
				ValaCCodeIdentifier* _tmp403_;
				ValaDelegateType* _tmp404_;
				_tmp398_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
				_tmp399_ = _tmp398_;
				_tmp400_ = vala_ccode_identifier_new (_tmp399_);
				_tmp401_ = _tmp400_;
				_g_free0 (_tmp399_);
				ctarget = _tmp401_;
				_tmp402_ = carg_map;
				_tmp403_ = ctarget;
				vala_map_set ((ValaMap*) _tmp402_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp403_);
				_tmp404_ = deleg_type;
				if (vala_data_type_is_disposable ((ValaDataType*) _tmp404_)) {
					ValaCCodeIdentifier* ctarget_destroy_notify = NULL;
					gchar* _tmp405_;
					gchar* _tmp406_;
					ValaCCodeIdentifier* _tmp407_;
					ValaCCodeIdentifier* _tmp408_;
					ValaHashMap* _tmp409_;
					ValaCCodeIdentifier* _tmp410_;
					_tmp405_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
					_tmp406_ = _tmp405_;
					_tmp407_ = vala_ccode_identifier_new (_tmp406_);
					_tmp408_ = _tmp407_;
					_g_free0 (_tmp406_);
					ctarget_destroy_notify = _tmp408_;
					_tmp409_ = carg_map;
					_tmp410_ = ctarget_destroy_notify;
					vala_map_set ((ValaMap*) _tmp409_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp410_);
					_vala_ccode_node_unref0 (ctarget_destroy_notify);
				}
				_vala_ccode_node_unref0 (ctarget);
			}
			_vala_code_node_unref0 (deleg_type);
		} else {
			ValaDataType* _tmp411_;
			ValaDataType* _tmp412_;
			_tmp411_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp412_ = _tmp411_;
			if (vala_data_type_is_real_non_null_struct_type (_tmp412_)) {
				ValaHashMap* _tmp413_;
				ValaCCodeIdentifier* _tmp414_;
				ValaCCodeIdentifier* _tmp415_;
				_tmp413_ = carg_map;
				_tmp414_ = vala_ccode_identifier_new ("result");
				_tmp415_ = _tmp414_;
				vala_map_set ((ValaMap*) _tmp413_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), (ValaCCodeExpression*) _tmp415_);
				_vala_ccode_node_unref0 (_tmp415_);
			}
		}
	}
	_tmp416_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) m);
	_tmp417_ = _tmp416_;
	if (_tmp417_) {
		ValaHashMap* _tmp418_;
		ValaCCodeIdentifier* _tmp419_;
		ValaCCodeIdentifier* _tmp420_;
		_tmp418_ = carg_map;
		_tmp419_ = vala_ccode_identifier_new ("error");
		_tmp420_ = _tmp419_;
		vala_map_set ((ValaMap*) _tmp418_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) m), FALSE)), (ValaCCodeExpression*) _tmp420_);
		_vala_ccode_node_unref0 (_tmp420_);
	}
	_tmp421_ = vala_get_ccode_name ((ValaCodeNode*) m);
	_tmp422_ = _tmp421_;
	_tmp423_ = vala_ccode_identifier_new (_tmp422_);
	_tmp424_ = _tmp423_;
	_tmp425_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp424_);
	_tmp426_ = _tmp425_;
	_vala_ccode_node_unref0 (_tmp424_);
	_g_free0 (_tmp422_);
	ccall = _tmp426_;
	last_pos = -1;
	while (TRUE) {
		ValaCCodeFunctionCall* _tmp437_;
		ValaHashMap* _tmp438_;
		gpointer _tmp439_;
		ValaCCodeExpression* _tmp440_;
		min_pos = -1;
		{
			ValaIterator* _pos_it = NULL;
			ValaHashMap* _tmp427_;
			ValaSet* _tmp428_;
			ValaSet* _tmp429_;
			ValaIterator* _tmp430_;
			ValaIterator* _tmp431_;
			_tmp427_ = carg_map;
			_tmp428_ = vala_map_get_keys ((ValaMap*) _tmp427_);
			_tmp429_ = _tmp428_;
			_tmp430_ = vala_iterable_iterator ((ValaIterable*) _tmp429_);
			_tmp431_ = _tmp430_;
			_vala_iterable_unref0 (_tmp429_);
			_pos_it = _tmp431_;
			while (TRUE) {
				ValaIterator* _tmp432_;
				gint pos = 0;
				ValaIterator* _tmp433_;
				gpointer _tmp434_;
				gboolean _tmp435_ = FALSE;
				_tmp432_ = _pos_it;
				if (!vala_iterator_next (_tmp432_)) {
					break;
				}
				_tmp433_ = _pos_it;
				_tmp434_ = vala_iterator_get (_tmp433_);
				pos = (gint) ((gintptr) _tmp434_);
				if (pos > last_pos) {
					gboolean _tmp436_ = FALSE;
					if (min_pos == -1) {
						_tmp436_ = TRUE;
					} else {
						_tmp436_ = pos < min_pos;
					}
					_tmp435_ = _tmp436_;
				} else {
					_tmp435_ = FALSE;
				}
				if (_tmp435_) {
					min_pos = pos;
				}
			}
			_vala_iterator_unref0 (_pos_it);
		}
		if (min_pos == -1) {
			break;
		}
		_tmp437_ = ccall;
		_tmp438_ = carg_map;
		_tmp439_ = vala_map_get ((ValaMap*) _tmp438_, (gpointer) ((gintptr) min_pos));
		_tmp440_ = (ValaCCodeExpression*) _tmp439_;
		vala_ccode_function_call_add_argument (_tmp437_, _tmp440_);
		_vala_ccode_node_unref0 (_tmp440_);
		last_pos = min_pos;
	}
	_tmp441_ = vala_method_get_coroutine (m);
	_tmp442_ = _tmp441_;
	if (_tmp442_) {
		ValaCCodeFunctionCall* _tmp443_;
		ValaCCodeConstant* _tmp444_;
		ValaCCodeConstant* _tmp445_;
		ValaCCodeFunctionCall* _tmp446_;
		ValaCCodeConstant* _tmp447_;
		ValaCCodeConstant* _tmp448_;
		_tmp443_ = ccall;
		_tmp444_ = vala_ccode_constant_new ("NULL");
		_tmp445_ = _tmp444_;
		vala_ccode_function_call_add_argument (_tmp443_, (ValaCCodeExpression*) _tmp445_);
		_vala_ccode_node_unref0 (_tmp445_);
		_tmp446_ = ccall;
		_tmp447_ = vala_ccode_constant_new ("NULL");
		_tmp448_ = _tmp447_;
		vala_ccode_function_call_add_argument (_tmp446_, (ValaCCodeExpression*) _tmp448_);
		_vala_ccode_node_unref0 (_tmp448_);
	}
	_tmp450_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp451_ = _tmp450_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp451_, VALA_TYPE_VOID_TYPE)) {
		_tmp449_ = TRUE;
	} else {
		ValaDataType* _tmp452_;
		ValaDataType* _tmp453_;
		_tmp452_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp453_ = _tmp452_;
		_tmp449_ = vala_data_type_is_real_non_null_struct_type (_tmp453_);
	}
	if (_tmp449_) {
		ValaCCodeFunction* _tmp454_;
		ValaCCodeFunction* _tmp455_;
		ValaCCodeFunctionCall* _tmp456_;
		gboolean _tmp457_ = FALSE;
		ValaDelegate* _tmp458_;
		ValaDataType* _tmp459_;
		ValaDataType* _tmp460_;
		_tmp454_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp455_ = _tmp454_;
		_tmp456_ = ccall;
		vala_ccode_function_add_expression (_tmp455_, (ValaCCodeExpression*) _tmp456_);
		_tmp458_ = d;
		_tmp459_ = vala_callable_get_return_type ((ValaCallable*) _tmp458_);
		_tmp460_ = _tmp459_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp460_, VALA_TYPE_VOID_TYPE)) {
			_tmp457_ = TRUE;
		} else {
			ValaDelegate* _tmp461_;
			ValaDataType* _tmp462_;
			ValaDataType* _tmp463_;
			_tmp461_ = d;
			_tmp462_ = vala_callable_get_return_type ((ValaCallable*) _tmp461_);
			_tmp463_ = _tmp462_;
			_tmp457_ = vala_data_type_is_real_non_null_struct_type (_tmp463_);
		}
		if (!_tmp457_) {
			ValaCCodeFunction* _tmp464_;
			ValaCCodeFunction* _tmp465_;
			ValaDataType* _tmp466_;
			gchar* _tmp467_;
			gchar* _tmp468_;
			ValaDelegate* _tmp469_;
			ValaDataType* _tmp470_;
			ValaDataType* _tmp471_;
			ValaCCodeExpression* _tmp472_;
			ValaCCodeExpression* _tmp473_;
			ValaCCodeVariableDeclarator* _tmp474_;
			ValaCCodeVariableDeclarator* _tmp475_;
			_tmp464_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp465_ = _tmp464_;
			_tmp466_ = creturn_type;
			_tmp467_ = vala_get_ccode_name ((ValaCodeNode*) _tmp466_);
			_tmp468_ = _tmp467_;
			_tmp469_ = d;
			_tmp470_ = vala_callable_get_return_type ((ValaCallable*) _tmp469_);
			_tmp471_ = _tmp470_;
			_tmp472_ = vala_ccode_base_module_default_value_for_type ((ValaCCodeBaseModule*) self, _tmp471_, TRUE, FALSE);
			_tmp473_ = _tmp472_;
			_tmp474_ = vala_ccode_variable_declarator_new ("result", _tmp473_, NULL);
			_tmp475_ = _tmp474_;
			vala_ccode_function_add_declaration (_tmp465_, _tmp468_, (ValaCCodeDeclarator*) _tmp475_, 0);
			_vala_ccode_node_unref0 (_tmp475_);
			_vala_ccode_node_unref0 (_tmp473_);
			_g_free0 (_tmp468_);
		}
	} else {
		ValaCCodeExpression* _result_ = NULL;
		ValaCCodeFunctionCall* _tmp476_;
		ValaCCodeExpression* _tmp477_;
		ValaDelegate* _tmp478_;
		ValaDataType* _tmp479_;
		ValaDataType* _tmp480_;
		ValaCCodeFunction* _tmp485_;
		ValaCCodeFunction* _tmp486_;
		ValaDataType* _tmp487_;
		gchar* _tmp488_;
		gchar* _tmp489_;
		ValaCCodeExpression* _tmp490_;
		ValaCCodeVariableDeclarator* _tmp491_;
		ValaCCodeVariableDeclarator* _tmp492_;
		_tmp476_ = ccall;
		_tmp477_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp476_);
		_result_ = _tmp477_;
		_tmp478_ = d;
		_tmp479_ = vala_callable_get_return_type ((ValaCallable*) _tmp478_);
		_tmp480_ = _tmp479_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp480_, VALA_TYPE_GENERIC_TYPE)) {
			ValaCCodeExpression* _tmp481_;
			ValaDataType* _tmp482_;
			ValaDataType* _tmp483_;
			ValaCCodeExpression* _tmp484_;
			_tmp481_ = _result_;
			_tmp482_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp483_ = _tmp482_;
			_tmp484_ = vala_ccode_base_module_convert_to_generic_pointer ((ValaCCodeBaseModule*) self, _tmp481_, _tmp483_);
			_vala_ccode_node_unref0 (_result_);
			_result_ = _tmp484_;
		}
		_tmp485_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp486_ = _tmp485_;
		_tmp487_ = creturn_type;
		_tmp488_ = vala_get_ccode_name ((ValaCodeNode*) _tmp487_);
		_tmp489_ = _tmp488_;
		_tmp490_ = _result_;
		_tmp491_ = vala_ccode_variable_declarator_new ("result", _tmp490_, NULL);
		_tmp492_ = _tmp491_;
		vala_ccode_function_add_declaration (_tmp486_, _tmp489_, (ValaCCodeDeclarator*) _tmp492_, 0);
		_vala_ccode_node_unref0 (_tmp492_);
		_g_free0 (_tmp489_);
		_vala_ccode_node_unref0 (_result_);
	}
	_tmp494_ = d;
	_tmp495_ = vala_delegate_get_has_target (_tmp494_);
	_tmp496_ = _tmp495_;
	if (_tmp496_) {
		gboolean _tmp497_;
		gboolean _tmp498_;
		_tmp497_ = vala_delegate_type_get_is_called_once (dt);
		_tmp498_ = _tmp497_;
		_tmp493_ = _tmp498_;
	} else {
		_tmp493_ = FALSE;
	}
	if (_tmp493_) {
		ValaCCodeExpression* destroy_notify = NULL;
		gboolean _tmp499_;
		gboolean _tmp500_;
		ValaCCodeExpression* _tmp525_;
		destroy_notify = NULL;
		_tmp499_ = vala_method_get_closure (m);
		_tmp500_ = _tmp499_;
		if (_tmp500_) {
			gint block_id = 0;
			ValaBlock* _tmp501_;
			ValaBlock* _tmp502_;
			gchar* _tmp503_;
			gchar* _tmp504_;
			ValaCCodeIdentifier* _tmp505_;
			_tmp501_ = vala_ccode_base_module_get_current_closure_block ((ValaCCodeBaseModule*) self);
			_tmp502_ = _tmp501_;
			block_id = vala_ccode_base_module_get_block_id ((ValaCCodeBaseModule*) self, _tmp502_);
			_tmp503_ = g_strdup_printf ("block%d_data_unref", block_id);
			_tmp504_ = _tmp503_;
			_tmp505_ = vala_ccode_identifier_new (_tmp504_);
			_vala_ccode_node_unref0 (destroy_notify);
			destroy_notify = (ValaCCodeExpression*) _tmp505_;
			_g_free0 (_tmp504_);
		} else {
			gboolean _tmp506_ = FALSE;
			gboolean _tmp507_ = FALSE;
			gboolean _tmp508_ = FALSE;
			ValaDataType* _tmp509_;
			_tmp509_ = vala_ccode_base_module_get_this_type ((ValaCCodeBaseModule*) self);
			if (_tmp509_ != NULL) {
				ValaMemberBinding _tmp510_;
				ValaMemberBinding _tmp511_;
				_tmp510_ = vala_method_get_binding (m);
				_tmp511_ = _tmp510_;
				_tmp508_ = _tmp511_ != VALA_MEMBER_BINDING_STATIC;
			} else {
				_tmp508_ = FALSE;
			}
			if (_tmp508_) {
				gboolean _tmp512_;
				gboolean _tmp513_;
				_tmp512_ = vala_method_get_is_async_callback (m);
				_tmp513_ = _tmp512_;
				_tmp507_ = !_tmp513_;
			} else {
				_tmp507_ = FALSE;
			}
			if (_tmp507_) {
				ValaParameter* _tmp514_;
				ValaParameter* _tmp515_;
				ValaDataType* _tmp516_;
				ValaDataType* _tmp517_;
				ValaTypeSymbol* _tmp518_;
				ValaTypeSymbol* _tmp519_;
				_tmp514_ = vala_method_get_this_parameter (m);
				_tmp515_ = _tmp514_;
				_tmp516_ = vala_variable_get_variable_type ((ValaVariable*) _tmp515_);
				_tmp517_ = _tmp516_;
				_tmp518_ = vala_data_type_get_type_symbol (_tmp517_);
				_tmp519_ = _tmp518_;
				_tmp506_ = vala_is_reference_counting (_tmp519_);
			} else {
				_tmp506_ = FALSE;
			}
			if (_tmp506_) {
				ValaParameter* _tmp520_;
				ValaParameter* _tmp521_;
				ValaDataType* _tmp522_;
				ValaDataType* _tmp523_;
				ValaCCodeExpression* _tmp524_;
				_tmp520_ = vala_method_get_this_parameter (m);
				_tmp521_ = _tmp520_;
				_tmp522_ = vala_variable_get_variable_type ((ValaVariable*) _tmp521_);
				_tmp523_ = _tmp522_;
				_tmp524_ = vala_ccode_base_module_get_destroy_func_expression ((ValaCCodeBaseModule*) self, _tmp523_, FALSE);
				_vala_ccode_node_unref0 (destroy_notify);
				destroy_notify = _tmp524_;
			}
		}
		_tmp525_ = destroy_notify;
		if (_tmp525_ != NULL) {
			ValaCCodeFunctionCall* unref_call = NULL;
			ValaCCodeExpression* _tmp526_;
			ValaCCodeFunctionCall* _tmp527_;
			ValaCCodeFunctionCall* _tmp528_;
			ValaCCodeIdentifier* _tmp529_;
			ValaCCodeIdentifier* _tmp530_;
			ValaCCodeFunction* _tmp531_;
			ValaCCodeFunction* _tmp532_;
			ValaCCodeFunctionCall* _tmp533_;
			_tmp526_ = destroy_notify;
			_tmp527_ = vala_ccode_function_call_new (_tmp526_);
			unref_call = _tmp527_;
			_tmp528_ = unref_call;
			_tmp529_ = vala_ccode_identifier_new ("self");
			_tmp530_ = _tmp529_;
			vala_ccode_function_call_add_argument (_tmp528_, (ValaCCodeExpression*) _tmp530_);
			_vala_ccode_node_unref0 (_tmp530_);
			_tmp531_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp532_ = _tmp531_;
			_tmp533_ = unref_call;
			vala_ccode_function_add_expression (_tmp532_, (ValaCCodeExpression*) _tmp533_);
			_vala_ccode_node_unref0 (unref_call);
		}
		_vala_ccode_node_unref0 (destroy_notify);
	}
	_tmp536_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp537_ = _tmp536_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp537_, VALA_TYPE_VOID_TYPE)) {
		_tmp535_ = TRUE;
	} else {
		ValaDataType* _tmp538_;
		ValaDataType* _tmp539_;
		_tmp538_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp539_ = _tmp538_;
		_tmp535_ = vala_data_type_is_real_non_null_struct_type (_tmp539_);
	}
	if (!_tmp535_) {
		_tmp534_ = TRUE;
	} else {
		gboolean _tmp540_ = FALSE;
		ValaDelegate* _tmp541_;
		ValaDataType* _tmp542_;
		ValaDataType* _tmp543_;
		_tmp541_ = d;
		_tmp542_ = vala_callable_get_return_type ((ValaCallable*) _tmp541_);
		_tmp543_ = _tmp542_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp543_, VALA_TYPE_VOID_TYPE)) {
			_tmp540_ = TRUE;
		} else {
			ValaDelegate* _tmp544_;
			ValaDataType* _tmp545_;
			ValaDataType* _tmp546_;
			_tmp544_ = d;
			_tmp545_ = vala_callable_get_return_type ((ValaCallable*) _tmp544_);
			_tmp546_ = _tmp545_;
			_tmp540_ = vala_data_type_is_real_non_null_struct_type (_tmp546_);
		}
		_tmp534_ = !_tmp540_;
	}
	if (_tmp534_) {
		ValaCCodeFunction* _tmp547_;
		ValaCCodeFunction* _tmp548_;
		ValaCCodeIdentifier* _tmp549_;
		ValaCCodeIdentifier* _tmp550_;
		_tmp547_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp548_ = _tmp547_;
		_tmp549_ = vala_ccode_identifier_new ("result");
		_tmp550_ = _tmp549_;
		vala_ccode_function_add_return (_tmp548_, (ValaCCodeExpression*) _tmp550_);
		_vala_ccode_node_unref0 (_tmp550_);
	}
	vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
	_tmp551_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp552_ = function;
	vala_ccode_file_add_function_declaration (_tmp551_, _tmp552_);
	_tmp553_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp554_ = function;
	vala_ccode_file_add_function (_tmp553_, _tmp554_);
	result = wrapper_name;
	_vala_ccode_node_unref0 (ccall);
	_vala_map_unref0 (carg_map);
	_vala_iterable_unref0 (d_params);
	_vala_map_unref0 (cparam_map);
	_vala_ccode_node_unref0 (function);
	_vala_code_node_unref0 (creturn_type);
	_vala_code_node_unref0 (dynamic_sig);
	_vala_code_node_unref0 (sig);
	_g_free0 (delegate_name);
	_vala_code_node_unref0 (d);
	return result;
}

static ValaCCodeParameter*
vala_ccode_delegate_module_real_generate_parameter (ValaCCodeMethodModule* base,
                                                    ValaParameter* param,
                                                    ValaCCodeFile* decl_space,
                                                    ValaMap* cparam_map,
                                                    ValaMap* carg_map)
{
	ValaCCodeDelegateModule * self;
	gboolean _tmp0_ = FALSE;
	ValaDataType* _tmp1_;
	ValaDataType* _tmp2_;
	ValaDataType* param_type = NULL;
	ValaDataType* _tmp6_;
	ValaDataType* _tmp7_;
	ValaDataType* _tmp8_;
	gboolean _tmp9_ = FALSE;
	ValaDataType* _tmp10_;
	ValaDataType* _tmp29_;
	gchar* ctypename = NULL;
	ValaDataType* _tmp30_;
	gchar* _tmp31_;
	gchar* target_ctypename = NULL;
	ValaDataType* _tmp32_;
	gchar* _tmp33_;
	gchar* target_destroy_notify_ctypename = NULL;
	ValaDelegateType* _tmp34_;
	gchar* _tmp35_;
	ValaParameterDirection _tmp36_;
	ValaParameterDirection _tmp37_;
	ValaCCodeParameter* main_cparam = NULL;
	gchar* _tmp44_;
	gchar* _tmp45_;
	const gchar* _tmp46_;
	ValaCCodeParameter* _tmp47_;
	ValaCCodeParameter* _tmp48_;
	ValaCCodeParameter* _tmp49_;
	ValaDataType* _tmp52_;
	ValaCCodeParameter* result;
	self = (ValaCCodeDelegateModule*) base;
	g_return_val_if_fail (param != NULL, NULL);
	g_return_val_if_fail (decl_space != NULL, NULL);
	g_return_val_if_fail (cparam_map != NULL, NULL);
	_tmp1_ = vala_variable_get_variable_type ((ValaVariable*) param);
	_tmp2_ = _tmp1_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, VALA_TYPE_DELEGATE_TYPE)) {
		_tmp0_ = TRUE;
	} else {
		ValaDataType* _tmp3_;
		ValaDataType* _tmp4_;
		_tmp3_ = vala_variable_get_variable_type ((ValaVariable*) param);
		_tmp4_ = _tmp3_;
		_tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_METHOD_TYPE);
	}
	if (!_tmp0_) {
		ValaCCodeParameter* _tmp5_;
		_tmp5_ = VALA_CCODE_METHOD_MODULE_CLASS (vala_ccode_delegate_module_parent_class)->generate_parameter ((ValaCCodeMethodModule*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_CCODE_ARRAY_MODULE, ValaCCodeArrayModule), param, decl_space, cparam_map, carg_map);
		result = _tmp5_;
		return result;
	}
	_tmp6_ = vala_variable_get_variable_type ((ValaVariable*) param);
	_tmp7_ = _tmp6_;
	_tmp8_ = _vala_code_node_ref0 (_tmp7_);
	param_type = _tmp8_;
	_tmp10_ = param_type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_DELEGATE_TYPE)) {
		ValaDataType* _tmp11_;
		ValaDelegate* _tmp12_;
		ValaDelegate* _tmp13_;
		ValaSymbol* _tmp14_;
		ValaSymbol* _tmp15_;
		_tmp11_ = param_type;
		_tmp12_ = vala_delegate_type_get_delegate_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
		_tmp13_ = _tmp12_;
		_tmp14_ = vala_symbol_get_parent_symbol ((ValaSymbol*) param);
		_tmp15_ = _tmp14_;
		_tmp9_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, VALA_TYPE_SYMBOL, ValaSymbol) == _tmp15_;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		ValaCodeContext* _tmp16_;
		ValaCodeContext* _tmp17_;
		ValaNamespace* _tmp18_;
		ValaNamespace* _tmp19_;
		ValaScope* _tmp20_;
		ValaScope* _tmp21_;
		ValaSymbol* _tmp22_;
		ValaSymbol* _tmp23_;
		ValaScope* _tmp24_;
		ValaScope* _tmp25_;
		ValaSymbol* _tmp26_;
		ValaDelegate* _tmp27_;
		ValaDelegateType* _tmp28_;
		_tmp16_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp17_ = _tmp16_;
		_tmp18_ = vala_code_context_get_root (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = vala_symbol_get_scope ((ValaSymbol*) _tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = vala_scope_lookup (_tmp21_, "GLib");
		_tmp23_ = _tmp22_;
		_tmp24_ = vala_symbol_get_scope (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = vala_scope_lookup (_tmp25_, "Callback");
		_tmp27_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, VALA_TYPE_DELEGATE, ValaDelegate);
		_tmp28_ = vala_delegate_type_new (_tmp27_, NULL);
		_vala_code_node_unref0 (param_type);
		param_type = (ValaDataType*) _tmp28_;
		_vala_code_node_unref0 (_tmp27_);
		_vala_code_node_unref0 (_tmp23_);
	}
	_tmp29_ = param_type;
	vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp29_, decl_space);
	_tmp30_ = param_type;
	_tmp31_ = vala_get_ccode_name ((ValaCodeNode*) _tmp30_);
	ctypename = _tmp31_;
	_tmp32_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
	_tmp33_ = vala_get_ccode_name ((ValaCodeNode*) _tmp32_);
	target_ctypename = _tmp33_;
	_tmp34_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
	_tmp35_ = vala_get_ccode_name ((ValaCodeNode*) _tmp34_);
	target_destroy_notify_ctypename = _tmp35_;
	_tmp36_ = vala_parameter_get_direction (param);
	_tmp37_ = _tmp36_;
	if (_tmp37_ != VALA_PARAMETER_DIRECTION_IN) {
		const gchar* _tmp38_;
		gchar* _tmp39_;
		const gchar* _tmp40_;
		gchar* _tmp41_;
		const gchar* _tmp42_;
		gchar* _tmp43_;
		_tmp38_ = ctypename;
		_tmp39_ = g_strconcat (_tmp38_, "*", NULL);
		_g_free0 (ctypename);
		ctypename = _tmp39_;
		_tmp40_ = target_ctypename;
		_tmp41_ = g_strconcat (_tmp40_, "*", NULL);
		_g_free0 (target_ctypename);
		target_ctypename = _tmp41_;
		_tmp42_ = target_destroy_notify_ctypename;
		_tmp43_ = g_strconcat (_tmp42_, "*", NULL);
		_g_free0 (target_destroy_notify_ctypename);
		target_destroy_notify_ctypename = _tmp43_;
	}
	_tmp44_ = vala_get_ccode_name ((ValaCodeNode*) param);
	_tmp45_ = _tmp44_;
	_tmp46_ = ctypename;
	_tmp47_ = vala_ccode_parameter_new (_tmp45_, _tmp46_);
	_tmp48_ = _tmp47_;
	_g_free0 (_tmp45_);
	main_cparam = _tmp48_;
	_tmp49_ = main_cparam;
	vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (param), FALSE)), _tmp49_);
	if (carg_map != NULL) {
		ValaCCodeExpression* _tmp50_;
		ValaCCodeExpression* _tmp51_;
		_tmp50_ = vala_ccode_base_module_get_parameter_cexpression ((ValaCCodeBaseModule*) self, param);
		_tmp51_ = _tmp50_;
		vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (param), FALSE)), _tmp51_);
		_vala_ccode_node_unref0 (_tmp51_);
	}
	_tmp52_ = param_type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp52_, VALA_TYPE_DELEGATE_TYPE)) {
		ValaDelegateType* deleg_type = NULL;
		ValaDataType* _tmp53_;
		gboolean _tmp54_ = FALSE;
		_tmp53_ = param_type;
		deleg_type = G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType);
		if (vala_get_ccode_delegate_target ((ValaCodeNode*) param)) {
			ValaDelegateType* _tmp55_;
			ValaDelegate* _tmp56_;
			ValaDelegate* _tmp57_;
			gboolean _tmp58_;
			gboolean _tmp59_;
			_tmp55_ = deleg_type;
			_tmp56_ = vala_delegate_type_get_delegate_symbol (_tmp55_);
			_tmp57_ = _tmp56_;
			_tmp58_ = vala_delegate_get_has_target (_tmp57_);
			_tmp59_ = _tmp58_;
			_tmp54_ = _tmp59_;
		} else {
			_tmp54_ = FALSE;
		}
		if (_tmp54_) {
			ValaCCodeParameter* cparam = NULL;
			gchar* _tmp60_;
			gchar* _tmp61_;
			const gchar* _tmp62_;
			ValaCCodeParameter* _tmp63_;
			ValaCCodeParameter* _tmp64_;
			ValaCCodeParameter* _tmp65_;
			ValaDelegateType* _tmp71_;
			_tmp60_ = vala_get_ccode_delegate_target_name ((ValaVariable*) param);
			_tmp61_ = _tmp60_;
			_tmp62_ = target_ctypename;
			_tmp63_ = vala_ccode_parameter_new (_tmp61_, _tmp62_);
			_tmp64_ = _tmp63_;
			_g_free0 (_tmp61_);
			cparam = _tmp64_;
			_tmp65_ = cparam;
			vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp65_);
			if (carg_map != NULL) {
				ValaCCodeParameter* _tmp66_;
				const gchar* _tmp67_;
				const gchar* _tmp68_;
				ValaCCodeExpression* _tmp69_;
				ValaCCodeExpression* _tmp70_;
				_tmp66_ = cparam;
				_tmp67_ = vala_ccode_parameter_get_name (_tmp66_);
				_tmp68_ = _tmp67_;
				_tmp69_ = vala_ccode_base_module_get_cexpression ((ValaCCodeBaseModule*) self, _tmp68_);
				_tmp70_ = _tmp69_;
				vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp70_);
				_vala_ccode_node_unref0 (_tmp70_);
			}
			_tmp71_ = deleg_type;
			if (vala_data_type_is_disposable ((ValaDataType*) _tmp71_)) {
				gchar* _tmp72_;
				gchar* _tmp73_;
				const gchar* _tmp74_;
				ValaCCodeParameter* _tmp75_;
				ValaCCodeParameter* _tmp76_;
				_tmp72_ = vala_get_ccode_delegate_target_destroy_notify_name ((ValaVariable*) param);
				_tmp73_ = _tmp72_;
				_tmp74_ = target_destroy_notify_ctypename;
				_tmp75_ = vala_ccode_parameter_new (_tmp73_, _tmp74_);
				_vala_ccode_node_unref0 (cparam);
				cparam = _tmp75_;
				_g_free0 (_tmp73_);
				_tmp76_ = cparam;
				vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) param), FALSE)), _tmp76_);
				if (carg_map != NULL) {
					ValaCCodeParameter* _tmp77_;
					const gchar* _tmp78_;
					const gchar* _tmp79_;
					ValaCCodeExpression* _tmp80_;
					ValaCCodeExpression* _tmp81_;
					_tmp77_ = cparam;
					_tmp78_ = vala_ccode_parameter_get_name (_tmp77_);
					_tmp79_ = _tmp78_;
					_tmp80_ = vala_ccode_base_module_get_cexpression ((ValaCCodeBaseModule*) self, _tmp79_);
					_tmp81_ = _tmp80_;
					vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) param), FALSE)), _tmp81_);
					_vala_ccode_node_unref0 (_tmp81_);
				}
			}
			_vala_ccode_node_unref0 (cparam);
		}
	} else {
		ValaDataType* _tmp82_;
		_tmp82_ = param_type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp82_, VALA_TYPE_METHOD_TYPE)) {
			ValaCCodeParameter* cparam = NULL;
			gchar* _tmp83_;
			gchar* _tmp84_;
			const gchar* _tmp85_;
			ValaCCodeParameter* _tmp86_;
			ValaCCodeParameter* _tmp87_;
			ValaCCodeParameter* _tmp88_;
			_tmp83_ = vala_get_ccode_delegate_target_name ((ValaVariable*) param);
			_tmp84_ = _tmp83_;
			_tmp85_ = target_ctypename;
			_tmp86_ = vala_ccode_parameter_new (_tmp84_, _tmp85_);
			_tmp87_ = _tmp86_;
			_g_free0 (_tmp84_);
			cparam = _tmp87_;
			_tmp88_ = cparam;
			vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp88_);
			if (carg_map != NULL) {
				ValaCCodeParameter* _tmp89_;
				const gchar* _tmp90_;
				const gchar* _tmp91_;
				ValaCCodeExpression* _tmp92_;
				ValaCCodeExpression* _tmp93_;
				_tmp89_ = cparam;
				_tmp90_ = vala_ccode_parameter_get_name (_tmp89_);
				_tmp91_ = _tmp90_;
				_tmp92_ = vala_ccode_base_module_get_cexpression ((ValaCCodeBaseModule*) self, _tmp91_);
				_tmp93_ = _tmp92_;
				vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp93_);
				_vala_ccode_node_unref0 (_tmp93_);
			}
			_vala_ccode_node_unref0 (cparam);
		}
	}
	result = main_cparam;
	_g_free0 (target_destroy_notify_ctypename);
	_g_free0 (target_ctypename);
	_g_free0 (ctypename);
	_vala_code_node_unref0 (param_type);
	return result;
}

ValaCCodeDelegateModule*
vala_ccode_delegate_module_construct (GType object_type)
{
	ValaCCodeDelegateModule* self = NULL;
	self = (ValaCCodeDelegateModule*) vala_ccode_array_module_construct (object_type);
	return self;
}

ValaCCodeDelegateModule*
vala_ccode_delegate_module_new (void)
{
	return vala_ccode_delegate_module_construct (VALA_TYPE_CCODE_DELEGATE_MODULE);
}

static void
vala_ccode_delegate_module_class_init (ValaCCodeDelegateModuleClass * klass,
                                       gpointer klass_data)
{
	vala_ccode_delegate_module_parent_class = g_type_class_peek_parent (klass);
	((ValaCCodeBaseModuleClass *) klass)->generate_delegate_declaration = (void (*) (ValaCCodeBaseModule*, ValaDelegate*, ValaCCodeFile*)) vala_ccode_delegate_module_real_generate_delegate_declaration;
	((ValaCodeVisitorClass *) klass)->visit_delegate = (void (*) (ValaCodeVisitor*, ValaDelegate*)) vala_ccode_delegate_module_real_visit_delegate;
	((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_cname = (gchar* (*) (ValaCCodeBaseModule*, const gchar*)) vala_ccode_delegate_module_real_get_delegate_target_cname;
	((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_cexpression = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaExpression*, ValaCCodeExpression**)) vala_ccode_delegate_module_real_get_delegate_target_cexpression;
	((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_cvalue = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaTargetValue*)) vala_ccode_delegate_module_real_get_delegate_target_cvalue;
	((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_destroy_notify_cvalue = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaTargetValue*)) vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue;
	((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_destroy_notify_cname = (gchar* (*) (ValaCCodeBaseModule*, const gchar*)) vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname;
	((ValaCCodeBaseModuleClass *) klass)->get_implicit_cast_expression = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaCCodeExpression*, ValaDataType*, ValaDataType*, ValaCodeNode*)) vala_ccode_delegate_module_real_get_implicit_cast_expression;
	((ValaCCodeMethodModuleClass *) klass)->generate_parameter = (ValaCCodeParameter* (*) (ValaCCodeMethodModule*, ValaParameter*, ValaCCodeFile*, ValaMap*, ValaMap*)) vala_ccode_delegate_module_real_generate_parameter;
}

static void
vala_ccode_delegate_module_instance_init (ValaCCodeDelegateModule * self,
                                          gpointer klass)
{
}

/**
 * The link between an assignment and generated code.
 */
static GType
vala_ccode_delegate_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeDelegateModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_delegate_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeDelegateModule), 0, (GInstanceInitFunc) vala_ccode_delegate_module_instance_init, NULL };
	GType vala_ccode_delegate_module_type_id;
	vala_ccode_delegate_module_type_id = g_type_register_static (VALA_TYPE_CCODE_ARRAY_MODULE, "ValaCCodeDelegateModule", &g_define_type_info, 0);
	return vala_ccode_delegate_module_type_id;
}

GType
vala_ccode_delegate_module_get_type (void)
{
	static volatile gsize vala_ccode_delegate_module_type_id__once = 0;
	if (g_once_init_enter (&vala_ccode_delegate_module_type_id__once)) {
		GType vala_ccode_delegate_module_type_id;
		vala_ccode_delegate_module_type_id = vala_ccode_delegate_module_get_type_once ();
		g_once_init_leave (&vala_ccode_delegate_module_type_id__once, vala_ccode_delegate_module_type_id);
	}
	return vala_ccode_delegate_module_type_id__once;
}

