/* 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>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#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 _tmp354_ = FALSE;
	gboolean _tmp401_;
	gboolean _tmp402_;
	ValaCCodeFunctionCall* ccall = NULL;
	gchar* _tmp406_;
	gchar* _tmp407_;
	ValaCCodeIdentifier* _tmp408_;
	ValaCCodeIdentifier* _tmp409_;
	ValaCCodeFunctionCall* _tmp410_;
	ValaCCodeFunctionCall* _tmp411_;
	gboolean _tmp426_;
	gboolean _tmp427_;
	gboolean _tmp434_ = FALSE;
	ValaDataType* _tmp435_;
	ValaDataType* _tmp436_;
	gboolean _tmp478_ = FALSE;
	ValaDelegate* _tmp479_;
	gboolean _tmp480_;
	gboolean _tmp481_;
	gboolean _tmp519_ = FALSE;
	gboolean _tmp520_ = FALSE;
	ValaDataType* _tmp521_;
	ValaDataType* _tmp522_;
	ValaCCodeFile* _tmp536_;
	ValaCCodeFunction* _tmp537_;
	ValaCCodeFile* _tmp538_;
	ValaCCodeFunction* _tmp539_;
	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;
			ValaParameter* d_param = NULL;
			ValaList* _tmp268_;
			gpointer _tmp269_;
			ValaCCodeExpression* arg = NULL;
			ValaParameter* _tmp270_;
			gchar* _tmp271_;
			gchar* _tmp272_;
			ValaCCodeIdentifier* _tmp273_;
			ValaParameter* _tmp274_;
			ValaDataType* _tmp275_;
			ValaDataType* _tmp276_;
			ValaHashMap* _tmp282_;
			ValaParameter* _tmp283_;
			ValaCCodeExpression* _tmp284_;
			gboolean _tmp285_ = FALSE;
			ValaParameter* _tmp286_;
			gint _tmp353_;
			_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);
			d_param = (ValaParameter*) _tmp269_;
			_tmp270_ = d_param;
			_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_);
			_tmp274_ = d_param;
			_tmp275_ = vala_variable_get_variable_type ((ValaVariable*) _tmp274_);
			_tmp276_ = _tmp275_;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp276_, VALA_TYPE_GENERIC_TYPE)) {
				ValaCCodeExpression* _tmp277_;
				ValaParameter* _tmp278_;
				ValaDataType* _tmp279_;
				ValaDataType* _tmp280_;
				ValaCCodeExpression* _tmp281_;
				_tmp277_ = arg;
				_tmp278_ = param;
				_tmp279_ = vala_variable_get_variable_type ((ValaVariable*) _tmp278_);
				_tmp280_ = _tmp279_;
				_tmp281_ = vala_ccode_base_module_convert_from_generic_pointer ((ValaCCodeBaseModule*) self, _tmp277_, _tmp280_);
				_vala_ccode_node_unref0 (arg);
				arg = _tmp281_;
			}
			_tmp282_ = carg_map;
			_tmp283_ = param;
			_tmp284_ = arg;
			vala_map_set ((ValaMap*) _tmp282_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (_tmp283_), FALSE)), _tmp284_);
			_tmp286_ = param;
			if (vala_get_ccode_array_length ((ValaCodeNode*) _tmp286_)) {
				ValaParameter* _tmp287_;
				ValaDataType* _tmp288_;
				ValaDataType* _tmp289_;
				_tmp287_ = param;
				_tmp288_ = vala_variable_get_variable_type ((ValaVariable*) _tmp287_);
				_tmp289_ = _tmp288_;
				_tmp285_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp289_, VALA_TYPE_ARRAY_TYPE);
			} else {
				_tmp285_ = FALSE;
			}
			if (_tmp285_) {
				ValaArrayType* array_type = NULL;
				ValaParameter* _tmp290_;
				ValaDataType* _tmp291_;
				ValaDataType* _tmp292_;
				ValaArrayType* _tmp293_;
				_tmp290_ = param;
				_tmp291_ = vala_variable_get_variable_type ((ValaVariable*) _tmp290_);
				_tmp292_ = _tmp291_;
				_tmp293_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp292_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
				array_type = _tmp293_;
				{
					gint dim = 0;
					dim = 1;
					{
						gboolean _tmp294_ = FALSE;
						_tmp294_ = TRUE;
						while (TRUE) {
							ValaArrayType* _tmp296_;
							gint _tmp297_;
							gint _tmp298_;
							ValaCCodeExpression* clength = NULL;
							gboolean _tmp299_ = FALSE;
							ValaParameter* _tmp300_;
							ValaHashMap* _tmp320_;
							ValaParameter* _tmp321_;
							ValaCCodeExpression* _tmp322_;
							if (!_tmp294_) {
								gint _tmp295_;
								_tmp295_ = dim;
								dim = _tmp295_ + 1;
							}
							_tmp294_ = FALSE;
							_tmp296_ = array_type;
							_tmp297_ = vala_array_type_get_rank (_tmp296_);
							_tmp298_ = _tmp297_;
							if (!(dim <= _tmp298_)) {
								break;
							}
							_tmp300_ = d_param;
							if (vala_get_ccode_array_null_terminated ((ValaCodeNode*) _tmp300_)) {
								ValaParameter* _tmp301_;
								_tmp301_ = d_param;
								_tmp299_ = !vala_get_ccode_array_length ((ValaCodeNode*) _tmp301_);
							} else {
								_tmp299_ = FALSE;
							}
							if (_tmp299_) {
								ValaCCodeFunctionCall* len_call = NULL;
								ValaCCodeIdentifier* _tmp302_;
								ValaCCodeIdentifier* _tmp303_;
								ValaCCodeFunctionCall* _tmp304_;
								ValaCCodeFunctionCall* _tmp305_;
								ValaCCodeFunctionCall* _tmp306_;
								ValaParameter* _tmp307_;
								const gchar* _tmp308_;
								const gchar* _tmp309_;
								ValaCCodeIdentifier* _tmp310_;
								ValaCCodeIdentifier* _tmp311_;
								ValaCCodeFunctionCall* _tmp312_;
								ValaCCodeExpression* _tmp313_;
								((ValaCCodeBaseModule*) self)->requires_array_length = TRUE;
								_tmp302_ = vala_ccode_identifier_new ("_vala_array_length");
								_tmp303_ = _tmp302_;
								_tmp304_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp303_);
								_tmp305_ = _tmp304_;
								_vala_ccode_node_unref0 (_tmp303_);
								len_call = _tmp305_;
								_tmp306_ = len_call;
								_tmp307_ = d_param;
								_tmp308_ = vala_symbol_get_name ((ValaSymbol*) _tmp307_);
								_tmp309_ = _tmp308_;
								_tmp310_ = vala_ccode_identifier_new (_tmp309_);
								_tmp311_ = _tmp310_;
								vala_ccode_function_call_add_argument (_tmp306_, (ValaCCodeExpression*) _tmp311_);
								_vala_ccode_node_unref0 (_tmp311_);
								_tmp312_ = len_call;
								_tmp313_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp312_);
								_vala_ccode_node_unref0 (clength);
								clength = _tmp313_;
								_vala_ccode_node_unref0 (len_call);
							} else {
								ValaParameter* _tmp314_;
								_tmp314_ = d_param;
								if (!vala_get_ccode_array_length ((ValaCodeNode*) _tmp314_)) {
									ValaCCodeConstant* _tmp315_;
									_tmp315_ = vala_ccode_constant_new ("-1");
									_vala_ccode_node_unref0 (clength);
									clength = (ValaCCodeExpression*) _tmp315_;
								} else {
									ValaParameter* _tmp316_;
									gchar* _tmp317_;
									gchar* _tmp318_;
									ValaCCodeIdentifier* _tmp319_;
									_tmp316_ = d_param;
									_tmp317_ = vala_ccode_base_module_get_variable_array_length_cname ((ValaCCodeBaseModule*) self, (ValaVariable*) _tmp316_, dim);
									_tmp318_ = _tmp317_;
									_tmp319_ = vala_ccode_identifier_new (_tmp318_);
									_vala_ccode_node_unref0 (clength);
									clength = (ValaCCodeExpression*) _tmp319_;
									_g_free0 (_tmp318_);
								}
							}
							_tmp320_ = carg_map;
							_tmp321_ = param;
							_tmp322_ = clength;
							vala_map_set ((ValaMap*) _tmp320_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) _tmp321_) + (0.01 * dim), FALSE)), _tmp322_);
							_vala_ccode_node_unref0 (clength);
						}
					}
				}
				_vala_code_node_unref0 (array_type);
			} else {
				gboolean _tmp323_ = FALSE;
				ValaParameter* _tmp324_;
				_tmp324_ = param;
				if (vala_get_ccode_delegate_target ((ValaCodeNode*) _tmp324_)) {
					ValaParameter* _tmp325_;
					ValaDataType* _tmp326_;
					ValaDataType* _tmp327_;
					_tmp325_ = param;
					_tmp326_ = vala_variable_get_variable_type ((ValaVariable*) _tmp325_);
					_tmp327_ = _tmp326_;
					_tmp323_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp327_, VALA_TYPE_DELEGATE_TYPE);
				} else {
					_tmp323_ = FALSE;
				}
				if (_tmp323_) {
					ValaDelegateType* deleg_type = NULL;
					ValaParameter* _tmp328_;
					ValaDataType* _tmp329_;
					ValaDataType* _tmp330_;
					ValaDelegateType* _tmp331_;
					ValaDelegateType* _tmp332_;
					ValaDelegate* _tmp333_;
					ValaDelegate* _tmp334_;
					gboolean _tmp335_;
					gboolean _tmp336_;
					_tmp328_ = param;
					_tmp329_ = vala_variable_get_variable_type ((ValaVariable*) _tmp328_);
					_tmp330_ = _tmp329_;
					_tmp331_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp330_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
					deleg_type = _tmp331_;
					_tmp332_ = deleg_type;
					_tmp333_ = vala_delegate_type_get_delegate_symbol (_tmp332_);
					_tmp334_ = _tmp333_;
					_tmp335_ = vala_delegate_get_has_target (_tmp334_);
					_tmp336_ = _tmp335_;
					if (_tmp336_) {
						ValaCCodeIdentifier* ctarget = NULL;
						ValaParameter* _tmp337_;
						gchar* _tmp338_;
						gchar* _tmp339_;
						ValaCCodeIdentifier* _tmp340_;
						ValaCCodeIdentifier* _tmp341_;
						ValaHashMap* _tmp342_;
						ValaParameter* _tmp343_;
						ValaCCodeIdentifier* _tmp344_;
						ValaDelegateType* _tmp345_;
						_tmp337_ = d_param;
						_tmp338_ = vala_get_ccode_delegate_target_name ((ValaVariable*) _tmp337_);
						_tmp339_ = _tmp338_;
						_tmp340_ = vala_ccode_identifier_new (_tmp339_);
						_tmp341_ = _tmp340_;
						_g_free0 (_tmp339_);
						ctarget = _tmp341_;
						_tmp342_ = carg_map;
						_tmp343_ = param;
						_tmp344_ = ctarget;
						vala_map_set ((ValaMap*) _tmp342_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) _tmp343_), FALSE)), (ValaCCodeExpression*) _tmp344_);
						_tmp345_ = deleg_type;
						if (vala_data_type_is_disposable ((ValaDataType*) _tmp345_)) {
							ValaCCodeIdentifier* ctarget_destroy_notify = NULL;
							ValaParameter* _tmp346_;
							gchar* _tmp347_;
							gchar* _tmp348_;
							ValaCCodeIdentifier* _tmp349_;
							ValaCCodeIdentifier* _tmp350_;
							ValaHashMap* _tmp351_;
							ValaCCodeIdentifier* _tmp352_;
							_tmp346_ = d_param;
							_tmp347_ = vala_get_ccode_delegate_target_destroy_notify_name ((ValaVariable*) _tmp346_);
							_tmp348_ = _tmp347_;
							_tmp349_ = vala_ccode_identifier_new (_tmp348_);
							_tmp350_ = _tmp349_;
							_g_free0 (_tmp348_);
							ctarget_destroy_notify = _tmp350_;
							_tmp351_ = carg_map;
							_tmp352_ = ctarget_destroy_notify;
							vala_map_set ((ValaMap*) _tmp351_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp352_);
							_vala_ccode_node_unref0 (ctarget_destroy_notify);
						}
						_vala_ccode_node_unref0 (ctarget);
					}
					_vala_code_node_unref0 (deleg_type);
				}
			}
			_tmp353_ = i;
			i = _tmp353_ + 1;
			_vala_ccode_node_unref0 (arg);
			_vala_code_node_unref0 (d_param);
			_vala_code_node_unref0 (param);
		}
	}
	if (vala_get_ccode_array_length ((ValaCodeNode*) m)) {
		ValaDataType* _tmp355_;
		ValaDataType* _tmp356_;
		_tmp355_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp356_ = _tmp355_;
		_tmp354_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp356_, VALA_TYPE_ARRAY_TYPE);
	} else {
		_tmp354_ = FALSE;
	}
	if (_tmp354_) {
		ValaArrayType* array_type = NULL;
		ValaDataType* _tmp357_;
		ValaDataType* _tmp358_;
		ValaArrayType* _tmp359_;
		_tmp357_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp358_ = _tmp357_;
		_tmp359_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp358_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
		array_type = _tmp359_;
		{
			gint dim = 0;
			dim = 1;
			{
				gboolean _tmp360_ = FALSE;
				_tmp360_ = TRUE;
				while (TRUE) {
					ValaArrayType* _tmp362_;
					gint _tmp363_;
					gint _tmp364_;
					ValaCCodeExpression* clength = NULL;
					ValaDelegate* _tmp365_;
					ValaHashMap* _tmp370_;
					ValaCCodeExpression* _tmp371_;
					if (!_tmp360_) {
						gint _tmp361_;
						_tmp361_ = dim;
						dim = _tmp361_ + 1;
					}
					_tmp360_ = FALSE;
					_tmp362_ = array_type;
					_tmp363_ = vala_array_type_get_rank (_tmp362_);
					_tmp364_ = _tmp363_;
					if (!(dim <= _tmp364_)) {
						break;
					}
					_tmp365_ = d;
					if (!vala_get_ccode_array_length ((ValaCodeNode*) _tmp365_)) {
						ValaCCodeConstant* _tmp366_;
						_tmp366_ = vala_ccode_constant_new ("NULL");
						_vala_ccode_node_unref0 (clength);
						clength = (ValaCCodeExpression*) _tmp366_;
					} else {
						gchar* _tmp367_;
						gchar* _tmp368_;
						ValaCCodeIdentifier* _tmp369_;
						_tmp367_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
						_tmp368_ = _tmp367_;
						_tmp369_ = vala_ccode_identifier_new (_tmp368_);
						_vala_ccode_node_unref0 (clength);
						clength = (ValaCCodeExpression*) _tmp369_;
						_g_free0 (_tmp368_);
					}
					_tmp370_ = carg_map;
					_tmp371_ = clength;
					vala_map_set ((ValaMap*) _tmp370_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) m) + (0.01 * dim), FALSE)), _tmp371_);
					_vala_ccode_node_unref0 (clength);
				}
			}
		}
		_vala_code_node_unref0 (array_type);
	} else {
		gboolean _tmp372_ = FALSE;
		if (vala_get_ccode_delegate_target ((ValaCodeNode*) m)) {
			ValaDataType* _tmp373_;
			ValaDataType* _tmp374_;
			_tmp373_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp374_ = _tmp373_;
			_tmp372_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp374_, VALA_TYPE_DELEGATE_TYPE);
		} else {
			_tmp372_ = FALSE;
		}
		if (_tmp372_) {
			ValaDelegateType* deleg_type = NULL;
			ValaDataType* _tmp375_;
			ValaDataType* _tmp376_;
			ValaDelegateType* _tmp377_;
			ValaDelegateType* _tmp378_;
			ValaDelegate* _tmp379_;
			ValaDelegate* _tmp380_;
			gboolean _tmp381_;
			gboolean _tmp382_;
			_tmp375_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp376_ = _tmp375_;
			_tmp377_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp376_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
			deleg_type = _tmp377_;
			_tmp378_ = deleg_type;
			_tmp379_ = vala_delegate_type_get_delegate_symbol (_tmp378_);
			_tmp380_ = _tmp379_;
			_tmp381_ = vala_delegate_get_has_target (_tmp380_);
			_tmp382_ = _tmp381_;
			if (_tmp382_) {
				ValaCCodeIdentifier* ctarget = NULL;
				gchar* _tmp383_;
				gchar* _tmp384_;
				ValaCCodeIdentifier* _tmp385_;
				ValaCCodeIdentifier* _tmp386_;
				ValaHashMap* _tmp387_;
				ValaCCodeIdentifier* _tmp388_;
				ValaDelegateType* _tmp389_;
				_tmp383_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
				_tmp384_ = _tmp383_;
				_tmp385_ = vala_ccode_identifier_new (_tmp384_);
				_tmp386_ = _tmp385_;
				_g_free0 (_tmp384_);
				ctarget = _tmp386_;
				_tmp387_ = carg_map;
				_tmp388_ = ctarget;
				vala_map_set ((ValaMap*) _tmp387_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp388_);
				_tmp389_ = deleg_type;
				if (vala_data_type_is_disposable ((ValaDataType*) _tmp389_)) {
					ValaCCodeIdentifier* ctarget_destroy_notify = NULL;
					gchar* _tmp390_;
					gchar* _tmp391_;
					ValaCCodeIdentifier* _tmp392_;
					ValaCCodeIdentifier* _tmp393_;
					ValaHashMap* _tmp394_;
					ValaCCodeIdentifier* _tmp395_;
					_tmp390_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
					_tmp391_ = _tmp390_;
					_tmp392_ = vala_ccode_identifier_new (_tmp391_);
					_tmp393_ = _tmp392_;
					_g_free0 (_tmp391_);
					ctarget_destroy_notify = _tmp393_;
					_tmp394_ = carg_map;
					_tmp395_ = ctarget_destroy_notify;
					vala_map_set ((ValaMap*) _tmp394_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp395_);
					_vala_ccode_node_unref0 (ctarget_destroy_notify);
				}
				_vala_ccode_node_unref0 (ctarget);
			}
			_vala_code_node_unref0 (deleg_type);
		} else {
			ValaDataType* _tmp396_;
			ValaDataType* _tmp397_;
			_tmp396_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp397_ = _tmp396_;
			if (vala_data_type_is_real_non_null_struct_type (_tmp397_)) {
				ValaHashMap* _tmp398_;
				ValaCCodeIdentifier* _tmp399_;
				ValaCCodeIdentifier* _tmp400_;
				_tmp398_ = carg_map;
				_tmp399_ = vala_ccode_identifier_new ("result");
				_tmp400_ = _tmp399_;
				vala_map_set ((ValaMap*) _tmp398_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), (ValaCCodeExpression*) _tmp400_);
				_vala_ccode_node_unref0 (_tmp400_);
			}
		}
	}
	_tmp401_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) m);
	_tmp402_ = _tmp401_;
	if (_tmp402_) {
		ValaHashMap* _tmp403_;
		ValaCCodeIdentifier* _tmp404_;
		ValaCCodeIdentifier* _tmp405_;
		_tmp403_ = carg_map;
		_tmp404_ = vala_ccode_identifier_new ("error");
		_tmp405_ = _tmp404_;
		vala_map_set ((ValaMap*) _tmp403_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) m), FALSE)), (ValaCCodeExpression*) _tmp405_);
		_vala_ccode_node_unref0 (_tmp405_);
	}
	_tmp406_ = vala_get_ccode_name ((ValaCodeNode*) m);
	_tmp407_ = _tmp406_;
	_tmp408_ = vala_ccode_identifier_new (_tmp407_);
	_tmp409_ = _tmp408_;
	_tmp410_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp409_);
	_tmp411_ = _tmp410_;
	_vala_ccode_node_unref0 (_tmp409_);
	_g_free0 (_tmp407_);
	ccall = _tmp411_;
	last_pos = -1;
	while (TRUE) {
		ValaCCodeFunctionCall* _tmp422_;
		ValaHashMap* _tmp423_;
		gpointer _tmp424_;
		ValaCCodeExpression* _tmp425_;
		min_pos = -1;
		{
			ValaIterator* _pos_it = NULL;
			ValaHashMap* _tmp412_;
			ValaSet* _tmp413_;
			ValaSet* _tmp414_;
			ValaIterator* _tmp415_;
			ValaIterator* _tmp416_;
			_tmp412_ = carg_map;
			_tmp413_ = vala_map_get_keys ((ValaMap*) _tmp412_);
			_tmp414_ = _tmp413_;
			_tmp415_ = vala_iterable_iterator ((ValaIterable*) _tmp414_);
			_tmp416_ = _tmp415_;
			_vala_iterable_unref0 (_tmp414_);
			_pos_it = _tmp416_;
			while (TRUE) {
				ValaIterator* _tmp417_;
				gint pos = 0;
				ValaIterator* _tmp418_;
				gpointer _tmp419_;
				gboolean _tmp420_ = FALSE;
				_tmp417_ = _pos_it;
				if (!vala_iterator_next (_tmp417_)) {
					break;
				}
				_tmp418_ = _pos_it;
				_tmp419_ = vala_iterator_get (_tmp418_);
				pos = (gint) ((gintptr) _tmp419_);
				if (pos > last_pos) {
					gboolean _tmp421_ = FALSE;
					if (min_pos == -1) {
						_tmp421_ = TRUE;
					} else {
						_tmp421_ = pos < min_pos;
					}
					_tmp420_ = _tmp421_;
				} else {
					_tmp420_ = FALSE;
				}
				if (_tmp420_) {
					min_pos = pos;
				}
			}
			_vala_iterator_unref0 (_pos_it);
		}
		if (min_pos == -1) {
			break;
		}
		_tmp422_ = ccall;
		_tmp423_ = carg_map;
		_tmp424_ = vala_map_get ((ValaMap*) _tmp423_, (gpointer) ((gintptr) min_pos));
		_tmp425_ = (ValaCCodeExpression*) _tmp424_;
		vala_ccode_function_call_add_argument (_tmp422_, _tmp425_);
		_vala_ccode_node_unref0 (_tmp425_);
		last_pos = min_pos;
	}
	_tmp426_ = vala_method_get_coroutine (m);
	_tmp427_ = _tmp426_;
	if (_tmp427_) {
		ValaCCodeFunctionCall* _tmp428_;
		ValaCCodeConstant* _tmp429_;
		ValaCCodeConstant* _tmp430_;
		ValaCCodeFunctionCall* _tmp431_;
		ValaCCodeConstant* _tmp432_;
		ValaCCodeConstant* _tmp433_;
		_tmp428_ = ccall;
		_tmp429_ = vala_ccode_constant_new ("NULL");
		_tmp430_ = _tmp429_;
		vala_ccode_function_call_add_argument (_tmp428_, (ValaCCodeExpression*) _tmp430_);
		_vala_ccode_node_unref0 (_tmp430_);
		_tmp431_ = ccall;
		_tmp432_ = vala_ccode_constant_new ("NULL");
		_tmp433_ = _tmp432_;
		vala_ccode_function_call_add_argument (_tmp431_, (ValaCCodeExpression*) _tmp433_);
		_vala_ccode_node_unref0 (_tmp433_);
	}
	_tmp435_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp436_ = _tmp435_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp436_, VALA_TYPE_VOID_TYPE)) {
		_tmp434_ = TRUE;
	} else {
		ValaDataType* _tmp437_;
		ValaDataType* _tmp438_;
		_tmp437_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp438_ = _tmp437_;
		_tmp434_ = vala_data_type_is_real_non_null_struct_type (_tmp438_);
	}
	if (_tmp434_) {
		ValaCCodeFunction* _tmp439_;
		ValaCCodeFunction* _tmp440_;
		ValaCCodeFunctionCall* _tmp441_;
		gboolean _tmp442_ = FALSE;
		ValaDelegate* _tmp443_;
		ValaDataType* _tmp444_;
		ValaDataType* _tmp445_;
		_tmp439_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp440_ = _tmp439_;
		_tmp441_ = ccall;
		vala_ccode_function_add_expression (_tmp440_, (ValaCCodeExpression*) _tmp441_);
		_tmp443_ = d;
		_tmp444_ = vala_callable_get_return_type ((ValaCallable*) _tmp443_);
		_tmp445_ = _tmp444_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp445_, VALA_TYPE_VOID_TYPE)) {
			_tmp442_ = TRUE;
		} else {
			ValaDelegate* _tmp446_;
			ValaDataType* _tmp447_;
			ValaDataType* _tmp448_;
			_tmp446_ = d;
			_tmp447_ = vala_callable_get_return_type ((ValaCallable*) _tmp446_);
			_tmp448_ = _tmp447_;
			_tmp442_ = vala_data_type_is_real_non_null_struct_type (_tmp448_);
		}
		if (!_tmp442_) {
			ValaCCodeFunction* _tmp449_;
			ValaCCodeFunction* _tmp450_;
			ValaDataType* _tmp451_;
			gchar* _tmp452_;
			gchar* _tmp453_;
			ValaDelegate* _tmp454_;
			ValaDataType* _tmp455_;
			ValaDataType* _tmp456_;
			ValaCCodeExpression* _tmp457_;
			ValaCCodeExpression* _tmp458_;
			ValaCCodeVariableDeclarator* _tmp459_;
			ValaCCodeVariableDeclarator* _tmp460_;
			_tmp449_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp450_ = _tmp449_;
			_tmp451_ = creturn_type;
			_tmp452_ = vala_get_ccode_name ((ValaCodeNode*) _tmp451_);
			_tmp453_ = _tmp452_;
			_tmp454_ = d;
			_tmp455_ = vala_callable_get_return_type ((ValaCallable*) _tmp454_);
			_tmp456_ = _tmp455_;
			_tmp457_ = vala_ccode_base_module_default_value_for_type ((ValaCCodeBaseModule*) self, _tmp456_, TRUE, FALSE);
			_tmp458_ = _tmp457_;
			_tmp459_ = vala_ccode_variable_declarator_new ("result", _tmp458_, NULL);
			_tmp460_ = _tmp459_;
			vala_ccode_function_add_declaration (_tmp450_, _tmp453_, (ValaCCodeDeclarator*) _tmp460_, 0);
			_vala_ccode_node_unref0 (_tmp460_);
			_vala_ccode_node_unref0 (_tmp458_);
			_g_free0 (_tmp453_);
		}
	} else {
		ValaCCodeExpression* _result_ = NULL;
		ValaCCodeFunctionCall* _tmp461_;
		ValaCCodeExpression* _tmp462_;
		ValaDelegate* _tmp463_;
		ValaDataType* _tmp464_;
		ValaDataType* _tmp465_;
		ValaCCodeFunction* _tmp470_;
		ValaCCodeFunction* _tmp471_;
		ValaDataType* _tmp472_;
		gchar* _tmp473_;
		gchar* _tmp474_;
		ValaCCodeExpression* _tmp475_;
		ValaCCodeVariableDeclarator* _tmp476_;
		ValaCCodeVariableDeclarator* _tmp477_;
		_tmp461_ = ccall;
		_tmp462_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp461_);
		_result_ = _tmp462_;
		_tmp463_ = d;
		_tmp464_ = vala_callable_get_return_type ((ValaCallable*) _tmp463_);
		_tmp465_ = _tmp464_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp465_, VALA_TYPE_GENERIC_TYPE)) {
			ValaCCodeExpression* _tmp466_;
			ValaDataType* _tmp467_;
			ValaDataType* _tmp468_;
			ValaCCodeExpression* _tmp469_;
			_tmp466_ = _result_;
			_tmp467_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp468_ = _tmp467_;
			_tmp469_ = vala_ccode_base_module_convert_to_generic_pointer ((ValaCCodeBaseModule*) self, _tmp466_, _tmp468_);
			_vala_ccode_node_unref0 (_result_);
			_result_ = _tmp469_;
		}
		_tmp470_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp471_ = _tmp470_;
		_tmp472_ = creturn_type;
		_tmp473_ = vala_get_ccode_name ((ValaCodeNode*) _tmp472_);
		_tmp474_ = _tmp473_;
		_tmp475_ = _result_;
		_tmp476_ = vala_ccode_variable_declarator_new ("result", _tmp475_, NULL);
		_tmp477_ = _tmp476_;
		vala_ccode_function_add_declaration (_tmp471_, _tmp474_, (ValaCCodeDeclarator*) _tmp477_, 0);
		_vala_ccode_node_unref0 (_tmp477_);
		_g_free0 (_tmp474_);
		_vala_ccode_node_unref0 (_result_);
	}
	_tmp479_ = d;
	_tmp480_ = vala_delegate_get_has_target (_tmp479_);
	_tmp481_ = _tmp480_;
	if (_tmp481_) {
		gboolean _tmp482_;
		gboolean _tmp483_;
		_tmp482_ = vala_delegate_type_get_is_called_once (dt);
		_tmp483_ = _tmp482_;
		_tmp478_ = _tmp483_;
	} else {
		_tmp478_ = FALSE;
	}
	if (_tmp478_) {
		ValaCCodeExpression* destroy_notify = NULL;
		gboolean _tmp484_;
		gboolean _tmp485_;
		ValaCCodeExpression* _tmp510_;
		destroy_notify = NULL;
		_tmp484_ = vala_method_get_closure (m);
		_tmp485_ = _tmp484_;
		if (_tmp485_) {
			gint block_id = 0;
			ValaBlock* _tmp486_;
			ValaBlock* _tmp487_;
			gchar* _tmp488_;
			gchar* _tmp489_;
			ValaCCodeIdentifier* _tmp490_;
			_tmp486_ = vala_ccode_base_module_get_current_closure_block ((ValaCCodeBaseModule*) self);
			_tmp487_ = _tmp486_;
			block_id = vala_ccode_base_module_get_block_id ((ValaCCodeBaseModule*) self, _tmp487_);
			_tmp488_ = g_strdup_printf ("block%d_data_unref", block_id);
			_tmp489_ = _tmp488_;
			_tmp490_ = vala_ccode_identifier_new (_tmp489_);
			_vala_ccode_node_unref0 (destroy_notify);
			destroy_notify = (ValaCCodeExpression*) _tmp490_;
			_g_free0 (_tmp489_);
		} else {
			gboolean _tmp491_ = FALSE;
			gboolean _tmp492_ = FALSE;
			gboolean _tmp493_ = FALSE;
			ValaDataType* _tmp494_;
			_tmp494_ = vala_ccode_base_module_get_this_type ((ValaCCodeBaseModule*) self);
			if (_tmp494_ != NULL) {
				ValaMemberBinding _tmp495_;
				ValaMemberBinding _tmp496_;
				_tmp495_ = vala_method_get_binding (m);
				_tmp496_ = _tmp495_;
				_tmp493_ = _tmp496_ != VALA_MEMBER_BINDING_STATIC;
			} else {
				_tmp493_ = FALSE;
			}
			if (_tmp493_) {
				gboolean _tmp497_;
				gboolean _tmp498_;
				_tmp497_ = vala_method_get_is_async_callback (m);
				_tmp498_ = _tmp497_;
				_tmp492_ = !_tmp498_;
			} else {
				_tmp492_ = FALSE;
			}
			if (_tmp492_) {
				ValaParameter* _tmp499_;
				ValaParameter* _tmp500_;
				ValaDataType* _tmp501_;
				ValaDataType* _tmp502_;
				ValaTypeSymbol* _tmp503_;
				ValaTypeSymbol* _tmp504_;
				_tmp499_ = vala_method_get_this_parameter (m);
				_tmp500_ = _tmp499_;
				_tmp501_ = vala_variable_get_variable_type ((ValaVariable*) _tmp500_);
				_tmp502_ = _tmp501_;
				_tmp503_ = vala_data_type_get_type_symbol (_tmp502_);
				_tmp504_ = _tmp503_;
				_tmp491_ = vala_is_reference_counting (_tmp504_);
			} else {
				_tmp491_ = FALSE;
			}
			if (_tmp491_) {
				ValaParameter* _tmp505_;
				ValaParameter* _tmp506_;
				ValaDataType* _tmp507_;
				ValaDataType* _tmp508_;
				ValaCCodeExpression* _tmp509_;
				_tmp505_ = vala_method_get_this_parameter (m);
				_tmp506_ = _tmp505_;
				_tmp507_ = vala_variable_get_variable_type ((ValaVariable*) _tmp506_);
				_tmp508_ = _tmp507_;
				_tmp509_ = vala_ccode_base_module_get_destroy_func_expression ((ValaCCodeBaseModule*) self, _tmp508_, FALSE);
				_vala_ccode_node_unref0 (destroy_notify);
				destroy_notify = _tmp509_;
			}
		}
		_tmp510_ = destroy_notify;
		if (_tmp510_ != NULL) {
			ValaCCodeFunctionCall* unref_call = NULL;
			ValaCCodeExpression* _tmp511_;
			ValaCCodeFunctionCall* _tmp512_;
			ValaCCodeFunctionCall* _tmp513_;
			ValaCCodeIdentifier* _tmp514_;
			ValaCCodeIdentifier* _tmp515_;
			ValaCCodeFunction* _tmp516_;
			ValaCCodeFunction* _tmp517_;
			ValaCCodeFunctionCall* _tmp518_;
			_tmp511_ = destroy_notify;
			_tmp512_ = vala_ccode_function_call_new (_tmp511_);
			unref_call = _tmp512_;
			_tmp513_ = unref_call;
			_tmp514_ = vala_ccode_identifier_new ("self");
			_tmp515_ = _tmp514_;
			vala_ccode_function_call_add_argument (_tmp513_, (ValaCCodeExpression*) _tmp515_);
			_vala_ccode_node_unref0 (_tmp515_);
			_tmp516_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp517_ = _tmp516_;
			_tmp518_ = unref_call;
			vala_ccode_function_add_expression (_tmp517_, (ValaCCodeExpression*) _tmp518_);
			_vala_ccode_node_unref0 (unref_call);
		}
		_vala_ccode_node_unref0 (destroy_notify);
	}
	_tmp521_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp522_ = _tmp521_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp522_, VALA_TYPE_VOID_TYPE)) {
		_tmp520_ = TRUE;
	} else {
		ValaDataType* _tmp523_;
		ValaDataType* _tmp524_;
		_tmp523_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp524_ = _tmp523_;
		_tmp520_ = vala_data_type_is_real_non_null_struct_type (_tmp524_);
	}
	if (!_tmp520_) {
		_tmp519_ = TRUE;
	} else {
		gboolean _tmp525_ = FALSE;
		ValaDelegate* _tmp526_;
		ValaDataType* _tmp527_;
		ValaDataType* _tmp528_;
		_tmp526_ = d;
		_tmp527_ = vala_callable_get_return_type ((ValaCallable*) _tmp526_);
		_tmp528_ = _tmp527_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp528_, VALA_TYPE_VOID_TYPE)) {
			_tmp525_ = TRUE;
		} else {
			ValaDelegate* _tmp529_;
			ValaDataType* _tmp530_;
			ValaDataType* _tmp531_;
			_tmp529_ = d;
			_tmp530_ = vala_callable_get_return_type ((ValaCallable*) _tmp529_);
			_tmp531_ = _tmp530_;
			_tmp525_ = vala_data_type_is_real_non_null_struct_type (_tmp531_);
		}
		_tmp519_ = !_tmp525_;
	}
	if (_tmp519_) {
		ValaCCodeFunction* _tmp532_;
		ValaCCodeFunction* _tmp533_;
		ValaCCodeIdentifier* _tmp534_;
		ValaCCodeIdentifier* _tmp535_;
		_tmp532_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp533_ = _tmp532_;
		_tmp534_ = vala_ccode_identifier_new ("result");
		_tmp535_ = _tmp534_;
		vala_ccode_function_add_return (_tmp533_, (ValaCCodeExpression*) _tmp535_);
		_vala_ccode_node_unref0 (_tmp535_);
	}
	vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
	_tmp536_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp537_ = function;
	vala_ccode_file_add_function_declaration (_tmp536_, _tmp537_);
	_tmp538_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp539_ = function;
	vala_ccode_file_add_function (_tmp538_, _tmp539_);
	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;
}

