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

/* valaccodestructmodule.vala
 *
 * Copyright (C) 2006-2009  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 <glib.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>
#include <glib-object.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_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
#define _vala_typeregister_function_unref0(var) ((var == NULL) ? NULL : (var = (vala_typeregister_function_unref (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _vala_ccode_base_module_emit_context_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_base_module_emit_context_unref (var), NULL)))
#define _vala_target_value_unref0(var) ((var == NULL) ? NULL : (var = (vala_target_value_unref (var), NULL)))

static gpointer vala_ccode_struct_module_parent_class = NULL;

static void vala_ccode_struct_module_real_generate_struct_declaration (ValaCCodeBaseModule* base,
                                                                ValaStruct* st,
                                                                ValaCCodeFile* decl_space);
static void vala_ccode_struct_module_generate_auto_cleanup_clear (ValaCCodeStructModule* self,
                                                           ValaStruct* st,
                                                           ValaCCodeFile* decl_space);
static void vala_ccode_struct_module_real_visit_struct (ValaCodeVisitor* base,
                                                 ValaStruct* st);
static void vala_ccode_struct_module_begin_struct_destroy_function (ValaCCodeStructModule* self,
                                                             ValaStruct* st);
static void vala_ccode_struct_module_add_struct_copy_function (ValaCCodeStructModule* self,
                                                        ValaStruct* st);
static void vala_ccode_struct_module_add_struct_destroy_function (ValaCCodeStructModule* self,
                                                           ValaStruct* st);
static void vala_ccode_struct_module_add_struct_dup_function (ValaCCodeStructModule* self,
                                                       ValaStruct* st);
static void vala_ccode_struct_module_add_struct_free_function (ValaCCodeStructModule* self,
                                                        ValaStruct* st);
static GType vala_ccode_struct_module_get_type_once (void);

static void
vala_ccode_struct_module_real_generate_struct_declaration (ValaCCodeBaseModule* base,
                                                           ValaStruct* st,
                                                           ValaCCodeFile* decl_space)
{
	ValaCCodeStructModule * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	ValaStruct* _tmp3_;
	ValaStruct* _tmp4_;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	ValaCodeContext* _tmp35_;
	ValaCodeContext* _tmp36_;
	ValaProfile _tmp37_;
	ValaProfile _tmp38_;
	ValaStruct* _tmp57_;
	ValaStruct* _tmp58_;
	ValaCCodeStruct* instance_struct = NULL;
	gchar* _tmp79_;
	gchar* _tmp80_;
	gchar* _tmp81_;
	gchar* _tmp82_;
	ValaCCodeStruct* _tmp83_;
	ValaCCodeStruct* _tmp84_;
	ValaVersionAttribute* _tmp85_;
	ValaVersionAttribute* _tmp86_;
	gboolean _tmp87_;
	gboolean _tmp88_;
	ValaStruct* _tmp110_;
	ValaStruct* _tmp111_;
	ValaCCodeFunction* function = NULL;
	gchar* _tmp113_;
	gchar* _tmp114_;
	gchar* _tmp115_;
	gchar* _tmp116_;
	gchar* _tmp117_;
	gchar* _tmp118_;
	ValaCCodeFunction* _tmp119_;
	ValaCCodeFunction* _tmp120_;
	ValaCCodeFunction* _tmp132_;
	gchar* _tmp133_;
	gchar* _tmp134_;
	gchar* _tmp135_;
	gchar* _tmp136_;
	gchar* _tmp137_;
	gchar* _tmp138_;
	ValaCCodeParameter* _tmp139_;
	ValaCCodeParameter* _tmp140_;
	ValaCCodeFunction* _tmp141_;
	gchar* _tmp142_;
	gchar* _tmp143_;
	ValaCCodeFunction* _tmp144_;
	ValaCCodeFunction* _tmp153_;
	gchar* _tmp154_;
	gchar* _tmp155_;
	gchar* _tmp156_;
	gchar* _tmp157_;
	ValaCCodeParameter* _tmp158_;
	ValaCCodeParameter* _tmp159_;
	ValaCCodeFunction* _tmp160_;
	ValaCodeContext* _tmp208_;
	ValaCodeContext* _tmp209_;
	ValaProfile _tmp210_;
	ValaProfile _tmp211_;
	self = (ValaCCodeStructModule*) base;
	g_return_if_fail (st != NULL);
	g_return_if_fail (decl_space != NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_ccode_base_module_add_symbol_declaration ((ValaCCodeBaseModule*) self, decl_space, (ValaSymbol*) st, _tmp1_);
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = vala_struct_get_base_struct (st);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != NULL) {
		ValaStruct* _tmp5_;
		ValaStruct* _tmp6_;
		_tmp5_ = vala_struct_get_base_struct (st);
		_tmp6_ = _tmp5_;
		vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, _tmp6_, decl_space);
	} else {
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp7_ = vala_symbol_get_external_package ((ValaSymbol*) st);
		_tmp8_ = _tmp7_;
		if (!_tmp8_) {
			gboolean _tmp9_ = FALSE;
			if (vala_code_node_has_attribute ((ValaCodeNode*) st, "SimpleType")) {
				_tmp9_ = !vala_code_node_has_attribute_argument ((ValaCodeNode*) st, "CCode", "type_id");
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				vala_code_node_set_attribute_bool ((ValaCodeNode*) st, "CCode", "has_type_id", FALSE, NULL);
			}
		}
	}
	if (vala_struct_is_boolean_type (st)) {
		_tmp11_ = TRUE;
	} else {
		_tmp11_ = vala_struct_is_integer_type (st);
	}
	if (_tmp11_) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = vala_struct_is_floating_type (st);
	}
	if (_tmp10_) {
		gchar* typename = NULL;
		ValaStruct* _tmp12_;
		ValaStruct* _tmp13_;
		const gchar* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		ValaCCodeVariableDeclarator* _tmp31_;
		ValaCCodeVariableDeclarator* _tmp32_;
		ValaCCodeTypeDefinition* _tmp33_;
		ValaCCodeTypeDefinition* _tmp34_;
		_tmp12_ = vala_struct_get_base_struct (st);
		_tmp13_ = _tmp12_;
		if (_tmp13_ != NULL) {
			ValaStruct* _tmp14_;
			ValaStruct* _tmp15_;
			gchar* _tmp16_;
			_tmp14_ = vala_struct_get_base_struct (st);
			_tmp15_ = _tmp14_;
			_tmp16_ = vala_get_ccode_name ((ValaCodeNode*) _tmp15_);
			_g_free0 (typename);
			typename = _tmp16_;
		} else {
			if (vala_struct_is_boolean_type (st)) {
				gchar* _tmp17_;
				vala_ccode_file_add_include (decl_space, "stdbool.h", FALSE);
				_tmp17_ = g_strdup ("bool");
				_g_free0 (typename);
				typename = _tmp17_;
			} else {
				if (vala_struct_is_integer_type (st)) {
					const gchar* _tmp18_ = NULL;
					gboolean _tmp19_;
					gboolean _tmp20_;
					gint _tmp21_;
					gint _tmp22_;
					gchar* _tmp23_;
					vala_ccode_file_add_include (decl_space, "stdint.h", FALSE);
					_tmp19_ = vala_struct_get_signed (st);
					_tmp20_ = _tmp19_;
					if (_tmp20_) {
						_tmp18_ = "";
					} else {
						_tmp18_ = "u";
					}
					_tmp21_ = vala_struct_get_width (st);
					_tmp22_ = _tmp21_;
					_tmp23_ = g_strdup_printf ("%sint%d_t", _tmp18_, _tmp22_);
					_g_free0 (typename);
					typename = _tmp23_;
				} else {
					if (vala_struct_is_floating_type (st)) {
						const gchar* _tmp24_ = NULL;
						gint _tmp25_;
						gint _tmp26_;
						gchar* _tmp27_;
						_tmp25_ = vala_struct_get_width (st);
						_tmp26_ = _tmp25_;
						if (_tmp26_ == 64) {
							_tmp24_ = "double";
						} else {
							_tmp24_ = "float";
						}
						_tmp27_ = g_strdup (_tmp24_);
						_g_free0 (typename);
						typename = _tmp27_;
					} else {
						g_assert_not_reached ();
					}
				}
			}
		}
		_tmp28_ = typename;
		_tmp29_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp30_ = _tmp29_;
		_tmp31_ = vala_ccode_variable_declarator_new (_tmp30_, NULL, NULL);
		_tmp32_ = _tmp31_;
		_tmp33_ = vala_ccode_type_definition_new (_tmp28_, (ValaCCodeDeclarator*) _tmp32_);
		_tmp34_ = _tmp33_;
		vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp34_);
		_vala_ccode_node_unref0 (_tmp34_);
		_vala_ccode_node_unref0 (_tmp32_);
		_g_free0 (_tmp30_);
		_g_free0 (typename);
		return;
	}
	_tmp35_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
	_tmp36_ = _tmp35_;
	_tmp37_ = vala_code_context_get_profile (_tmp36_);
	_tmp38_ = _tmp37_;
	if (_tmp38_ == VALA_PROFILE_GOBJECT) {
		if (vala_get_ccode_has_type_id ((ValaTypeSymbol*) st)) {
			ValaCCodeNewline* _tmp39_;
			ValaCCodeNewline* _tmp40_;
			gchar* macro = NULL;
			gchar* _tmp41_;
			gchar* _tmp42_;
			gchar* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			gchar* _tmp46_;
			const gchar* _tmp47_;
			ValaCCodeMacroReplacement* _tmp48_;
			ValaCCodeMacroReplacement* _tmp49_;
			ValaStructRegisterFunction* type_fun = NULL;
			ValaStructRegisterFunction* _tmp50_;
			ValaStructRegisterFunction* _tmp51_;
			ValaCodeContext* _tmp52_;
			ValaCodeContext* _tmp53_;
			ValaStructRegisterFunction* _tmp54_;
			ValaCCodeFragment* _tmp55_;
			ValaCCodeFragment* _tmp56_;
			vala_ccode_file_add_include (decl_space, "glib-object.h", FALSE);
			_tmp39_ = vala_ccode_newline_new ();
			_tmp40_ = _tmp39_;
			vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp40_);
			_vala_ccode_node_unref0 (_tmp40_);
			_tmp41_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) st, NULL);
			_tmp42_ = _tmp41_;
			_tmp43_ = g_strdup_printf ("(%s_get_type ())", _tmp42_);
			_tmp44_ = _tmp43_;
			_g_free0 (_tmp42_);
			macro = _tmp44_;
			_tmp45_ = vala_get_ccode_type_id ((ValaCodeNode*) st);
			_tmp46_ = _tmp45_;
			_tmp47_ = macro;
			_tmp48_ = vala_ccode_macro_replacement_new (_tmp46_, _tmp47_);
			_tmp49_ = _tmp48_;
			vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp49_);
			_vala_ccode_node_unref0 (_tmp49_);
			_g_free0 (_tmp46_);
			_tmp50_ = vala_struct_register_function_new (st);
			type_fun = _tmp50_;
			_tmp51_ = type_fun;
			_tmp52_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
			_tmp53_ = _tmp52_;
			vala_typeregister_function_init_from_type ((ValaTypeRegisterFunction*) _tmp51_, _tmp53_, FALSE, TRUE);
			_tmp54_ = type_fun;
			_tmp55_ = vala_typeregister_function_get_declaration ((ValaTypeRegisterFunction*) _tmp54_);
			_tmp56_ = _tmp55_;
			vala_ccode_file_add_type_member_declaration (decl_space, (ValaCCodeNode*) _tmp56_);
			_vala_ccode_node_unref0 (_tmp56_);
			((ValaCCodeBaseModule*) self)->requires_vala_extern = TRUE;
			_vala_typeregister_function_unref0 (type_fun);
			_g_free0 (macro);
		}
	}
	_tmp57_ = vala_struct_get_base_struct (st);
	_tmp58_ = _tmp57_;
	if (_tmp58_ == NULL) {
		gchar* _tmp59_;
		gchar* _tmp60_;
		gchar* _tmp61_;
		gchar* _tmp62_;
		gchar* _tmp63_;
		gchar* _tmp64_;
		ValaCCodeVariableDeclarator* _tmp65_;
		ValaCCodeVariableDeclarator* _tmp66_;
		ValaCCodeTypeDefinition* _tmp67_;
		ValaCCodeTypeDefinition* _tmp68_;
		_tmp59_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp60_ = _tmp59_;
		_tmp61_ = g_strdup_printf ("struct _%s", _tmp60_);
		_tmp62_ = _tmp61_;
		_tmp63_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp64_ = _tmp63_;
		_tmp65_ = vala_ccode_variable_declarator_new (_tmp64_, NULL, NULL);
		_tmp66_ = _tmp65_;
		_tmp67_ = vala_ccode_type_definition_new (_tmp62_, (ValaCCodeDeclarator*) _tmp66_);
		_tmp68_ = _tmp67_;
		vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp68_);
		_vala_ccode_node_unref0 (_tmp68_);
		_vala_ccode_node_unref0 (_tmp66_);
		_g_free0 (_tmp64_);
		_g_free0 (_tmp62_);
		_g_free0 (_tmp60_);
	} else {
		ValaStruct* _tmp69_;
		ValaStruct* _tmp70_;
		gchar* _tmp71_;
		gchar* _tmp72_;
		gchar* _tmp73_;
		gchar* _tmp74_;
		ValaCCodeVariableDeclarator* _tmp75_;
		ValaCCodeVariableDeclarator* _tmp76_;
		ValaCCodeTypeDefinition* _tmp77_;
		ValaCCodeTypeDefinition* _tmp78_;
		_tmp69_ = vala_struct_get_base_struct (st);
		_tmp70_ = _tmp69_;
		_tmp71_ = vala_get_ccode_name ((ValaCodeNode*) _tmp70_);
		_tmp72_ = _tmp71_;
		_tmp73_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp74_ = _tmp73_;
		_tmp75_ = vala_ccode_variable_declarator_new (_tmp74_, NULL, NULL);
		_tmp76_ = _tmp75_;
		_tmp77_ = vala_ccode_type_definition_new (_tmp72_, (ValaCCodeDeclarator*) _tmp76_);
		_tmp78_ = _tmp77_;
		vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp78_);
		_vala_ccode_node_unref0 (_tmp78_);
		_vala_ccode_node_unref0 (_tmp76_);
		_g_free0 (_tmp74_);
		_g_free0 (_tmp72_);
	}
	_tmp79_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp80_ = _tmp79_;
	_tmp81_ = g_strdup_printf ("_%s", _tmp80_);
	_tmp82_ = _tmp81_;
	_tmp83_ = vala_ccode_struct_new (_tmp82_);
	_tmp84_ = _tmp83_;
	_g_free0 (_tmp82_);
	_g_free0 (_tmp80_);
	instance_struct = _tmp84_;
	_tmp85_ = vala_symbol_get_version ((ValaSymbol*) st);
	_tmp86_ = _tmp85_;
	_tmp87_ = vala_version_attribute_get_deprecated (_tmp86_);
	_tmp88_ = _tmp87_;
	if (_tmp88_) {
		ValaCodeContext* _tmp89_;
		ValaCodeContext* _tmp90_;
		ValaProfile _tmp91_;
		ValaProfile _tmp92_;
		ValaCCodeStruct* _tmp93_;
		ValaCCodeStruct* _tmp94_;
		ValaCCodeModifiers _tmp95_;
		ValaCCodeModifiers _tmp96_;
		_tmp89_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp90_ = _tmp89_;
		_tmp91_ = vala_code_context_get_profile (_tmp90_);
		_tmp92_ = _tmp91_;
		if (_tmp92_ == VALA_PROFILE_GOBJECT) {
			vala_ccode_file_add_include (decl_space, "glib.h", FALSE);
		}
		_tmp93_ = instance_struct;
		_tmp94_ = instance_struct;
		_tmp95_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) _tmp94_);
		_tmp96_ = _tmp95_;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp94_, _tmp96_ | VALA_CCODE_MODIFIERS_DEPRECATED);
	}
	{
		ValaList* _f_list = NULL;
		ValaList* _tmp97_;
		gint _f_size = 0;
		ValaList* _tmp98_;
		gint _tmp99_;
		gint _tmp100_;
		gint _f_index = 0;
		_tmp97_ = vala_struct_get_fields (st);
		_f_list = _tmp97_;
		_tmp98_ = _f_list;
		_tmp99_ = vala_collection_get_size ((ValaCollection*) _tmp98_);
		_tmp100_ = _tmp99_;
		_f_size = _tmp100_;
		_f_index = -1;
		while (TRUE) {
			gint _tmp101_;
			gint _tmp102_;
			ValaField* f = NULL;
			ValaList* _tmp103_;
			gpointer _tmp104_;
			ValaField* _tmp105_;
			ValaMemberBinding _tmp106_;
			ValaMemberBinding _tmp107_;
			_f_index = _f_index + 1;
			_tmp101_ = _f_index;
			_tmp102_ = _f_size;
			if (!(_tmp101_ < _tmp102_)) {
				break;
			}
			_tmp103_ = _f_list;
			_tmp104_ = vala_list_get (_tmp103_, _f_index);
			f = (ValaField*) _tmp104_;
			_tmp105_ = f;
			_tmp106_ = vala_field_get_binding (_tmp105_);
			_tmp107_ = _tmp106_;
			if (_tmp107_ == VALA_MEMBER_BINDING_INSTANCE) {
				ValaCCodeStruct* _tmp108_;
				ValaField* _tmp109_;
				_tmp108_ = instance_struct;
				_tmp109_ = f;
				vala_ccode_base_module_append_field ((ValaCCodeBaseModule*) self, _tmp108_, _tmp109_, decl_space);
			}
			_vala_code_node_unref0 (f);
		}
	}
	_tmp110_ = vala_struct_get_base_struct (st);
	_tmp111_ = _tmp110_;
	if (_tmp111_ == NULL) {
		ValaCCodeStruct* _tmp112_;
		_tmp112_ = instance_struct;
		vala_ccode_file_add_type_definition (decl_space, (ValaCCodeNode*) _tmp112_);
	}
	if (vala_struct_is_simple_type (st)) {
		_vala_ccode_node_unref0 (instance_struct);
		return;
	}
	_tmp113_ = vala_get_ccode_dup_function ((ValaTypeSymbol*) st);
	_tmp114_ = _tmp113_;
	_tmp115_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp116_ = _tmp115_;
	_tmp117_ = g_strconcat (_tmp116_, "*", NULL);
	_tmp118_ = _tmp117_;
	_tmp119_ = vala_ccode_function_new (_tmp114_, _tmp118_);
	_tmp120_ = _tmp119_;
	_g_free0 (_tmp118_);
	_g_free0 (_tmp116_);
	_g_free0 (_tmp114_);
	function = _tmp120_;
	if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
		ValaCCodeFunction* _tmp121_;
		_tmp121_ = function;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp121_, VALA_CCODE_MODIFIERS_STATIC);
	} else {
		gboolean _tmp122_ = FALSE;
		ValaCodeContext* _tmp123_;
		ValaCodeContext* _tmp124_;
		gboolean _tmp125_;
		gboolean _tmp126_;
		_tmp123_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp124_ = _tmp123_;
		_tmp125_ = vala_code_context_get_hide_internal (_tmp124_);
		_tmp126_ = _tmp125_;
		if (_tmp126_) {
			_tmp122_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
		} else {
			_tmp122_ = FALSE;
		}
		if (_tmp122_) {
			ValaCCodeFunction* _tmp127_;
			_tmp127_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp127_, VALA_CCODE_MODIFIERS_INTERNAL);
		} else {
			ValaCCodeFunction* _tmp128_;
			ValaCCodeFunction* _tmp129_;
			ValaCCodeModifiers _tmp130_;
			ValaCCodeModifiers _tmp131_;
			_tmp128_ = function;
			_tmp129_ = function;
			_tmp130_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) _tmp129_);
			_tmp131_ = _tmp130_;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp129_, _tmp131_ | VALA_CCODE_MODIFIERS_EXTERN);
			((ValaCCodeBaseModule*) self)->requires_vala_extern = TRUE;
		}
	}
	_tmp132_ = function;
	_tmp133_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp134_ = _tmp133_;
	_tmp135_ = g_strconcat ("const ", _tmp134_, NULL);
	_tmp136_ = _tmp135_;
	_tmp137_ = g_strconcat (_tmp136_, "*", NULL);
	_tmp138_ = _tmp137_;
	_tmp139_ = vala_ccode_parameter_new ("self", _tmp138_);
	_tmp140_ = _tmp139_;
	vala_ccode_function_add_parameter (_tmp132_, _tmp140_);
	_vala_ccode_node_unref0 (_tmp140_);
	_g_free0 (_tmp138_);
	_g_free0 (_tmp136_);
	_g_free0 (_tmp134_);
	_tmp141_ = function;
	vala_ccode_file_add_function_declaration (decl_space, _tmp141_);
	_tmp142_ = vala_get_ccode_free_function ((ValaTypeSymbol*) st);
	_tmp143_ = _tmp142_;
	_tmp144_ = vala_ccode_function_new (_tmp143_, "void");
	_vala_ccode_node_unref0 (function);
	function = _tmp144_;
	_g_free0 (_tmp143_);
	if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
		ValaCCodeFunction* _tmp145_;
		_tmp145_ = function;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp145_, VALA_CCODE_MODIFIERS_STATIC);
	} else {
		gboolean _tmp146_ = FALSE;
		ValaCodeContext* _tmp147_;
		ValaCodeContext* _tmp148_;
		gboolean _tmp149_;
		gboolean _tmp150_;
		_tmp147_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp148_ = _tmp147_;
		_tmp149_ = vala_code_context_get_hide_internal (_tmp148_);
		_tmp150_ = _tmp149_;
		if (_tmp150_) {
			_tmp146_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
		} else {
			_tmp146_ = FALSE;
		}
		if (_tmp146_) {
			ValaCCodeFunction* _tmp151_;
			_tmp151_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp151_, VALA_CCODE_MODIFIERS_INTERNAL);
		} else {
			ValaCCodeFunction* _tmp152_;
			_tmp152_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp152_, VALA_CCODE_MODIFIERS_EXTERN);
			((ValaCCodeBaseModule*) self)->requires_vala_extern = TRUE;
		}
	}
	_tmp153_ = function;
	_tmp154_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp155_ = _tmp154_;
	_tmp156_ = g_strconcat (_tmp155_, "*", NULL);
	_tmp157_ = _tmp156_;
	_tmp158_ = vala_ccode_parameter_new ("self", _tmp157_);
	_tmp159_ = _tmp158_;
	vala_ccode_function_add_parameter (_tmp153_, _tmp159_);
	_vala_ccode_node_unref0 (_tmp159_);
	_g_free0 (_tmp157_);
	_g_free0 (_tmp155_);
	_tmp160_ = function;
	vala_ccode_file_add_function_declaration (decl_space, _tmp160_);
	if (vala_struct_is_disposable (st)) {
		gchar* _tmp161_;
		gchar* _tmp162_;
		ValaCCodeFunction* _tmp163_;
		ValaCCodeFunction* _tmp172_;
		gchar* _tmp173_;
		gchar* _tmp174_;
		gchar* _tmp175_;
		gchar* _tmp176_;
		gchar* _tmp177_;
		gchar* _tmp178_;
		ValaCCodeParameter* _tmp179_;
		ValaCCodeParameter* _tmp180_;
		ValaCCodeFunction* _tmp181_;
		gchar* _tmp182_;
		gchar* _tmp183_;
		gchar* _tmp184_;
		gchar* _tmp185_;
		ValaCCodeParameter* _tmp186_;
		ValaCCodeParameter* _tmp187_;
		ValaCCodeFunction* _tmp188_;
		gchar* _tmp189_;
		gchar* _tmp190_;
		ValaCCodeFunction* _tmp191_;
		ValaCCodeFunction* _tmp200_;
		gchar* _tmp201_;
		gchar* _tmp202_;
		gchar* _tmp203_;
		gchar* _tmp204_;
		ValaCCodeParameter* _tmp205_;
		ValaCCodeParameter* _tmp206_;
		ValaCCodeFunction* _tmp207_;
		_tmp161_ = vala_get_ccode_copy_function ((ValaTypeSymbol*) st);
		_tmp162_ = _tmp161_;
		_tmp163_ = vala_ccode_function_new (_tmp162_, "void");
		_vala_ccode_node_unref0 (function);
		function = _tmp163_;
		_g_free0 (_tmp162_);
		if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
			ValaCCodeFunction* _tmp164_;
			_tmp164_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp164_, VALA_CCODE_MODIFIERS_STATIC);
		} else {
			gboolean _tmp165_ = FALSE;
			ValaCodeContext* _tmp166_;
			ValaCodeContext* _tmp167_;
			gboolean _tmp168_;
			gboolean _tmp169_;
			_tmp166_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
			_tmp167_ = _tmp166_;
			_tmp168_ = vala_code_context_get_hide_internal (_tmp167_);
			_tmp169_ = _tmp168_;
			if (_tmp169_) {
				_tmp165_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
			} else {
				_tmp165_ = FALSE;
			}
			if (_tmp165_) {
				ValaCCodeFunction* _tmp170_;
				_tmp170_ = function;
				vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp170_, VALA_CCODE_MODIFIERS_INTERNAL);
			} else {
				ValaCCodeFunction* _tmp171_;
				_tmp171_ = function;
				vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp171_, VALA_CCODE_MODIFIERS_EXTERN);
				((ValaCCodeBaseModule*) self)->requires_vala_extern = TRUE;
			}
		}
		_tmp172_ = function;
		_tmp173_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp174_ = _tmp173_;
		_tmp175_ = g_strconcat ("const ", _tmp174_, NULL);
		_tmp176_ = _tmp175_;
		_tmp177_ = g_strconcat (_tmp176_, "*", NULL);
		_tmp178_ = _tmp177_;
		_tmp179_ = vala_ccode_parameter_new ("self", _tmp178_);
		_tmp180_ = _tmp179_;
		vala_ccode_function_add_parameter (_tmp172_, _tmp180_);
		_vala_ccode_node_unref0 (_tmp180_);
		_g_free0 (_tmp178_);
		_g_free0 (_tmp176_);
		_g_free0 (_tmp174_);
		_tmp181_ = function;
		_tmp182_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp183_ = _tmp182_;
		_tmp184_ = g_strconcat (_tmp183_, "*", NULL);
		_tmp185_ = _tmp184_;
		_tmp186_ = vala_ccode_parameter_new ("dest", _tmp185_);
		_tmp187_ = _tmp186_;
		vala_ccode_function_add_parameter (_tmp181_, _tmp187_);
		_vala_ccode_node_unref0 (_tmp187_);
		_g_free0 (_tmp185_);
		_g_free0 (_tmp183_);
		_tmp188_ = function;
		vala_ccode_file_add_function_declaration (decl_space, _tmp188_);
		_tmp189_ = vala_get_ccode_destroy_function ((ValaTypeSymbol*) st);
		_tmp190_ = _tmp189_;
		_tmp191_ = vala_ccode_function_new (_tmp190_, "void");
		_vala_ccode_node_unref0 (function);
		function = _tmp191_;
		_g_free0 (_tmp190_);
		if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
			ValaCCodeFunction* _tmp192_;
			_tmp192_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp192_, VALA_CCODE_MODIFIERS_STATIC);
		} else {
			gboolean _tmp193_ = FALSE;
			ValaCodeContext* _tmp194_;
			ValaCodeContext* _tmp195_;
			gboolean _tmp196_;
			gboolean _tmp197_;
			_tmp194_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
			_tmp195_ = _tmp194_;
			_tmp196_ = vala_code_context_get_hide_internal (_tmp195_);
			_tmp197_ = _tmp196_;
			if (_tmp197_) {
				_tmp193_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
			} else {
				_tmp193_ = FALSE;
			}
			if (_tmp193_) {
				ValaCCodeFunction* _tmp198_;
				_tmp198_ = function;
				vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp198_, VALA_CCODE_MODIFIERS_INTERNAL);
			} else {
				ValaCCodeFunction* _tmp199_;
				_tmp199_ = function;
				vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp199_, VALA_CCODE_MODIFIERS_EXTERN);
				((ValaCCodeBaseModule*) self)->requires_vala_extern = TRUE;
			}
		}
		_tmp200_ = function;
		_tmp201_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp202_ = _tmp201_;
		_tmp203_ = g_strconcat (_tmp202_, "*", NULL);
		_tmp204_ = _tmp203_;
		_tmp205_ = vala_ccode_parameter_new ("self", _tmp204_);
		_tmp206_ = _tmp205_;
		vala_ccode_function_add_parameter (_tmp200_, _tmp206_);
		_vala_ccode_node_unref0 (_tmp206_);
		_g_free0 (_tmp204_);
		_g_free0 (_tmp202_);
		_tmp207_ = function;
		vala_ccode_file_add_function_declaration (decl_space, _tmp207_);
	}
	_tmp208_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
	_tmp209_ = _tmp208_;
	_tmp210_ = vala_code_context_get_profile (_tmp209_);
	_tmp211_ = _tmp210_;
	if (_tmp211_ == VALA_PROFILE_GOBJECT) {
		vala_ccode_struct_module_generate_auto_cleanup_clear (self, st, decl_space);
	}
	_vala_ccode_node_unref0 (function);
	_vala_ccode_node_unref0 (instance_struct);
}

static void
vala_ccode_struct_module_generate_auto_cleanup_clear (ValaCCodeStructModule* self,
                                                      ValaStruct* st,
                                                      ValaCCodeFile* decl_space)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (st != NULL);
	g_return_if_fail (decl_space != NULL);
	if (vala_struct_is_disposable (st)) {
		gboolean _tmp1_ = FALSE;
		gboolean _tmp2_ = FALSE;
		ValaCodeContext* _tmp3_;
		ValaCodeContext* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp3_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = vala_code_context_get_header_filename (_tmp4_);
		_tmp6_ = _tmp5_;
		if (_tmp6_ == NULL) {
			_tmp2_ = TRUE;
		} else {
			CCodeFileType _tmp7_;
			CCodeFileType _tmp8_;
			_tmp7_ = vala_ccode_file_get_file_type (decl_space);
			_tmp8_ = _tmp7_;
			_tmp2_ = _tmp8_ == CCODE_FILE_TYPE_PUBLIC_HEADER;
		}
		if (_tmp2_) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp9_ = FALSE;
			CCodeFileType _tmp10_;
			CCodeFileType _tmp11_;
			_tmp10_ = vala_ccode_file_get_file_type (decl_space);
			_tmp11_ = _tmp10_;
			if (_tmp11_ == CCODE_FILE_TYPE_INTERNAL_HEADER) {
				_tmp9_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
			} else {
				_tmp9_ = FALSE;
			}
			_tmp1_ = _tmp9_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* auto_cleanup_clear_func = NULL;
		gchar* _tmp12_;
		gboolean _tmp13_ = FALSE;
		const gchar* _tmp14_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		ValaCCodeIdentifier* _tmp23_;
		ValaCCodeIdentifier* _tmp24_;
		ValaCCodeNewline* _tmp25_;
		ValaCCodeNewline* _tmp26_;
		_tmp12_ = vala_get_ccode_destroy_function ((ValaTypeSymbol*) st);
		auto_cleanup_clear_func = _tmp12_;
		_tmp14_ = auto_cleanup_clear_func;
		if (_tmp14_ == NULL) {
			_tmp13_ = TRUE;
		} else {
			const gchar* _tmp15_;
			_tmp15_ = auto_cleanup_clear_func;
			_tmp13_ = g_strcmp0 (_tmp15_, "") == 0;
		}
		if (_tmp13_) {
			ValaSourceReference* _tmp16_;
			ValaSourceReference* _tmp17_;
			_tmp16_ = vala_code_node_get_source_reference ((ValaCodeNode*) st);
			_tmp17_ = _tmp16_;
			vala_report_error (_tmp17_, "internal error: auto_cleanup_clear_func not available");
		}
		_tmp18_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp19_ = _tmp18_;
		_tmp20_ = auto_cleanup_clear_func;
		_tmp21_ = g_strdup_printf ("G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (%s, %s)", _tmp19_, _tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = vala_ccode_identifier_new (_tmp22_);
		_tmp24_ = _tmp23_;
		vala_ccode_file_add_type_member_declaration (decl_space, (ValaCCodeNode*) _tmp24_);
		_vala_ccode_node_unref0 (_tmp24_);
		_g_free0 (_tmp22_);
		_g_free0 (_tmp19_);
		_tmp25_ = vala_ccode_newline_new ();
		_tmp26_ = _tmp25_;
		vala_ccode_file_add_type_member_declaration (decl_space, (ValaCCodeNode*) _tmp26_);
		_vala_ccode_node_unref0 (_tmp26_);
		_g_free0 (auto_cleanup_clear_func);
	}
}

static gpointer
_vala_ccode_base_module_emit_context_ref0 (gpointer self)
{
	return self ? vala_ccode_base_module_emit_context_ref (self) : NULL;
}

static void
vala_ccode_struct_module_real_visit_struct (ValaCodeVisitor* base,
                                            ValaStruct* st)
{
	ValaCCodeStructModule * self;
	ValaCCodeBaseModuleEmitContext* _tmp0_;
	ValaCCodeBaseModuleEmitContext* _tmp1_;
	ValaSourceReference* _tmp2_;
	ValaSourceReference* _tmp3_;
	ValaCCodeBaseModuleEmitContext* old_instance_finalize_context = NULL;
	ValaCCodeBaseModuleEmitContext* _tmp4_;
	ValaCCodeBaseModuleEmitContext* _tmp5_;
	ValaCCodeBaseModuleEmitContext* _tmp6_;
	ValaCCodeFile* _tmp7_;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	ValaCCodeBaseModuleEmitContext* _tmp14_;
	ValaCCodeBaseModuleEmitContext* _tmp15_;
	self = (ValaCCodeStructModule*) base;
	g_return_if_fail (st != NULL);
	_tmp0_ = vala_ccode_base_module_emit_context_new ((ValaSymbol*) st);
	_tmp1_ = _tmp0_;
	vala_ccode_base_module_push_context ((ValaCCodeBaseModule*) self, _tmp1_);
	_vala_ccode_base_module_emit_context_unref0 (_tmp1_);
	_tmp2_ = vala_code_node_get_source_reference ((ValaCodeNode*) st);
	_tmp3_ = _tmp2_;
	vala_ccode_base_module_push_line ((ValaCCodeBaseModule*) self, _tmp3_);
	_tmp4_ = ((ValaCCodeBaseModule*) self)->instance_finalize_context;
	_tmp5_ = _vala_ccode_base_module_emit_context_ref0 (_tmp4_);
	old_instance_finalize_context = _tmp5_;
	_tmp6_ = vala_ccode_base_module_emit_context_new (NULL);
	_vala_ccode_base_module_emit_context_unref0 (((ValaCCodeBaseModule*) self)->instance_finalize_context);
	((ValaCCodeBaseModule*) self)->instance_finalize_context = _tmp6_;
	_tmp7_ = ((ValaCCodeBaseModule*) self)->cfile;
	vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, st, _tmp7_);
	if (!vala_symbol_is_internal_symbol ((ValaSymbol*) st)) {
		ValaCCodeFile* _tmp8_;
		_tmp8_ = ((ValaCCodeBaseModule*) self)->header_file;
		vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, st, _tmp8_);
	}
	if (!vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
		ValaCCodeFile* _tmp9_;
		_tmp9_ = ((ValaCCodeBaseModule*) self)->internal_header_file;
		vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, st, _tmp9_);
	}
	if (!vala_struct_is_boolean_type (st)) {
		_tmp11_ = !vala_struct_is_integer_type (st);
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		_tmp10_ = !vala_struct_is_floating_type (st);
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		if (vala_struct_is_disposable (st)) {
			vala_ccode_struct_module_begin_struct_destroy_function (self, st);
		}
	}
	vala_code_node_accept_children ((ValaCodeNode*) st, (ValaCodeVisitor*) self);
	if (!vala_struct_is_boolean_type (st)) {
		_tmp13_ = !vala_struct_is_integer_type (st);
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		_tmp12_ = !vala_struct_is_floating_type (st);
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		if (vala_struct_is_disposable (st)) {
			vala_ccode_struct_module_add_struct_copy_function (self, st);
			vala_ccode_struct_module_add_struct_destroy_function (self, st);
		}
		if (!vala_struct_is_simple_type (st)) {
			vala_ccode_struct_module_add_struct_dup_function (self, st);
			vala_ccode_struct_module_add_struct_free_function (self, st);
		}
	}
	_tmp14_ = old_instance_finalize_context;
	_tmp15_ = _vala_ccode_base_module_emit_context_ref0 (_tmp14_);
	_vala_ccode_base_module_emit_context_unref0 (((ValaCCodeBaseModule*) self)->instance_finalize_context);
	((ValaCCodeBaseModule*) self)->instance_finalize_context = _tmp15_;
	vala_ccode_base_module_pop_line ((ValaCCodeBaseModule*) self);
	vala_ccode_base_module_pop_context ((ValaCCodeBaseModule*) self);
	_vala_ccode_base_module_emit_context_unref0 (old_instance_finalize_context);
}

static void
vala_ccode_struct_module_add_struct_dup_function (ValaCCodeStructModule* self,
                                                  ValaStruct* st)
{
	ValaCCodeFunction* function = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	ValaCCodeFunction* _tmp6_;
	ValaCCodeFunction* _tmp7_;
	ValaSymbolAccessibility _tmp8_;
	ValaSymbolAccessibility _tmp9_;
	ValaCCodeFunction* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	ValaCCodeParameter* _tmp18_;
	ValaCCodeParameter* _tmp19_;
	ValaCCodeFunction* _tmp20_;
	ValaCCodeFunction* _tmp21_;
	ValaCCodeFunction* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	ValaCCodeVariableDeclarator* _tmp27_;
	ValaCCodeVariableDeclarator* _tmp28_;
	ValaCodeContext* _tmp29_;
	ValaCodeContext* _tmp30_;
	ValaProfile _tmp31_;
	ValaProfile _tmp32_;
	ValaCCodeFunction* _tmp119_;
	ValaCCodeFunction* _tmp120_;
	ValaCCodeIdentifier* _tmp121_;
	ValaCCodeIdentifier* _tmp122_;
	ValaCCodeFile* _tmp123_;
	ValaCCodeFunction* _tmp124_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (st != NULL);
	_tmp0_ = vala_get_ccode_dup_function ((ValaTypeSymbol*) st);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat (_tmp3_, "*", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = vala_ccode_function_new (_tmp1_, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	function = _tmp7_;
	_tmp8_ = vala_symbol_get_access ((ValaSymbol*) st);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
		ValaCCodeFunction* _tmp10_;
		_tmp10_ = function;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp10_, VALA_CCODE_MODIFIERS_STATIC);
	}
	_tmp11_ = function;
	_tmp12_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat ("const ", _tmp13_, NULL);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strconcat (_tmp15_, "*", NULL);
	_tmp17_ = _tmp16_;
	_tmp18_ = vala_ccode_parameter_new ("self", _tmp17_);
	_tmp19_ = _tmp18_;
	vala_ccode_function_add_parameter (_tmp11_, _tmp19_);
	_vala_ccode_node_unref0 (_tmp19_);
	_g_free0 (_tmp17_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_tmp20_ = function;
	vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, _tmp20_);
	_tmp21_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
	_tmp22_ = _tmp21_;
	_tmp23_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp24_ = _tmp23_;
	_tmp25_ = g_strconcat (_tmp24_, "*", NULL);
	_tmp26_ = _tmp25_;
	_tmp27_ = vala_ccode_variable_declarator_new ("dup", NULL, NULL);
	_tmp28_ = _tmp27_;
	vala_ccode_function_add_declaration (_tmp22_, _tmp26_, (ValaCCodeDeclarator*) _tmp28_, 0);
	_vala_ccode_node_unref0 (_tmp28_);
	_g_free0 (_tmp26_);
	_g_free0 (_tmp24_);
	_tmp29_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
	_tmp30_ = _tmp29_;
	_tmp31_ = vala_code_context_get_profile (_tmp30_);
	_tmp32_ = _tmp31_;
	if (_tmp32_ == VALA_PROFILE_GOBJECT) {
		ValaCCodeFile* _tmp33_;
		ValaCCodeFunctionCall* creation_call = NULL;
		ValaCCodeIdentifier* _tmp34_;
		ValaCCodeIdentifier* _tmp35_;
		ValaCCodeFunctionCall* _tmp36_;
		ValaCCodeFunctionCall* _tmp37_;
		ValaCCodeFunctionCall* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		ValaCCodeConstant* _tmp41_;
		ValaCCodeConstant* _tmp42_;
		ValaCCodeFunctionCall* _tmp43_;
		ValaCCodeConstant* _tmp44_;
		ValaCCodeConstant* _tmp45_;
		ValaCCodeFunction* _tmp46_;
		ValaCCodeFunction* _tmp47_;
		ValaCCodeIdentifier* _tmp48_;
		ValaCCodeIdentifier* _tmp49_;
		ValaCCodeFunctionCall* _tmp50_;
		_tmp33_ = ((ValaCCodeBaseModule*) self)->cfile;
		vala_ccode_file_add_include (_tmp33_, "glib.h", FALSE);
		_tmp34_ = vala_ccode_identifier_new ("g_new0");
		_tmp35_ = _tmp34_;
		_tmp36_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp35_);
		_tmp37_ = _tmp36_;
		_vala_ccode_node_unref0 (_tmp35_);
		creation_call = _tmp37_;
		_tmp38_ = creation_call;
		_tmp39_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp40_ = _tmp39_;
		_tmp41_ = vala_ccode_constant_new (_tmp40_);
		_tmp42_ = _tmp41_;
		vala_ccode_function_call_add_argument (_tmp38_, (ValaCCodeExpression*) _tmp42_);
		_vala_ccode_node_unref0 (_tmp42_);
		_g_free0 (_tmp40_);
		_tmp43_ = creation_call;
		_tmp44_ = vala_ccode_constant_new ("1");
		_tmp45_ = _tmp44_;
		vala_ccode_function_call_add_argument (_tmp43_, (ValaCCodeExpression*) _tmp45_);
		_vala_ccode_node_unref0 (_tmp45_);
		_tmp46_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp47_ = _tmp46_;
		_tmp48_ = vala_ccode_identifier_new ("dup");
		_tmp49_ = _tmp48_;
		_tmp50_ = creation_call;
		vala_ccode_function_add_assignment (_tmp47_, (ValaCCodeExpression*) _tmp49_, (ValaCCodeExpression*) _tmp50_);
		_vala_ccode_node_unref0 (_tmp49_);
		_vala_ccode_node_unref0 (creation_call);
	} else {
		ValaCodeContext* _tmp51_;
		ValaCodeContext* _tmp52_;
		ValaProfile _tmp53_;
		ValaProfile _tmp54_;
		_tmp51_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp52_ = _tmp51_;
		_tmp53_ = vala_code_context_get_profile (_tmp52_);
		_tmp54_ = _tmp53_;
		if (_tmp54_ == VALA_PROFILE_POSIX) {
			ValaCCodeFile* _tmp55_;
			ValaCCodeFunctionCall* sizeof_call = NULL;
			ValaCCodeIdentifier* _tmp56_;
			ValaCCodeIdentifier* _tmp57_;
			ValaCCodeFunctionCall* _tmp58_;
			ValaCCodeFunctionCall* _tmp59_;
			ValaCCodeFunctionCall* _tmp60_;
			gchar* _tmp61_;
			gchar* _tmp62_;
			ValaCCodeConstant* _tmp63_;
			ValaCCodeConstant* _tmp64_;
			ValaCCodeFunctionCall* creation_call = NULL;
			ValaCCodeIdentifier* _tmp65_;
			ValaCCodeIdentifier* _tmp66_;
			ValaCCodeFunctionCall* _tmp67_;
			ValaCCodeFunctionCall* _tmp68_;
			ValaCCodeFunctionCall* _tmp69_;
			ValaCCodeConstant* _tmp70_;
			ValaCCodeConstant* _tmp71_;
			ValaCCodeFunctionCall* _tmp72_;
			ValaCCodeFunctionCall* _tmp73_;
			ValaCCodeFunction* _tmp74_;
			ValaCCodeFunction* _tmp75_;
			ValaCCodeIdentifier* _tmp76_;
			ValaCCodeIdentifier* _tmp77_;
			ValaCCodeFunctionCall* _tmp78_;
			_tmp55_ = ((ValaCCodeBaseModule*) self)->cfile;
			vala_ccode_file_add_include (_tmp55_, "stdlib.h", FALSE);
			_tmp56_ = vala_ccode_identifier_new ("sizeof");
			_tmp57_ = _tmp56_;
			_tmp58_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp57_);
			_tmp59_ = _tmp58_;
			_vala_ccode_node_unref0 (_tmp57_);
			sizeof_call = _tmp59_;
			_tmp60_ = sizeof_call;
			_tmp61_ = vala_get_ccode_name ((ValaCodeNode*) st);
			_tmp62_ = _tmp61_;
			_tmp63_ = vala_ccode_constant_new (_tmp62_);
			_tmp64_ = _tmp63_;
			vala_ccode_function_call_add_argument (_tmp60_, (ValaCCodeExpression*) _tmp64_);
			_vala_ccode_node_unref0 (_tmp64_);
			_g_free0 (_tmp62_);
			_tmp65_ = vala_ccode_identifier_new ("calloc");
			_tmp66_ = _tmp65_;
			_tmp67_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp66_);
			_tmp68_ = _tmp67_;
			_vala_ccode_node_unref0 (_tmp66_);
			creation_call = _tmp68_;
			_tmp69_ = creation_call;
			_tmp70_ = vala_ccode_constant_new ("1");
			_tmp71_ = _tmp70_;
			vala_ccode_function_call_add_argument (_tmp69_, (ValaCCodeExpression*) _tmp71_);
			_vala_ccode_node_unref0 (_tmp71_);
			_tmp72_ = creation_call;
			_tmp73_ = sizeof_call;
			vala_ccode_function_call_add_argument (_tmp72_, (ValaCCodeExpression*) _tmp73_);
			_tmp74_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp75_ = _tmp74_;
			_tmp76_ = vala_ccode_identifier_new ("dup");
			_tmp77_ = _tmp76_;
			_tmp78_ = creation_call;
			vala_ccode_function_add_assignment (_tmp75_, (ValaCCodeExpression*) _tmp77_, (ValaCCodeExpression*) _tmp78_);
			_vala_ccode_node_unref0 (_tmp77_);
			_vala_ccode_node_unref0 (creation_call);
			_vala_ccode_node_unref0 (sizeof_call);
		}
	}
	if (vala_struct_is_disposable (st)) {
		ValaCCodeFunctionCall* copy_call = NULL;
		gchar* _tmp79_;
		gchar* _tmp80_;
		ValaCCodeIdentifier* _tmp81_;
		ValaCCodeIdentifier* _tmp82_;
		ValaCCodeFunctionCall* _tmp83_;
		ValaCCodeFunctionCall* _tmp84_;
		ValaCCodeFunctionCall* _tmp85_;
		ValaCCodeIdentifier* _tmp86_;
		ValaCCodeIdentifier* _tmp87_;
		ValaCCodeFunctionCall* _tmp88_;
		ValaCCodeIdentifier* _tmp89_;
		ValaCCodeIdentifier* _tmp90_;
		ValaCCodeFunction* _tmp91_;
		ValaCCodeFunction* _tmp92_;
		ValaCCodeFunctionCall* _tmp93_;
		_tmp79_ = vala_get_ccode_copy_function ((ValaTypeSymbol*) st);
		_tmp80_ = _tmp79_;
		_tmp81_ = vala_ccode_identifier_new (_tmp80_);
		_tmp82_ = _tmp81_;
		_tmp83_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp82_);
		_tmp84_ = _tmp83_;
		_vala_ccode_node_unref0 (_tmp82_);
		_g_free0 (_tmp80_);
		copy_call = _tmp84_;
		_tmp85_ = copy_call;
		_tmp86_ = vala_ccode_identifier_new ("self");
		_tmp87_ = _tmp86_;
		vala_ccode_function_call_add_argument (_tmp85_, (ValaCCodeExpression*) _tmp87_);
		_vala_ccode_node_unref0 (_tmp87_);
		_tmp88_ = copy_call;
		_tmp89_ = vala_ccode_identifier_new ("dup");
		_tmp90_ = _tmp89_;
		vala_ccode_function_call_add_argument (_tmp88_, (ValaCCodeExpression*) _tmp90_);
		_vala_ccode_node_unref0 (_tmp90_);
		_tmp91_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp92_ = _tmp91_;
		_tmp93_ = copy_call;
		vala_ccode_function_add_expression (_tmp92_, (ValaCCodeExpression*) _tmp93_);
		_vala_ccode_node_unref0 (copy_call);
	} else {
		ValaCCodeFile* _tmp94_;
		ValaCCodeFunctionCall* sizeof_call = NULL;
		ValaCCodeIdentifier* _tmp95_;
		ValaCCodeIdentifier* _tmp96_;
		ValaCCodeFunctionCall* _tmp97_;
		ValaCCodeFunctionCall* _tmp98_;
		ValaCCodeFunctionCall* _tmp99_;
		gchar* _tmp100_;
		gchar* _tmp101_;
		ValaCCodeConstant* _tmp102_;
		ValaCCodeConstant* _tmp103_;
		ValaCCodeFunctionCall* copy_call = NULL;
		ValaCCodeIdentifier* _tmp104_;
		ValaCCodeIdentifier* _tmp105_;
		ValaCCodeFunctionCall* _tmp106_;
		ValaCCodeFunctionCall* _tmp107_;
		ValaCCodeFunctionCall* _tmp108_;
		ValaCCodeIdentifier* _tmp109_;
		ValaCCodeIdentifier* _tmp110_;
		ValaCCodeFunctionCall* _tmp111_;
		ValaCCodeIdentifier* _tmp112_;
		ValaCCodeIdentifier* _tmp113_;
		ValaCCodeFunctionCall* _tmp114_;
		ValaCCodeFunctionCall* _tmp115_;
		ValaCCodeFunction* _tmp116_;
		ValaCCodeFunction* _tmp117_;
		ValaCCodeFunctionCall* _tmp118_;
		_tmp94_ = ((ValaCCodeBaseModule*) self)->cfile;
		vala_ccode_file_add_include (_tmp94_, "string.h", FALSE);
		_tmp95_ = vala_ccode_identifier_new ("sizeof");
		_tmp96_ = _tmp95_;
		_tmp97_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp96_);
		_tmp98_ = _tmp97_;
		_vala_ccode_node_unref0 (_tmp96_);
		sizeof_call = _tmp98_;
		_tmp99_ = sizeof_call;
		_tmp100_ = vala_get_ccode_name ((ValaCodeNode*) st);
		_tmp101_ = _tmp100_;
		_tmp102_ = vala_ccode_constant_new (_tmp101_);
		_tmp103_ = _tmp102_;
		vala_ccode_function_call_add_argument (_tmp99_, (ValaCCodeExpression*) _tmp103_);
		_vala_ccode_node_unref0 (_tmp103_);
		_g_free0 (_tmp101_);
		_tmp104_ = vala_ccode_identifier_new ("memcpy");
		_tmp105_ = _tmp104_;
		_tmp106_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp105_);
		_tmp107_ = _tmp106_;
		_vala_ccode_node_unref0 (_tmp105_);
		copy_call = _tmp107_;
		_tmp108_ = copy_call;
		_tmp109_ = vala_ccode_identifier_new ("dup");
		_tmp110_ = _tmp109_;
		vala_ccode_function_call_add_argument (_tmp108_, (ValaCCodeExpression*) _tmp110_);
		_vala_ccode_node_unref0 (_tmp110_);
		_tmp111_ = copy_call;
		_tmp112_ = vala_ccode_identifier_new ("self");
		_tmp113_ = _tmp112_;
		vala_ccode_function_call_add_argument (_tmp111_, (ValaCCodeExpression*) _tmp113_);
		_vala_ccode_node_unref0 (_tmp113_);
		_tmp114_ = copy_call;
		_tmp115_ = sizeof_call;
		vala_ccode_function_call_add_argument (_tmp114_, (ValaCCodeExpression*) _tmp115_);
		_tmp116_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp117_ = _tmp116_;
		_tmp118_ = copy_call;
		vala_ccode_function_add_expression (_tmp117_, (ValaCCodeExpression*) _tmp118_);
		_vala_ccode_node_unref0 (copy_call);
		_vala_ccode_node_unref0 (sizeof_call);
	}
	_tmp119_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
	_tmp120_ = _tmp119_;
	_tmp121_ = vala_ccode_identifier_new ("dup");
	_tmp122_ = _tmp121_;
	vala_ccode_function_add_return (_tmp120_, (ValaCCodeExpression*) _tmp122_);
	_vala_ccode_node_unref0 (_tmp122_);
	vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
	_tmp123_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp124_ = function;
	vala_ccode_file_add_function (_tmp123_, _tmp124_);
	_vala_ccode_node_unref0 (function);
}

static void
vala_ccode_struct_module_add_struct_free_function (ValaCCodeStructModule* self,
                                                   ValaStruct* st)
{
	ValaCCodeFunction* function = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	ValaCCodeFunction* _tmp2_;
	ValaCCodeFunction* _tmp3_;
	ValaCCodeFunction* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	ValaCCodeParameter* _tmp16_;
	ValaCCodeParameter* _tmp17_;
	ValaCCodeFunction* _tmp18_;
	ValaCodeContext* _tmp31_;
	ValaCodeContext* _tmp32_;
	ValaProfile _tmp33_;
	ValaProfile _tmp34_;
	ValaCCodeFile* _tmp61_;
	ValaCCodeFunction* _tmp62_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (st != NULL);
	_tmp0_ = vala_get_ccode_free_function ((ValaTypeSymbol*) st);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_ccode_function_new (_tmp1_, "void");
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	function = _tmp3_;
	if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
		ValaCCodeFunction* _tmp4_;
		_tmp4_ = function;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp4_, VALA_CCODE_MODIFIERS_STATIC);
	} else {
		gboolean _tmp5_ = FALSE;
		ValaCodeContext* _tmp6_;
		ValaCodeContext* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp6_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp7_ = _tmp6_;
		_tmp8_ = vala_code_context_get_hide_internal (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_) {
			_tmp5_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			ValaCCodeFunction* _tmp10_;
			_tmp10_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp10_, VALA_CCODE_MODIFIERS_INTERNAL);
		}
	}
	_tmp11_ = function;
	_tmp12_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp13_, "*", NULL);
	_tmp15_ = _tmp14_;
	_tmp16_ = vala_ccode_parameter_new ("self", _tmp15_);
	_tmp17_ = _tmp16_;
	vala_ccode_function_add_parameter (_tmp11_, _tmp17_);
	_vala_ccode_node_unref0 (_tmp17_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_tmp18_ = function;
	vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, _tmp18_);
	if (vala_struct_is_disposable (st)) {
		ValaCCodeFunctionCall* destroy_call = NULL;
		gchar* _tmp19_;
		gchar* _tmp20_;
		ValaCCodeIdentifier* _tmp21_;
		ValaCCodeIdentifier* _tmp22_;
		ValaCCodeFunctionCall* _tmp23_;
		ValaCCodeFunctionCall* _tmp24_;
		ValaCCodeFunctionCall* _tmp25_;
		ValaCCodeIdentifier* _tmp26_;
		ValaCCodeIdentifier* _tmp27_;
		ValaCCodeFunction* _tmp28_;
		ValaCCodeFunction* _tmp29_;
		ValaCCodeFunctionCall* _tmp30_;
		_tmp19_ = vala_get_ccode_destroy_function ((ValaTypeSymbol*) st);
		_tmp20_ = _tmp19_;
		_tmp21_ = vala_ccode_identifier_new (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp22_);
		_tmp24_ = _tmp23_;
		_vala_ccode_node_unref0 (_tmp22_);
		_g_free0 (_tmp20_);
		destroy_call = _tmp24_;
		_tmp25_ = destroy_call;
		_tmp26_ = vala_ccode_identifier_new ("self");
		_tmp27_ = _tmp26_;
		vala_ccode_function_call_add_argument (_tmp25_, (ValaCCodeExpression*) _tmp27_);
		_vala_ccode_node_unref0 (_tmp27_);
		_tmp28_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp29_ = _tmp28_;
		_tmp30_ = destroy_call;
		vala_ccode_function_add_expression (_tmp29_, (ValaCCodeExpression*) _tmp30_);
		_vala_ccode_node_unref0 (destroy_call);
	}
	_tmp31_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
	_tmp32_ = _tmp31_;
	_tmp33_ = vala_code_context_get_profile (_tmp32_);
	_tmp34_ = _tmp33_;
	if (_tmp34_ == VALA_PROFILE_GOBJECT) {
		ValaCCodeFile* _tmp35_;
		ValaCCodeFunctionCall* free_call = NULL;
		ValaCCodeIdentifier* _tmp36_;
		ValaCCodeIdentifier* _tmp37_;
		ValaCCodeFunctionCall* _tmp38_;
		ValaCCodeFunctionCall* _tmp39_;
		ValaCCodeFunctionCall* _tmp40_;
		ValaCCodeIdentifier* _tmp41_;
		ValaCCodeIdentifier* _tmp42_;
		ValaCCodeFunction* _tmp43_;
		ValaCCodeFunction* _tmp44_;
		ValaCCodeFunctionCall* _tmp45_;
		_tmp35_ = ((ValaCCodeBaseModule*) self)->cfile;
		vala_ccode_file_add_include (_tmp35_, "glib.h", FALSE);
		_tmp36_ = vala_ccode_identifier_new ("g_free");
		_tmp37_ = _tmp36_;
		_tmp38_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp37_);
		_tmp39_ = _tmp38_;
		_vala_ccode_node_unref0 (_tmp37_);
		free_call = _tmp39_;
		_tmp40_ = free_call;
		_tmp41_ = vala_ccode_identifier_new ("self");
		_tmp42_ = _tmp41_;
		vala_ccode_function_call_add_argument (_tmp40_, (ValaCCodeExpression*) _tmp42_);
		_vala_ccode_node_unref0 (_tmp42_);
		_tmp43_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp44_ = _tmp43_;
		_tmp45_ = free_call;
		vala_ccode_function_add_expression (_tmp44_, (ValaCCodeExpression*) _tmp45_);
		_vala_ccode_node_unref0 (free_call);
	} else {
		ValaCodeContext* _tmp46_;
		ValaCodeContext* _tmp47_;
		ValaProfile _tmp48_;
		ValaProfile _tmp49_;
		_tmp46_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp47_ = _tmp46_;
		_tmp48_ = vala_code_context_get_profile (_tmp47_);
		_tmp49_ = _tmp48_;
		if (_tmp49_ == VALA_PROFILE_POSIX) {
			ValaCCodeFile* _tmp50_;
			ValaCCodeFunctionCall* free_call = NULL;
			ValaCCodeIdentifier* _tmp51_;
			ValaCCodeIdentifier* _tmp52_;
			ValaCCodeFunctionCall* _tmp53_;
			ValaCCodeFunctionCall* _tmp54_;
			ValaCCodeFunctionCall* _tmp55_;
			ValaCCodeIdentifier* _tmp56_;
			ValaCCodeIdentifier* _tmp57_;
			ValaCCodeFunction* _tmp58_;
			ValaCCodeFunction* _tmp59_;
			ValaCCodeFunctionCall* _tmp60_;
			_tmp50_ = ((ValaCCodeBaseModule*) self)->cfile;
			vala_ccode_file_add_include (_tmp50_, "stdlib.h", FALSE);
			_tmp51_ = vala_ccode_identifier_new ("free");
			_tmp52_ = _tmp51_;
			_tmp53_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp52_);
			_tmp54_ = _tmp53_;
			_vala_ccode_node_unref0 (_tmp52_);
			free_call = _tmp54_;
			_tmp55_ = free_call;
			_tmp56_ = vala_ccode_identifier_new ("self");
			_tmp57_ = _tmp56_;
			vala_ccode_function_call_add_argument (_tmp55_, (ValaCCodeExpression*) _tmp57_);
			_vala_ccode_node_unref0 (_tmp57_);
			_tmp58_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp59_ = _tmp58_;
			_tmp60_ = free_call;
			vala_ccode_function_add_expression (_tmp59_, (ValaCCodeExpression*) _tmp60_);
			_vala_ccode_node_unref0 (free_call);
		}
	}
	vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
	_tmp61_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp62_ = function;
	vala_ccode_file_add_function (_tmp61_, _tmp62_);
	_vala_ccode_node_unref0 (function);
}

static void
vala_ccode_struct_module_add_struct_copy_function (ValaCCodeStructModule* self,
                                                   ValaStruct* st)
{
	ValaCCodeFunction* function = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	ValaCCodeFunction* _tmp2_;
	ValaCCodeFunction* _tmp3_;
	ValaCCodeFunction* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	ValaCCodeParameter* _tmp18_;
	ValaCCodeParameter* _tmp19_;
	ValaCCodeFunction* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	ValaCCodeParameter* _tmp25_;
	ValaCCodeParameter* _tmp26_;
	ValaCCodeFunction* _tmp27_;
	ValaGLibValue* dest_struct = NULL;
	ValaDataType* _tmp28_;
	ValaDataType* _tmp29_;
	ValaCCodeIdentifier* _tmp30_;
	ValaCCodeIdentifier* _tmp31_;
	ValaGLibValue* _tmp32_;
	ValaGLibValue* _tmp33_;
	ValaStruct* sym = NULL;
	ValaCCodeFile* _tmp73_;
	ValaCCodeFunction* _tmp74_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (st != NULL);
	_tmp0_ = vala_get_ccode_copy_function ((ValaTypeSymbol*) st);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_ccode_function_new (_tmp1_, "void");
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	function = _tmp3_;
	if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
		ValaCCodeFunction* _tmp4_;
		_tmp4_ = function;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp4_, VALA_CCODE_MODIFIERS_STATIC);
	} else {
		gboolean _tmp5_ = FALSE;
		ValaCodeContext* _tmp6_;
		ValaCodeContext* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp6_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp7_ = _tmp6_;
		_tmp8_ = vala_code_context_get_hide_internal (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_) {
			_tmp5_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			ValaCCodeFunction* _tmp10_;
			_tmp10_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp10_, VALA_CCODE_MODIFIERS_INTERNAL);
		}
	}
	_tmp11_ = function;
	_tmp12_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat ("const ", _tmp13_, NULL);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strconcat (_tmp15_, "*", NULL);
	_tmp17_ = _tmp16_;
	_tmp18_ = vala_ccode_parameter_new ("self", _tmp17_);
	_tmp19_ = _tmp18_;
	vala_ccode_function_add_parameter (_tmp11_, _tmp19_);
	_vala_ccode_node_unref0 (_tmp19_);
	_g_free0 (_tmp17_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_tmp20_ = function;
	_tmp21_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strconcat (_tmp22_, "*", NULL);
	_tmp24_ = _tmp23_;
	_tmp25_ = vala_ccode_parameter_new ("dest", _tmp24_);
	_tmp26_ = _tmp25_;
	vala_ccode_function_add_parameter (_tmp20_, _tmp26_);
	_vala_ccode_node_unref0 (_tmp26_);
	_g_free0 (_tmp24_);
	_g_free0 (_tmp22_);
	_tmp27_ = function;
	vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, _tmp27_);
	_tmp28_ = vala_semantic_analyzer_get_data_type_for_symbol ((ValaSymbol*) st);
	_tmp29_ = _tmp28_;
	_tmp30_ = vala_ccode_identifier_new ("(*dest)");
	_tmp31_ = _tmp30_;
	_tmp32_ = vala_glib_value_new (_tmp29_, (ValaCCodeExpression*) _tmp31_, TRUE);
	_tmp33_ = _tmp32_;
	_vala_ccode_node_unref0 (_tmp31_);
	_vala_code_node_unref0 (_tmp29_);
	dest_struct = _tmp33_;
	sym = st;
	while (TRUE) {
		ValaStruct* _tmp34_;
		ValaStruct* _tmp35_;
		ValaStruct* _tmp36_;
		ValaStruct* _tmp37_;
		ValaStruct* _tmp38_;
		ValaStruct* _tmp39_;
		_tmp34_ = sym;
		_tmp35_ = vala_struct_get_base_struct (_tmp34_);
		_tmp36_ = _tmp35_;
		if (!(_tmp36_ != NULL)) {
			break;
		}
		_tmp37_ = sym;
		_tmp38_ = vala_struct_get_base_struct (_tmp37_);
		_tmp39_ = _tmp38_;
		sym = _tmp39_;
	}
	{
		ValaList* _f_list = NULL;
		ValaStruct* _tmp40_;
		ValaList* _tmp41_;
		gint _f_size = 0;
		ValaList* _tmp42_;
		gint _tmp43_;
		gint _tmp44_;
		gint _f_index = 0;
		_tmp40_ = sym;
		_tmp41_ = vala_struct_get_fields (_tmp40_);
		_f_list = _tmp41_;
		_tmp42_ = _f_list;
		_tmp43_ = vala_collection_get_size ((ValaCollection*) _tmp42_);
		_tmp44_ = _tmp43_;
		_f_size = _tmp44_;
		_f_index = -1;
		while (TRUE) {
			gint _tmp45_;
			gint _tmp46_;
			ValaField* f = NULL;
			ValaList* _tmp47_;
			gpointer _tmp48_;
			ValaField* _tmp49_;
			ValaMemberBinding _tmp50_;
			ValaMemberBinding _tmp51_;
			_f_index = _f_index + 1;
			_tmp45_ = _f_index;
			_tmp46_ = _f_size;
			if (!(_tmp45_ < _tmp46_)) {
				break;
			}
			_tmp47_ = _f_list;
			_tmp48_ = vala_list_get (_tmp47_, _f_index);
			f = (ValaField*) _tmp48_;
			_tmp49_ = f;
			_tmp50_ = vala_field_get_binding (_tmp49_);
			_tmp51_ = _tmp50_;
			if (_tmp51_ == VALA_MEMBER_BINDING_INSTANCE) {
				ValaTargetValue* value = NULL;
				ValaField* _tmp52_;
				ValaTargetValue* _tmp53_;
				ValaTargetValue* _tmp54_;
				ValaTargetValue* _tmp55_;
				ValaTargetValue* _tmp56_;
				gboolean _tmp57_ = FALSE;
				gboolean _tmp58_ = FALSE;
				ValaField* _tmp59_;
				ValaDataType* _tmp60_;
				ValaDataType* _tmp61_;
				ValaField* _tmp70_;
				ValaGLibValue* _tmp71_;
				ValaTargetValue* _tmp72_;
				_tmp52_ = f;
				_tmp53_ = vala_ccode_base_module_load_this_parameter ((ValaCCodeBaseModule*) self, G_TYPE_CHECK_INSTANCE_CAST (st, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol));
				_tmp54_ = _tmp53_;
				_tmp55_ = vala_code_generator_load_field ((ValaCodeGenerator*) self, _tmp52_, _tmp54_, NULL);
				_tmp56_ = _tmp55_;
				_vala_target_value_unref0 (_tmp54_);
				value = _tmp56_;
				_tmp59_ = f;
				_tmp60_ = vala_variable_get_variable_type ((ValaVariable*) _tmp59_);
				_tmp61_ = _tmp60_;
				if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp61_, VALA_TYPE_DELEGATE_TYPE)) {
					_tmp58_ = TRUE;
				} else {
					ValaField* _tmp62_;
					_tmp62_ = f;
					_tmp58_ = vala_get_ccode_delegate_target ((ValaCodeNode*) _tmp62_);
				}
				if (_tmp58_) {
					ValaField* _tmp63_;
					ValaDataType* _tmp64_;
					ValaDataType* _tmp65_;
					_tmp63_ = f;
					_tmp64_ = vala_variable_get_variable_type ((ValaVariable*) _tmp63_);
					_tmp65_ = _tmp64_;
					_tmp57_ = vala_ccode_base_module_requires_copy (_tmp65_);
				} else {
					_tmp57_ = FALSE;
				}
				if (_tmp57_) {
					ValaTargetValue* _tmp66_;
					ValaField* _tmp67_;
					ValaTargetValue* _tmp68_;
					ValaTargetValue* _tmp69_;
					_tmp66_ = value;
					_tmp67_ = f;
					_tmp68_ = vala_ccode_base_module_copy_value ((ValaCCodeBaseModule*) self, _tmp66_, (ValaCodeNode*) _tmp67_);
					_vala_target_value_unref0 (value);
					value = _tmp68_;
					_tmp69_ = value;
					if (_tmp69_ == NULL) {
						_vala_target_value_unref0 (value);
						_vala_code_node_unref0 (f);
						continue;
					}
				}
				_tmp70_ = f;
				_tmp71_ = dest_struct;
				_tmp72_ = value;
				vala_code_generator_store_field ((ValaCodeGenerator*) self, _tmp70_, (ValaTargetValue*) _tmp71_, _tmp72_, NULL, FALSE);
				_vala_target_value_unref0 (value);
			}
			_vala_code_node_unref0 (f);
		}
	}
	vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
	_tmp73_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp74_ = function;
	vala_ccode_file_add_function (_tmp73_, _tmp74_);
	_vala_target_value_unref0 (dest_struct);
	_vala_ccode_node_unref0 (function);
}

static void
vala_ccode_struct_module_begin_struct_destroy_function (ValaCCodeStructModule* self,
                                                        ValaStruct* st)
{
	ValaCCodeBaseModuleEmitContext* _tmp0_;
	ValaCCodeFunction* function = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ValaCCodeFunction* _tmp3_;
	ValaCCodeFunction* _tmp4_;
	ValaCCodeFunction* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	ValaCCodeParameter* _tmp17_;
	ValaCCodeParameter* _tmp18_;
	ValaCCodeFunction* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (st != NULL);
	_tmp0_ = ((ValaCCodeBaseModule*) self)->instance_finalize_context;
	vala_ccode_base_module_push_context ((ValaCCodeBaseModule*) self, _tmp0_);
	_tmp1_ = vala_get_ccode_destroy_function ((ValaTypeSymbol*) st);
	_tmp2_ = _tmp1_;
	_tmp3_ = vala_ccode_function_new (_tmp2_, "void");
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	function = _tmp4_;
	if (vala_symbol_is_private_symbol ((ValaSymbol*) st)) {
		ValaCCodeFunction* _tmp5_;
		_tmp5_ = function;
		vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp5_, VALA_CCODE_MODIFIERS_STATIC);
	} else {
		gboolean _tmp6_ = FALSE;
		ValaCodeContext* _tmp7_;
		ValaCodeContext* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp7_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
		_tmp8_ = _tmp7_;
		_tmp9_ = vala_code_context_get_hide_internal (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_) {
			_tmp6_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			ValaCCodeFunction* _tmp11_;
			_tmp11_ = function;
			vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp11_, VALA_CCODE_MODIFIERS_INTERNAL);
		}
	}
	_tmp12_ = function;
	_tmp13_ = vala_get_ccode_name ((ValaCodeNode*) st);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strconcat (_tmp14_, "*", NULL);
	_tmp16_ = _tmp15_;
	_tmp17_ = vala_ccode_parameter_new ("self", _tmp16_);
	_tmp18_ = _tmp17_;
	vala_ccode_function_add_parameter (_tmp12_, _tmp18_);
	_vala_ccode_node_unref0 (_tmp18_);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	_tmp19_ = function;
	vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, _tmp19_);
	vala_ccode_base_module_pop_context ((ValaCCodeBaseModule*) self);
	_vala_ccode_node_unref0 (function);
}

static void
vala_ccode_struct_module_add_struct_destroy_function (ValaCCodeStructModule* self,
                                                      ValaStruct* st)
{
	ValaStruct* sym = NULL;
	ValaStruct* _tmp6_;
	ValaCCodeFile* _tmp21_;
	ValaCCodeBaseModuleEmitContext* _tmp22_;
	ValaCCodeFunction* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (st != NULL);
	sym = st;
	while (TRUE) {
		ValaStruct* _tmp0_;
		ValaStruct* _tmp1_;
		ValaStruct* _tmp2_;
		ValaStruct* _tmp3_;
		ValaStruct* _tmp4_;
		ValaStruct* _tmp5_;
		_tmp0_ = sym;
		_tmp1_ = vala_struct_get_base_struct (_tmp0_);
		_tmp2_ = _tmp1_;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = sym;
		_tmp4_ = vala_struct_get_base_struct (_tmp3_);
		_tmp5_ = _tmp4_;
		sym = _tmp5_;
	}
	_tmp6_ = sym;
	if (st != _tmp6_) {
		ValaCCodeBaseModuleEmitContext* _tmp7_;
		ValaCCodeFunctionCall* destroy_func = NULL;
		ValaStruct* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		ValaCCodeIdentifier* _tmp11_;
		ValaCCodeIdentifier* _tmp12_;
		ValaCCodeFunctionCall* _tmp13_;
		ValaCCodeFunctionCall* _tmp14_;
		ValaCCodeFunctionCall* _tmp15_;
		ValaCCodeIdentifier* _tmp16_;
		ValaCCodeIdentifier* _tmp17_;
		ValaCCodeFunction* _tmp18_;
		ValaCCodeFunction* _tmp19_;
		ValaCCodeFunctionCall* _tmp20_;
		_tmp7_ = ((ValaCCodeBaseModule*) self)->instance_finalize_context;
		vala_ccode_base_module_push_context ((ValaCCodeBaseModule*) self, _tmp7_);
		_tmp8_ = sym;
		_tmp9_ = vala_get_ccode_destroy_function ((ValaTypeSymbol*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = vala_ccode_identifier_new (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp12_);
		_tmp14_ = _tmp13_;
		_vala_ccode_node_unref0 (_tmp12_);
		_g_free0 (_tmp10_);
		destroy_func = _tmp14_;
		_tmp15_ = destroy_func;
		_tmp16_ = vala_ccode_identifier_new ("self");
		_tmp17_ = _tmp16_;
		vala_ccode_function_call_add_argument (_tmp15_, (ValaCCodeExpression*) _tmp17_);
		_vala_ccode_node_unref0 (_tmp17_);
		_tmp18_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp19_ = _tmp18_;
		_tmp20_ = destroy_func;
		vala_ccode_function_add_expression (_tmp19_, (ValaCCodeExpression*) _tmp20_);
		vala_ccode_base_module_pop_context ((ValaCCodeBaseModule*) self);
		_vala_ccode_node_unref0 (destroy_func);
	}
	_tmp21_ = ((ValaCCodeBaseModule*) self)->cfile;
	_tmp22_ = ((ValaCCodeBaseModule*) self)->instance_finalize_context;
	_tmp23_ = _tmp22_->ccode;
	vala_ccode_file_add_function (_tmp21_, _tmp23_);
}

ValaCCodeStructModule*
vala_ccode_struct_module_construct (GType object_type)
{
	ValaCCodeStructModule* self = NULL;
	self = (ValaCCodeStructModule*) vala_ccode_base_module_construct (object_type);
	return self;
}

static void
vala_ccode_struct_module_class_init (ValaCCodeStructModuleClass * klass,
                                     gpointer klass_data)
{
	vala_ccode_struct_module_parent_class = g_type_class_peek_parent (klass);
	((ValaCCodeBaseModuleClass *) klass)->generate_struct_declaration = (void (*) (ValaCCodeBaseModule*, ValaStruct*, ValaCCodeFile*)) vala_ccode_struct_module_real_generate_struct_declaration;
	((ValaCodeVisitorClass *) klass)->visit_struct = (void (*) (ValaCodeVisitor*, ValaStruct*)) vala_ccode_struct_module_real_visit_struct;
}

static void
vala_ccode_struct_module_instance_init (ValaCCodeStructModule * self,
                                        gpointer klass)
{
}

static GType
vala_ccode_struct_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeStructModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_struct_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeStructModule), 0, (GInstanceInitFunc) vala_ccode_struct_module_instance_init, NULL };
	GType vala_ccode_struct_module_type_id;
	vala_ccode_struct_module_type_id = g_type_register_static (VALA_TYPE_CCODE_BASE_MODULE, "ValaCCodeStructModule", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	return vala_ccode_struct_module_type_id;
}

GType
vala_ccode_struct_module_get_type (void)
{
	static volatile gsize vala_ccode_struct_module_type_id__once = 0;
	if (g_once_init_enter (&vala_ccode_struct_module_type_id__once)) {
		GType vala_ccode_struct_module_type_id;
		vala_ccode_struct_module_type_id = vala_ccode_struct_module_get_type_once ();
		g_once_init_leave (&vala_ccode_struct_module_type_id__once, vala_ccode_struct_module_type_id);
	}
	return vala_ccode_struct_module_type_id__once;
}

