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

/* valagvaluemodule.vala
 *
 * Copyright (C) 2019  Rico Tzschichholz
 *
 * 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:
 * 	Rico Tzschichholz <ricotz@ubuntu.com>
 */

#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>

#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_target_value_unref0(var) ((var == NULL) ? NULL : (var = (vala_target_value_unref (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

static gpointer vala_gvalue_module_parent_class = NULL;

static void vala_gvalue_module_real_visit_cast_expression (ValaCodeVisitor* base,
                                                    ValaCastExpression* expr);
static ValaCCodeExpression* vala_gvalue_module_real_get_value_getter_function (ValaCCodeBaseModule* base,
                                                                        ValaDataType* type_reference);
static ValaCCodeExpression* vala_gvalue_module_real_get_value_setter_function (ValaCCodeBaseModule* base,
                                                                        ValaDataType* type_reference);
static ValaCCodeExpression* vala_gvalue_module_real_get_value_taker_function (ValaCCodeBaseModule* base,
                                                                       ValaDataType* type_reference);
static GType vala_gvalue_module_get_type_once (void);

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

static void
vala_gvalue_module_real_visit_cast_expression (ValaCodeVisitor* base,
                                               ValaCastExpression* expr)
{
	ValaGValueModule * self;
	ValaDataType* value_type = NULL;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaDataType* _tmp2_;
	ValaDataType* _tmp3_;
	ValaDataType* target_type = NULL;
	ValaDataType* _tmp4_;
	ValaDataType* _tmp5_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_;
	gboolean _tmp12_;
	ValaDataType* _tmp26_;
	ValaDataType* _tmp27_;
	ValaCCodeFile* _tmp28_;
	ValaCCodeFunctionCall* ccall = NULL;
	ValaDataType* _tmp29_;
	ValaCCodeExpression* _tmp30_;
	ValaCCodeExpression* _tmp31_;
	ValaCCodeFunctionCall* _tmp32_;
	ValaCCodeFunctionCall* _tmp33_;
	ValaCCodeExpression* gvalue = NULL;
	ValaDataType* _tmp34_;
	gboolean _tmp35_;
	gboolean _tmp36_;
	ValaCCodeFunctionCall* _tmp45_;
	ValaCCodeExpression* _tmp46_;
	ValaDataType* _tmp47_;
	ValaCCodeExpression* rv = NULL;
	ValaDataType* _tmp66_;
	ValaCCodeExpression* _tmp145_;
	self = (ValaGValueModule*) base;
	g_return_if_fail (expr != NULL);
	_tmp0_ = vala_cast_expression_get_inner (expr);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_expression_get_value_type (_tmp1_);
	_tmp3_ = _tmp2_;
	value_type = _tmp3_;
	_tmp4_ = vala_cast_expression_get_type_reference (expr);
	_tmp5_ = _tmp4_;
	target_type = _tmp5_;
	_tmp11_ = vala_cast_expression_get_is_non_null_cast (expr);
	_tmp12_ = _tmp11_;
	if (_tmp12_) {
		_tmp10_ = TRUE;
	} else {
		ValaDataType* _tmp13_;
		_tmp13_ = value_type;
		_tmp10_ = _tmp13_ == NULL;
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		ValaStruct* _tmp14_;
		_tmp14_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
		_tmp9_ = _tmp14_ == NULL;
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		ValaDataType* _tmp15_;
		ValaTypeSymbol* _tmp16_;
		ValaTypeSymbol* _tmp17_;
		ValaStruct* _tmp18_;
		_tmp15_ = value_type;
		_tmp16_ = vala_data_type_get_type_symbol (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
		_tmp8_ = _tmp17_ != G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol);
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		ValaDataType* _tmp19_;
		ValaTypeSymbol* _tmp20_;
		ValaTypeSymbol* _tmp21_;
		ValaStruct* _tmp22_;
		_tmp19_ = target_type;
		_tmp20_ = vala_data_type_get_type_symbol (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
		_tmp7_ = _tmp21_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol);
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		ValaDataType* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp23_ = target_type;
		_tmp24_ = vala_get_ccode_type_id ((ValaCodeNode*) _tmp23_);
		_tmp25_ = _tmp24_;
		_tmp6_ = g_strcmp0 (_tmp25_, "") == 0;
		_g_free0 (_tmp25_);
	}
	if (_tmp6_) {
		VALA_CODE_VISITOR_CLASS (vala_gvalue_module_parent_class)->visit_cast_expression ((ValaCodeVisitor*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_GASYNC_MODULE, ValaGAsyncModule), expr);
		return;
	}
	_tmp26_ = vala_cast_expression_get_type_reference (expr);
	_tmp27_ = _tmp26_;
	_tmp28_ = ((ValaCCodeBaseModule*) self)->cfile;
	vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp27_, _tmp28_);
	_tmp29_ = target_type;
	_tmp30_ = vala_ccode_base_module_get_value_getter_function ((ValaCCodeBaseModule*) self, _tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = vala_ccode_function_call_new (_tmp31_);
	_tmp33_ = _tmp32_;
	_vala_ccode_node_unref0 (_tmp31_);
	ccall = _tmp33_;
	_tmp34_ = value_type;
	_tmp35_ = vala_data_type_get_nullable (_tmp34_);
	_tmp36_ = _tmp35_;
	if (_tmp36_) {
		ValaExpression* _tmp37_;
		ValaExpression* _tmp38_;
		ValaCCodeExpression* _tmp39_;
		ValaCCodeExpression* _tmp40_;
		_tmp37_ = vala_cast_expression_get_inner (expr);
		_tmp38_ = _tmp37_;
		_tmp39_ = vala_get_cvalue (_tmp38_);
		_tmp40_ = _vala_ccode_node_ref0 (_tmp39_);
		_vala_ccode_node_unref0 (gvalue);
		gvalue = _tmp40_;
	} else {
		ValaExpression* _tmp41_;
		ValaExpression* _tmp42_;
		ValaCCodeExpression* _tmp43_;
		ValaCCodeUnaryExpression* _tmp44_;
		_tmp41_ = vala_cast_expression_get_inner (expr);
		_tmp42_ = _tmp41_;
		_tmp43_ = vala_get_cvalue (_tmp42_);
		_tmp44_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_ADDRESS_OF, _tmp43_);
		_vala_ccode_node_unref0 (gvalue);
		gvalue = (ValaCCodeExpression*) _tmp44_;
	}
	_tmp45_ = ccall;
	_tmp46_ = gvalue;
	vala_ccode_function_call_add_argument (_tmp45_, _tmp46_);
	_tmp47_ = value_type;
	if (vala_data_type_is_disposable (_tmp47_)) {
		ValaLocalVariable* temp_var = NULL;
		ValaDataType* _tmp48_;
		ValaLocalVariable* _tmp49_;
		ValaLocalVariable* _tmp50_;
		ValaCCodeExpression* temp_ref = NULL;
		ValaLocalVariable* _tmp51_;
		const gchar* _tmp52_;
		const gchar* _tmp53_;
		ValaCCodeExpression* _tmp54_;
		ValaCCodeFunction* _tmp55_;
		ValaCCodeFunction* _tmp56_;
		ValaCCodeExpression* _tmp57_;
		ValaExpression* _tmp58_;
		ValaExpression* _tmp59_;
		ValaCCodeExpression* _tmp60_;
		ValaArrayList* _tmp61_;
		ValaArrayList* _tmp62_;
		ValaLocalVariable* _tmp63_;
		ValaTargetValue* _tmp64_;
		ValaTargetValue* _tmp65_;
		_tmp48_ = value_type;
		_tmp49_ = vala_ccode_base_module_get_temp_variable ((ValaCCodeBaseModule*) self, _tmp48_, TRUE, (ValaCodeNode*) expr, FALSE);
		temp_var = _tmp49_;
		_tmp50_ = temp_var;
		vala_ccode_base_module_emit_temp_var ((ValaCCodeBaseModule*) self, _tmp50_, FALSE);
		_tmp51_ = temp_var;
		_tmp52_ = vala_symbol_get_name ((ValaSymbol*) _tmp51_);
		_tmp53_ = _tmp52_;
		_tmp54_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp53_);
		temp_ref = _tmp54_;
		_tmp55_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp56_ = _tmp55_;
		_tmp57_ = temp_ref;
		_tmp58_ = vala_cast_expression_get_inner (expr);
		_tmp59_ = _tmp58_;
		_tmp60_ = vala_get_cvalue (_tmp59_);
		vala_ccode_function_add_assignment (_tmp56_, _tmp57_, _tmp60_);
		_tmp61_ = vala_ccode_base_module_get_temp_ref_values ((ValaCCodeBaseModule*) self);
		_tmp62_ = _tmp61_;
		_tmp63_ = temp_var;
		_tmp64_ = vala_ccode_base_module_get_local_cvalue ((ValaCCodeBaseModule*) self, _tmp63_);
		_tmp65_ = _tmp64_;
		vala_list_insert ((ValaList*) _tmp62_, 0, _tmp65_);
		_vala_target_value_unref0 (_tmp65_);
		_vala_ccode_node_unref0 (temp_ref);
		_vala_code_node_unref0 (temp_var);
	}
	_tmp66_ = target_type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp66_, VALA_TYPE_ARRAY_TYPE)) {
		ValaLocalVariable* temp_var = NULL;
		ValaDataType* _tmp67_;
		ValaLocalVariable* _tmp68_;
		ValaLocalVariable* _tmp69_;
		ValaCCodeExpression* temp_ref = NULL;
		ValaLocalVariable* _tmp70_;
		const gchar* _tmp71_;
		const gchar* _tmp72_;
		ValaCCodeExpression* _tmp73_;
		ValaCCodeFunction* _tmp74_;
		ValaCCodeFunction* _tmp75_;
		ValaCCodeExpression* _tmp76_;
		ValaCCodeFunctionCall* _tmp77_;
		ValaCCodeExpression* _tmp78_;
		ValaCCodeExpression* _tmp79_;
		ValaCCodeFunctionCall* len_call = NULL;
		ValaCCodeIdentifier* _tmp80_;
		ValaCCodeIdentifier* _tmp81_;
		ValaCCodeFunctionCall* _tmp82_;
		ValaCCodeFunctionCall* _tmp83_;
		ValaCCodeFunctionCall* _tmp84_;
		ValaCCodeExpression* _tmp85_;
		ValaCCodeFunctionCall* _tmp86_;
		_tmp67_ = target_type;
		_tmp68_ = vala_ccode_base_module_get_temp_variable ((ValaCCodeBaseModule*) self, _tmp67_, TRUE, (ValaCodeNode*) expr, FALSE);
		temp_var = _tmp68_;
		_tmp69_ = temp_var;
		vala_ccode_base_module_emit_temp_var ((ValaCCodeBaseModule*) self, _tmp69_, FALSE);
		_tmp70_ = temp_var;
		_tmp71_ = vala_symbol_get_name ((ValaSymbol*) _tmp70_);
		_tmp72_ = _tmp71_;
		_tmp73_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp72_);
		temp_ref = _tmp73_;
		_tmp74_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
		_tmp75_ = _tmp74_;
		_tmp76_ = temp_ref;
		_tmp77_ = ccall;
		vala_ccode_function_add_assignment (_tmp75_, _tmp76_, (ValaCCodeExpression*) _tmp77_);
		_tmp78_ = temp_ref;
		_tmp79_ = _vala_ccode_node_ref0 (_tmp78_);
		_vala_ccode_node_unref0 (rv);
		rv = _tmp79_;
		_tmp80_ = vala_ccode_identifier_new ("g_strv_length");
		_tmp81_ = _tmp80_;
		_tmp82_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp81_);
		_tmp83_ = _tmp82_;
		_vala_ccode_node_unref0 (_tmp81_);
		len_call = _tmp83_;
		_tmp84_ = len_call;
		_tmp85_ = rv;
		vala_ccode_function_call_add_argument (_tmp84_, _tmp85_);
		_tmp86_ = len_call;
		vala_append_array_length ((ValaExpression*) expr, (ValaCCodeExpression*) _tmp86_);
		_vala_ccode_node_unref0 (len_call);
		_vala_ccode_node_unref0 (temp_ref);
		_vala_code_node_unref0 (temp_var);
	} else {
		ValaDataType* _tmp87_;
		_tmp87_ = target_type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp87_, VALA_TYPE_STRUCT_VALUE_TYPE)) {
			ValaLocalVariable* temp_var = NULL;
			ValaDataType* _tmp88_;
			ValaPointerType* _tmp89_;
			ValaPointerType* _tmp90_;
			ValaLocalVariable* _tmp91_;
			ValaLocalVariable* _tmp92_;
			ValaLocalVariable* _tmp93_;
			ValaCCodeExpression* temp_ref = NULL;
			ValaLocalVariable* _tmp94_;
			const gchar* _tmp95_;
			const gchar* _tmp96_;
			ValaCCodeExpression* _tmp97_;
			ValaCCodeFunction* _tmp98_;
			ValaCCodeFunction* _tmp99_;
			ValaCCodeExpression* _tmp100_;
			ValaCCodeFunctionCall* _tmp101_;
			ValaCCodeExpression* _tmp102_;
			ValaCCodeExpression* _tmp103_;
			ValaTargetValue* temp_value = NULL;
			ValaDataType* _tmp104_;
			gboolean _tmp105_;
			ValaTargetValue* _tmp106_;
			ValaCCodeExpression* ctemp = NULL;
			ValaTargetValue* _tmp107_;
			ValaCCodeExpression* _tmp108_;
			ValaCCodeExpression* _tmp109_;
			ValaCCodeFunctionCall* holds = NULL;
			ValaCCodeIdentifier* _tmp110_;
			ValaCCodeIdentifier* _tmp111_;
			ValaCCodeFunctionCall* _tmp112_;
			ValaCCodeFunctionCall* _tmp113_;
			ValaCCodeFunctionCall* _tmp114_;
			ValaCCodeExpression* _tmp115_;
			ValaCCodeFunctionCall* _tmp116_;
			ValaDataType* _tmp117_;
			gchar* _tmp118_;
			gchar* _tmp119_;
			ValaCCodeIdentifier* _tmp120_;
			ValaCCodeIdentifier* _tmp121_;
			ValaCCodeBinaryExpression* cond = NULL;
			ValaCCodeFunctionCall* _tmp122_;
			ValaCCodeExpression* _tmp123_;
			ValaCCodeBinaryExpression* _tmp124_;
			ValaCCodeFunctionCall* warn = NULL;
			ValaCCodeIdentifier* _tmp125_;
			ValaCCodeIdentifier* _tmp126_;
			ValaCCodeFunctionCall* _tmp127_;
			ValaCCodeFunctionCall* _tmp128_;
			ValaCCodeFunctionCall* _tmp129_;
			ValaCCodeConstant* _tmp130_;
			ValaCCodeConstant* _tmp131_;
			ValaCCodeCommaExpression* fail = NULL;
			ValaCCodeCommaExpression* _tmp132_;
			ValaCCodeCommaExpression* _tmp133_;
			ValaCCodeFunctionCall* _tmp134_;
			ValaCCodeCommaExpression* _tmp135_;
			ValaCCodeExpression* _tmp136_;
			ValaCCodeBinaryExpression* _tmp137_;
			ValaCCodeExpression* _tmp138_;
			ValaCCodeUnaryExpression* _tmp139_;
			ValaCCodeUnaryExpression* _tmp140_;
			ValaCCodeCommaExpression* _tmp141_;
			ValaCCodeConditionalExpression* _tmp142_;
			_tmp88_ = target_type;
			_tmp89_ = vala_pointer_type_new (_tmp88_, NULL);
			_tmp90_ = _tmp89_;
			_tmp91_ = vala_ccode_base_module_get_temp_variable ((ValaCCodeBaseModule*) self, (ValaDataType*) _tmp90_, TRUE, (ValaCodeNode*) expr, FALSE);
			_tmp92_ = _tmp91_;
			_vala_code_node_unref0 (_tmp90_);
			temp_var = _tmp92_;
			_tmp93_ = temp_var;
			vala_ccode_base_module_emit_temp_var ((ValaCCodeBaseModule*) self, _tmp93_, FALSE);
			_tmp94_ = temp_var;
			_tmp95_ = vala_symbol_get_name ((ValaSymbol*) _tmp94_);
			_tmp96_ = _tmp95_;
			_tmp97_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp96_);
			temp_ref = _tmp97_;
			_tmp98_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
			_tmp99_ = _tmp98_;
			_tmp100_ = temp_ref;
			_tmp101_ = ccall;
			vala_ccode_function_add_assignment (_tmp99_, _tmp100_, (ValaCCodeExpression*) _tmp101_);
			_tmp102_ = temp_ref;
			_tmp103_ = _vala_ccode_node_ref0 (_tmp102_);
			_vala_ccode_node_unref0 (rv);
			rv = _tmp103_;
			_tmp104_ = target_type;
			_tmp105_ = TRUE;
			_tmp106_ = vala_ccode_base_module_create_temp_value ((ValaCCodeBaseModule*) self, _tmp104_, TRUE, (ValaCodeNode*) expr, &_tmp105_);
			temp_value = _tmp106_;
			_tmp107_ = temp_value;
			_tmp108_ = vala_get_cvalue_ (_tmp107_);
			_tmp109_ = _vala_ccode_node_ref0 (_tmp108_);
			ctemp = _tmp109_;
			_tmp110_ = vala_ccode_identifier_new ("G_VALUE_HOLDS");
			_tmp111_ = _tmp110_;
			_tmp112_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp111_);
			_tmp113_ = _tmp112_;
			_vala_ccode_node_unref0 (_tmp111_);
			holds = _tmp113_;
			_tmp114_ = holds;
			_tmp115_ = gvalue;
			vala_ccode_function_call_add_argument (_tmp114_, _tmp115_);
			_tmp116_ = holds;
			_tmp117_ = target_type;
			_tmp118_ = vala_get_ccode_type_id ((ValaCodeNode*) _tmp117_);
			_tmp119_ = _tmp118_;
			_tmp120_ = vala_ccode_identifier_new (_tmp119_);
			_tmp121_ = _tmp120_;
			vala_ccode_function_call_add_argument (_tmp116_, (ValaCCodeExpression*) _tmp121_);
			_vala_ccode_node_unref0 (_tmp121_);
			_g_free0 (_tmp119_);
			_tmp122_ = holds;
			_tmp123_ = rv;
			_tmp124_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_AND, (ValaCCodeExpression*) _tmp122_, _tmp123_);
			cond = _tmp124_;
			_tmp125_ = vala_ccode_identifier_new ("g_warning");
			_tmp126_ = _tmp125_;
			_tmp127_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp126_);
			_tmp128_ = _tmp127_;
			_vala_ccode_node_unref0 (_tmp126_);
			warn = _tmp128_;
			_tmp129_ = warn;
			_tmp130_ = vala_ccode_constant_new ("\"Invalid GValue unboxing (wrong type or NULL)\"");
			_tmp131_ = _tmp130_;
			vala_ccode_function_call_add_argument (_tmp129_, (ValaCCodeExpression*) _tmp131_);
			_vala_ccode_node_unref0 (_tmp131_);
			_tmp132_ = vala_ccode_comma_expression_new ();
			fail = _tmp132_;
			_tmp133_ = fail;
			_tmp134_ = warn;
			vala_ccode_comma_expression_append_expression (_tmp133_, (ValaCCodeExpression*) _tmp134_);
			_tmp135_ = fail;
			_tmp136_ = ctemp;
			vala_ccode_comma_expression_append_expression (_tmp135_, _tmp136_);
			_tmp137_ = cond;
			_tmp138_ = rv;
			_tmp139_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_POINTER_INDIRECTION, _tmp138_);
			_tmp140_ = _tmp139_;
			_tmp141_ = fail;
			_tmp142_ = vala_ccode_conditional_expression_new ((ValaCCodeExpression*) _tmp137_, (ValaCCodeExpression*) _tmp140_, (ValaCCodeExpression*) _tmp141_);
			_vala_ccode_node_unref0 (rv);
			rv = (ValaCCodeExpression*) _tmp142_;
			_vala_ccode_node_unref0 (_tmp140_);
			_vala_ccode_node_unref0 (fail);
			_vala_ccode_node_unref0 (warn);
			_vala_ccode_node_unref0 (cond);
			_vala_ccode_node_unref0 (holds);
			_vala_ccode_node_unref0 (ctemp);
			_vala_target_value_unref0 (temp_value);
			_vala_ccode_node_unref0 (temp_ref);
			_vala_code_node_unref0 (temp_var);
		} else {
			ValaCCodeFunctionCall* _tmp143_;
			ValaCCodeExpression* _tmp144_;
			_tmp143_ = ccall;
			_tmp144_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp143_);
			_vala_ccode_node_unref0 (rv);
			rv = _tmp144_;
		}
	}
	_tmp145_ = rv;
	vala_set_cvalue ((ValaExpression*) expr, _tmp145_);
	_vala_ccode_node_unref0 (rv);
	_vala_ccode_node_unref0 (gvalue);
	_vala_ccode_node_unref0 (ccall);
}

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

static ValaCCodeExpression*
vala_gvalue_module_real_get_value_getter_function (ValaCCodeBaseModule* base,
                                                   ValaDataType* type_reference)
{
	ValaGValueModule * self;
	ValaArrayType* array_type = NULL;
	ValaArrayType* _tmp0_;
	ValaTypeSymbol* _tmp1_;
	ValaTypeSymbol* _tmp2_;
	ValaCCodeExpression* result;
	self = (ValaGValueModule*) base;
	g_return_val_if_fail (type_reference != NULL, NULL);
	_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type_reference, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type_reference) : NULL);
	array_type = _tmp0_;
	_tmp1_ = vala_data_type_get_type_symbol (type_reference);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		ValaTypeSymbol* _tmp3_;
		ValaTypeSymbol* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		ValaCCodeIdentifier* _tmp7_;
		ValaCCodeExpression* _tmp8_;
		_tmp3_ = vala_data_type_get_type_symbol (type_reference);
		_tmp4_ = _tmp3_;
		_tmp5_ = vala_get_ccode_get_value_function ((ValaCodeNode*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = vala_ccode_identifier_new (_tmp6_);
		_tmp8_ = (ValaCCodeExpression*) _tmp7_;
		_g_free0 (_tmp6_);
		result = _tmp8_;
		_vala_code_node_unref0 (array_type);
		return result;
	} else {
		gboolean _tmp9_ = FALSE;
		ValaArrayType* _tmp10_;
		_tmp10_ = array_type;
		if (_tmp10_ != NULL) {
			ValaArrayType* _tmp11_;
			ValaDataType* _tmp12_;
			ValaDataType* _tmp13_;
			ValaTypeSymbol* _tmp14_;
			ValaTypeSymbol* _tmp15_;
			ValaDataType* _tmp16_;
			ValaTypeSymbol* _tmp17_;
			ValaTypeSymbol* _tmp18_;
			_tmp11_ = array_type;
			_tmp12_ = vala_array_type_get_element_type (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = vala_data_type_get_type_symbol (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = ((ValaCCodeBaseModule*) self)->string_type;
			_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp9_ = _tmp15_ == _tmp18_;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			ValaCCodeIdentifier* _tmp19_;
			_tmp19_ = vala_ccode_identifier_new ("g_value_get_boxed");
			result = (ValaCCodeExpression*) _tmp19_;
			_vala_code_node_unref0 (array_type);
			return result;
		} else {
			ValaCCodeIdentifier* _tmp20_;
			_tmp20_ = vala_ccode_identifier_new ("g_value_get_pointer");
			result = (ValaCCodeExpression*) _tmp20_;
			_vala_code_node_unref0 (array_type);
			return result;
		}
	}
}

static ValaCCodeExpression*
vala_gvalue_module_real_get_value_setter_function (ValaCCodeBaseModule* base,
                                                   ValaDataType* type_reference)
{
	ValaGValueModule * self;
	ValaArrayType* array_type = NULL;
	ValaArrayType* _tmp0_;
	ValaTypeSymbol* _tmp1_;
	ValaTypeSymbol* _tmp2_;
	ValaCCodeExpression* result;
	self = (ValaGValueModule*) base;
	g_return_val_if_fail (type_reference != NULL, NULL);
	_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type_reference, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type_reference) : NULL);
	array_type = _tmp0_;
	_tmp1_ = vala_data_type_get_type_symbol (type_reference);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		ValaTypeSymbol* _tmp3_;
		ValaTypeSymbol* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		ValaCCodeIdentifier* _tmp7_;
		ValaCCodeExpression* _tmp8_;
		_tmp3_ = vala_data_type_get_type_symbol (type_reference);
		_tmp4_ = _tmp3_;
		_tmp5_ = vala_get_ccode_set_value_function ((ValaCodeNode*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = vala_ccode_identifier_new (_tmp6_);
		_tmp8_ = (ValaCCodeExpression*) _tmp7_;
		_g_free0 (_tmp6_);
		result = _tmp8_;
		_vala_code_node_unref0 (array_type);
		return result;
	} else {
		gboolean _tmp9_ = FALSE;
		ValaArrayType* _tmp10_;
		_tmp10_ = array_type;
		if (_tmp10_ != NULL) {
			ValaArrayType* _tmp11_;
			ValaDataType* _tmp12_;
			ValaDataType* _tmp13_;
			ValaTypeSymbol* _tmp14_;
			ValaTypeSymbol* _tmp15_;
			ValaDataType* _tmp16_;
			ValaTypeSymbol* _tmp17_;
			ValaTypeSymbol* _tmp18_;
			_tmp11_ = array_type;
			_tmp12_ = vala_array_type_get_element_type (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = vala_data_type_get_type_symbol (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = ((ValaCCodeBaseModule*) self)->string_type;
			_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp9_ = _tmp15_ == _tmp18_;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			ValaCCodeIdentifier* _tmp19_;
			_tmp19_ = vala_ccode_identifier_new ("g_value_set_boxed");
			result = (ValaCCodeExpression*) _tmp19_;
			_vala_code_node_unref0 (array_type);
			return result;
		} else {
			ValaCCodeIdentifier* _tmp20_;
			_tmp20_ = vala_ccode_identifier_new ("g_value_set_pointer");
			result = (ValaCCodeExpression*) _tmp20_;
			_vala_code_node_unref0 (array_type);
			return result;
		}
	}
}

static ValaCCodeExpression*
vala_gvalue_module_real_get_value_taker_function (ValaCCodeBaseModule* base,
                                                  ValaDataType* type_reference)
{
	ValaGValueModule * self;
	ValaArrayType* array_type = NULL;
	ValaArrayType* _tmp0_;
	ValaTypeSymbol* _tmp1_;
	ValaTypeSymbol* _tmp2_;
	ValaCCodeExpression* result;
	self = (ValaGValueModule*) base;
	g_return_val_if_fail (type_reference != NULL, NULL);
	_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type_reference, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type_reference) : NULL);
	array_type = _tmp0_;
	_tmp1_ = vala_data_type_get_type_symbol (type_reference);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		ValaTypeSymbol* _tmp3_;
		ValaTypeSymbol* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		ValaCCodeIdentifier* _tmp7_;
		ValaCCodeExpression* _tmp8_;
		_tmp3_ = vala_data_type_get_type_symbol (type_reference);
		_tmp4_ = _tmp3_;
		_tmp5_ = vala_get_ccode_take_value_function ((ValaCodeNode*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = vala_ccode_identifier_new (_tmp6_);
		_tmp8_ = (ValaCCodeExpression*) _tmp7_;
		_g_free0 (_tmp6_);
		result = _tmp8_;
		_vala_code_node_unref0 (array_type);
		return result;
	} else {
		gboolean _tmp9_ = FALSE;
		ValaArrayType* _tmp10_;
		_tmp10_ = array_type;
		if (_tmp10_ != NULL) {
			ValaArrayType* _tmp11_;
			ValaDataType* _tmp12_;
			ValaDataType* _tmp13_;
			ValaTypeSymbol* _tmp14_;
			ValaTypeSymbol* _tmp15_;
			ValaDataType* _tmp16_;
			ValaTypeSymbol* _tmp17_;
			ValaTypeSymbol* _tmp18_;
			_tmp11_ = array_type;
			_tmp12_ = vala_array_type_get_element_type (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = vala_data_type_get_type_symbol (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = ((ValaCCodeBaseModule*) self)->string_type;
			_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp9_ = _tmp15_ == _tmp18_;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			ValaCCodeIdentifier* _tmp19_;
			_tmp19_ = vala_ccode_identifier_new ("g_value_take_boxed");
			result = (ValaCCodeExpression*) _tmp19_;
			_vala_code_node_unref0 (array_type);
			return result;
		} else {
			ValaCCodeIdentifier* _tmp20_;
			_tmp20_ = vala_ccode_identifier_new ("g_value_set_pointer");
			result = (ValaCCodeExpression*) _tmp20_;
			_vala_code_node_unref0 (array_type);
			return result;
		}
	}
}

ValaGValueModule*
vala_gvalue_module_construct (GType object_type)
{
	ValaGValueModule* self = NULL;
	self = (ValaGValueModule*) vala_gasync_module_construct (object_type);
	return self;
}

ValaGValueModule*
vala_gvalue_module_new (void)
{
	return vala_gvalue_module_construct (VALA_TYPE_GVALUE_MODULE);
}

static void
vala_gvalue_module_class_init (ValaGValueModuleClass * klass,
                               gpointer klass_data)
{
	vala_gvalue_module_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->visit_cast_expression = (void (*) (ValaCodeVisitor*, ValaCastExpression*)) vala_gvalue_module_real_visit_cast_expression;
	((ValaCCodeBaseModuleClass *) klass)->get_value_getter_function = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaDataType*)) vala_gvalue_module_real_get_value_getter_function;
	((ValaCCodeBaseModuleClass *) klass)->get_value_setter_function = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaDataType*)) vala_gvalue_module_real_get_value_setter_function;
	((ValaCCodeBaseModuleClass *) klass)->get_value_taker_function = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaDataType*)) vala_gvalue_module_real_get_value_taker_function;
}

static void
vala_gvalue_module_instance_init (ValaGValueModule * self,
                                  gpointer klass)
{
}

static GType
vala_gvalue_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaGValueModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_gvalue_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaGValueModule), 0, (GInstanceInitFunc) vala_gvalue_module_instance_init, NULL };
	GType vala_gvalue_module_type_id;
	vala_gvalue_module_type_id = g_type_register_static (VALA_TYPE_GASYNC_MODULE, "ValaGValueModule", &g_define_type_info, 0);
	return vala_gvalue_module_type_id;
}

GType
vala_gvalue_module_get_type (void)
{
	static volatile gsize vala_gvalue_module_type_id__once = 0;
	if (g_once_init_enter (&vala_gvalue_module_type_id__once)) {
		GType vala_gvalue_module_type_id;
		vala_gvalue_module_type_id = vala_gvalue_module_get_type_once ();
		g_once_init_leave (&vala_gvalue_module_type_id__once, vala_gvalue_module_type_id);
	}
	return vala_gvalue_module_type_id__once;
}

