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

/* valaforstatement.vala
 *
 * Copyright (C) 2006-2010  Jürg Billeter
 *
 * 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>
 */

#include <glib.h>
#include <glib-object.h>
#include "vala.h"
#include <valagee.h>

#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ValaForStatementPrivate {
	ValaList* initializer;
	ValaList* iterator;
	ValaExpression* _condition;
	ValaBlock* _body;
};


static gpointer vala_for_statement_parent_class = NULL;
static ValaStatementIface * vala_for_statement_vala_statement_parent_iface = NULL;

#define VALA_FOR_STATEMENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_FOR_STATEMENT, ValaForStatementPrivate))
static void vala_for_statement_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor);
static void vala_for_statement_real_accept_children (ValaCodeNode* base, ValaCodeVisitor* visitor);
static gboolean vala_for_statement_always_true (ValaForStatement* self, ValaExpression* condition);
static gboolean vala_for_statement_always_false (ValaForStatement* self, ValaExpression* condition);
static gboolean vala_for_statement_real_check (ValaCodeNode* base, ValaCodeContext* context);
static void vala_for_statement_finalize (ValaCodeNode * obj);


/**
 * Creates a new for statement.
 *
 * @param condition        loop condition
 * @param body             loop body
 * @param source_reference reference to source code
 * @return                 newly created for statement
 */
ValaForStatement* vala_for_statement_construct (GType object_type, ValaExpression* condition, ValaBlock* body, ValaSourceReference* source_reference) {
	ValaForStatement* self = NULL;
	ValaExpression* _tmp0_;
	ValaBlock* _tmp1_;
	ValaSourceReference* _tmp2_;
	g_return_val_if_fail (body != NULL, NULL);
	self = (ValaForStatement*) vala_code_node_construct (object_type);
	_tmp0_ = condition;
	vala_for_statement_set_condition (self, _tmp0_);
	_tmp1_ = body;
	vala_for_statement_set_body (self, _tmp1_);
	_tmp2_ = source_reference;
	vala_code_node_set_source_reference ((ValaCodeNode*) self, _tmp2_);
	return self;
}


ValaForStatement* vala_for_statement_new (ValaExpression* condition, ValaBlock* body, ValaSourceReference* source_reference) {
	return vala_for_statement_construct (VALA_TYPE_FOR_STATEMENT, condition, body, source_reference);
}


/**
 * Appends the specified expression to the list of initializers.
 *
 * @param init an initializer expression
 */
void vala_for_statement_add_initializer (ValaForStatement* self, ValaExpression* init) {
	ValaExpression* _tmp0_;
	ValaList* _tmp1_;
	ValaExpression* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (init != NULL);
	_tmp0_ = init;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp0_, (ValaCodeNode*) self);
	_tmp1_ = self->priv->initializer;
	_tmp2_ = init;
	vala_collection_add ((ValaCollection*) _tmp1_, _tmp2_);
}


/**
 * Returns a copy of the list of initializers.
 *
 * @return initializer list
 */
static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


ValaList* vala_for_statement_get_initializer (ValaForStatement* self) {
	ValaList* result = NULL;
	ValaList* _tmp0_;
	ValaList* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->initializer;
	_tmp1_ = _vala_iterable_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


/**
 * Appends the specified expression to the iterator.
 *
 * @param iter an iterator expression
 */
void vala_for_statement_add_iterator (ValaForStatement* self, ValaExpression* iter) {
	ValaExpression* _tmp0_;
	ValaList* _tmp1_;
	ValaExpression* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = iter;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp0_, (ValaCodeNode*) self);
	_tmp1_ = self->priv->iterator;
	_tmp2_ = iter;
	vala_collection_add ((ValaCollection*) _tmp1_, _tmp2_);
}


/**
 * Returns a copy of the iterator.
 *
 * @return iterator
 */
ValaList* vala_for_statement_get_iterator (ValaForStatement* self) {
	ValaList* result = NULL;
	ValaList* _tmp0_;
	ValaList* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->iterator;
	_tmp1_ = _vala_iterable_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static void vala_for_statement_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor) {
	ValaForStatement * self;
	ValaCodeVisitor* _tmp0_;
	self = (ValaForStatement*) base;
	g_return_if_fail (visitor != NULL);
	_tmp0_ = visitor;
	vala_code_visitor_visit_for_statement (_tmp0_, self);
}


static void vala_for_statement_real_accept_children (ValaCodeNode* base, ValaCodeVisitor* visitor) {
	ValaForStatement * self;
	ValaExpression* _tmp15_;
	ValaExpression* _tmp16_;
	ValaBlock* _tmp38_;
	ValaBlock* _tmp39_;
	ValaCodeVisitor* _tmp40_;
	self = (ValaForStatement*) base;
	g_return_if_fail (visitor != NULL);
	{
		ValaList* _init_expr_list = NULL;
		ValaList* _tmp0_;
		ValaList* _tmp1_;
		gint _init_expr_size = 0;
		ValaList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _init_expr_index = 0;
		_tmp0_ = self->priv->initializer;
		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
		_init_expr_list = _tmp1_;
		_tmp2_ = _init_expr_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_init_expr_size = _tmp4_;
		_init_expr_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			ValaExpression* init_expr = NULL;
			ValaList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			ValaExpression* _tmp11_;
			ValaCodeVisitor* _tmp12_;
			ValaCodeVisitor* _tmp13_;
			ValaExpression* _tmp14_;
			_tmp5_ = _init_expr_index;
			_init_expr_index = _tmp5_ + 1;
			_tmp6_ = _init_expr_index;
			_tmp7_ = _init_expr_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _init_expr_list;
			_tmp9_ = _init_expr_index;
			_tmp10_ = vala_list_get (_tmp8_, _tmp9_);
			init_expr = (ValaExpression*) _tmp10_;
			_tmp11_ = init_expr;
			_tmp12_ = visitor;
			vala_code_node_accept ((ValaCodeNode*) _tmp11_, _tmp12_);
			_tmp13_ = visitor;
			_tmp14_ = init_expr;
			vala_code_visitor_visit_end_full_expression (_tmp13_, _tmp14_);
			_vala_code_node_unref0 (init_expr);
		}
		_vala_iterable_unref0 (_init_expr_list);
	}
	_tmp15_ = vala_for_statement_get_condition (self);
	_tmp16_ = _tmp15_;
	if (_tmp16_ != NULL) {
		ValaExpression* _tmp17_;
		ValaExpression* _tmp18_;
		ValaCodeVisitor* _tmp19_;
		ValaCodeVisitor* _tmp20_;
		ValaExpression* _tmp21_;
		ValaExpression* _tmp22_;
		_tmp17_ = vala_for_statement_get_condition (self);
		_tmp18_ = _tmp17_;
		_tmp19_ = visitor;
		vala_code_node_accept ((ValaCodeNode*) _tmp18_, _tmp19_);
		_tmp20_ = visitor;
		_tmp21_ = vala_for_statement_get_condition (self);
		_tmp22_ = _tmp21_;
		vala_code_visitor_visit_end_full_expression (_tmp20_, _tmp22_);
	}
	{
		ValaList* _it_expr_list = NULL;
		ValaList* _tmp23_;
		ValaList* _tmp24_;
		gint _it_expr_size = 0;
		ValaList* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		gint _it_expr_index = 0;
		_tmp23_ = self->priv->iterator;
		_tmp24_ = _vala_iterable_ref0 (_tmp23_);
		_it_expr_list = _tmp24_;
		_tmp25_ = _it_expr_list;
		_tmp26_ = vala_collection_get_size ((ValaCollection*) _tmp25_);
		_tmp27_ = _tmp26_;
		_it_expr_size = _tmp27_;
		_it_expr_index = -1;
		while (TRUE) {
			gint _tmp28_;
			gint _tmp29_;
			gint _tmp30_;
			ValaExpression* it_expr = NULL;
			ValaList* _tmp31_;
			gint _tmp32_;
			gpointer _tmp33_;
			ValaExpression* _tmp34_;
			ValaCodeVisitor* _tmp35_;
			ValaCodeVisitor* _tmp36_;
			ValaExpression* _tmp37_;
			_tmp28_ = _it_expr_index;
			_it_expr_index = _tmp28_ + 1;
			_tmp29_ = _it_expr_index;
			_tmp30_ = _it_expr_size;
			if (!(_tmp29_ < _tmp30_)) {
				break;
			}
			_tmp31_ = _it_expr_list;
			_tmp32_ = _it_expr_index;
			_tmp33_ = vala_list_get (_tmp31_, _tmp32_);
			it_expr = (ValaExpression*) _tmp33_;
			_tmp34_ = it_expr;
			_tmp35_ = visitor;
			vala_code_node_accept ((ValaCodeNode*) _tmp34_, _tmp35_);
			_tmp36_ = visitor;
			_tmp37_ = it_expr;
			vala_code_visitor_visit_end_full_expression (_tmp36_, _tmp37_);
			_vala_code_node_unref0 (it_expr);
		}
		_vala_iterable_unref0 (_it_expr_list);
	}
	_tmp38_ = vala_for_statement_get_body (self);
	_tmp39_ = _tmp38_;
	_tmp40_ = visitor;
	vala_code_node_accept ((ValaCodeNode*) _tmp39_, _tmp40_);
}


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


static gboolean vala_for_statement_always_true (ValaForStatement* self, ValaExpression* condition) {
	gboolean result = FALSE;
	ValaBooleanLiteral* literal = NULL;
	ValaExpression* _tmp0_;
	ValaBooleanLiteral* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ValaBooleanLiteral* _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (condition != NULL, FALSE);
	_tmp0_ = condition;
	_tmp1_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_BOOLEAN_LITERAL) ? ((ValaBooleanLiteral*) _tmp0_) : NULL);
	literal = _tmp1_;
	_tmp3_ = literal;
	if (_tmp3_ != NULL) {
		ValaBooleanLiteral* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = literal;
		_tmp5_ = vala_boolean_literal_get_value (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = _tmp6_;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_vala_code_node_unref0 (literal);
	return result;
}


static gboolean vala_for_statement_always_false (ValaForStatement* self, ValaExpression* condition) {
	gboolean result = FALSE;
	ValaBooleanLiteral* literal = NULL;
	ValaExpression* _tmp0_;
	ValaBooleanLiteral* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ValaBooleanLiteral* _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (condition != NULL, FALSE);
	_tmp0_ = condition;
	_tmp1_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_BOOLEAN_LITERAL) ? ((ValaBooleanLiteral*) _tmp0_) : NULL);
	literal = _tmp1_;
	_tmp3_ = literal;
	if (_tmp3_ != NULL) {
		ValaBooleanLiteral* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = literal;
		_tmp5_ = vala_boolean_literal_get_value (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = !_tmp6_;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_vala_code_node_unref0 (literal);
	return result;
}


static gboolean vala_for_statement_real_check (ValaCodeNode* base, ValaCodeContext* context) {
	ValaForStatement * self;
	gboolean result = FALSE;
	ValaBlock* block = NULL;
	ValaSourceReference* _tmp0_;
	ValaSourceReference* _tmp1_;
	ValaBlock* _tmp2_;
	gboolean _tmp21_ = FALSE;
	ValaExpression* _tmp22_;
	ValaExpression* _tmp23_;
	ValaLocalVariable* first_local = NULL;
	ValaCodeContext* _tmp67_;
	ValaSemanticAnalyzer* _tmp68_;
	ValaSemanticAnalyzer* _tmp69_;
	ValaDataType* _tmp70_;
	ValaDataType* _tmp71_;
	ValaDataType* _tmp72_;
	gchar* _tmp73_;
	gchar* _tmp74_;
	ValaSourceReference* _tmp75_;
	ValaSourceReference* _tmp76_;
	ValaBooleanLiteral* _tmp77_;
	ValaBooleanLiteral* _tmp78_;
	ValaSourceReference* _tmp79_;
	ValaSourceReference* _tmp80_;
	ValaLocalVariable* _tmp81_;
	ValaLocalVariable* _tmp82_;
	ValaBlock* _tmp83_;
	ValaLocalVariable* _tmp84_;
	ValaSourceReference* _tmp85_;
	ValaSourceReference* _tmp86_;
	ValaDeclarationStatement* _tmp87_;
	ValaDeclarationStatement* _tmp88_;
	ValaBlock* iterator_block = NULL;
	ValaSourceReference* _tmp89_;
	ValaSourceReference* _tmp90_;
	ValaBlock* _tmp91_;
	ValaIfStatement* first_if = NULL;
	ValaLocalVariable* _tmp110_;
	const gchar* _tmp111_;
	const gchar* _tmp112_;
	ValaSourceReference* _tmp113_;
	ValaSourceReference* _tmp114_;
	ValaMemberAccess* _tmp115_;
	ValaMemberAccess* _tmp116_;
	ValaSourceReference* _tmp117_;
	ValaSourceReference* _tmp118_;
	ValaUnaryExpression* _tmp119_;
	ValaUnaryExpression* _tmp120_;
	ValaBlock* _tmp121_;
	ValaSourceReference* _tmp122_;
	ValaSourceReference* _tmp123_;
	ValaIfStatement* _tmp124_;
	ValaIfStatement* _tmp125_;
	ValaBlock* _tmp126_;
	ValaBlock* _tmp127_;
	ValaBlock* _tmp128_;
	ValaBlock* _tmp129_;
	ValaLocalVariable* _tmp130_;
	const gchar* _tmp131_;
	const gchar* _tmp132_;
	ValaSourceReference* _tmp133_;
	ValaSourceReference* _tmp134_;
	ValaMemberAccess* _tmp135_;
	ValaMemberAccess* _tmp136_;
	ValaSourceReference* _tmp137_;
	ValaSourceReference* _tmp138_;
	ValaBooleanLiteral* _tmp139_;
	ValaBooleanLiteral* _tmp140_;
	ValaSourceReference* _tmp141_;
	ValaSourceReference* _tmp142_;
	ValaAssignment* _tmp143_;
	ValaAssignment* _tmp144_;
	ValaSourceReference* _tmp145_;
	ValaSourceReference* _tmp146_;
	ValaExpressionStatement* _tmp147_;
	ValaExpressionStatement* _tmp148_;
	ValaBlock* _tmp149_;
	ValaBlock* _tmp150_;
	ValaBlock* _tmp151_;
	ValaSourceReference* _tmp152_;
	ValaSourceReference* _tmp153_;
	ValaLoop* _tmp154_;
	ValaLoop* _tmp155_;
	ValaBlock* parent_block = NULL;
	ValaCodeNode* _tmp156_;
	ValaCodeNode* _tmp157_;
	ValaBlock* _tmp158_;
	ValaBlock* _tmp159_;
	ValaBlock* _tmp160_;
	ValaCodeContext* _tmp161_;
	gboolean _tmp162_;
	self = (ValaForStatement*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	_tmp0_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_block_new (_tmp1_);
	block = _tmp2_;
	{
		ValaList* _init_expr_list = NULL;
		ValaList* _tmp3_;
		ValaList* _tmp4_;
		gint _init_expr_size = 0;
		ValaList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _init_expr_index = 0;
		_tmp3_ = self->priv->initializer;
		_tmp4_ = _vala_iterable_ref0 (_tmp3_);
		_init_expr_list = _tmp4_;
		_tmp5_ = _init_expr_list;
		_tmp6_ = vala_collection_get_size ((ValaCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_init_expr_size = _tmp7_;
		_init_expr_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			gint _tmp10_;
			ValaExpression* init_expr = NULL;
			ValaList* _tmp11_;
			gint _tmp12_;
			gpointer _tmp13_;
			ValaBlock* _tmp14_;
			ValaExpression* _tmp15_;
			ValaExpression* _tmp16_;
			ValaSourceReference* _tmp17_;
			ValaSourceReference* _tmp18_;
			ValaExpressionStatement* _tmp19_;
			ValaExpressionStatement* _tmp20_;
			_tmp8_ = _init_expr_index;
			_init_expr_index = _tmp8_ + 1;
			_tmp9_ = _init_expr_index;
			_tmp10_ = _init_expr_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _init_expr_list;
			_tmp12_ = _init_expr_index;
			_tmp13_ = vala_list_get (_tmp11_, _tmp12_);
			init_expr = (ValaExpression*) _tmp13_;
			_tmp14_ = block;
			_tmp15_ = init_expr;
			_tmp16_ = init_expr;
			_tmp17_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = vala_expression_statement_new (_tmp15_, _tmp18_);
			_tmp20_ = _tmp19_;
			vala_block_add_statement (_tmp14_, (ValaStatement*) _tmp20_);
			_vala_code_node_unref0 (_tmp20_);
			_vala_code_node_unref0 (init_expr);
		}
		_vala_iterable_unref0 (_init_expr_list);
	}
	_tmp22_ = vala_for_statement_get_condition (self);
	_tmp23_ = _tmp22_;
	if (_tmp23_ == NULL) {
		_tmp21_ = TRUE;
	} else {
		ValaExpression* _tmp24_;
		ValaExpression* _tmp25_;
		gboolean _tmp26_;
		_tmp24_ = vala_for_statement_get_condition (self);
		_tmp25_ = _tmp24_;
		_tmp26_ = vala_for_statement_always_true (self, _tmp25_);
		_tmp21_ = _tmp26_;
	}
	if (_tmp21_) {
	} else {
		ValaExpression* _tmp27_;
		ValaExpression* _tmp28_;
		gboolean _tmp29_;
		_tmp27_ = vala_for_statement_get_condition (self);
		_tmp28_ = _tmp27_;
		_tmp29_ = vala_for_statement_always_false (self, _tmp28_);
		if (_tmp29_) {
			ValaBlock* _tmp30_;
			ValaBlock* _tmp31_;
			ValaExpression* _tmp32_;
			ValaExpression* _tmp33_;
			ValaSourceReference* _tmp34_;
			ValaSourceReference* _tmp35_;
			ValaBreakStatement* _tmp36_;
			ValaBreakStatement* _tmp37_;
			_tmp30_ = vala_for_statement_get_body (self);
			_tmp31_ = _tmp30_;
			_tmp32_ = vala_for_statement_get_condition (self);
			_tmp33_ = _tmp32_;
			_tmp34_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = vala_break_statement_new (_tmp35_);
			_tmp37_ = _tmp36_;
			vala_block_insert_statement (_tmp31_, 0, (ValaStatement*) _tmp37_);
			_vala_code_node_unref0 (_tmp37_);
		} else {
			ValaUnaryExpression* if_condition = NULL;
			ValaExpression* _tmp38_;
			ValaExpression* _tmp39_;
			ValaExpression* _tmp40_;
			ValaExpression* _tmp41_;
			ValaSourceReference* _tmp42_;
			ValaSourceReference* _tmp43_;
			ValaUnaryExpression* _tmp44_;
			ValaBlock* true_block = NULL;
			ValaExpression* _tmp45_;
			ValaExpression* _tmp46_;
			ValaSourceReference* _tmp47_;
			ValaSourceReference* _tmp48_;
			ValaBlock* _tmp49_;
			ValaBlock* _tmp50_;
			ValaExpression* _tmp51_;
			ValaExpression* _tmp52_;
			ValaSourceReference* _tmp53_;
			ValaSourceReference* _tmp54_;
			ValaBreakStatement* _tmp55_;
			ValaBreakStatement* _tmp56_;
			ValaIfStatement* if_stmt = NULL;
			ValaUnaryExpression* _tmp57_;
			ValaBlock* _tmp58_;
			ValaExpression* _tmp59_;
			ValaExpression* _tmp60_;
			ValaSourceReference* _tmp61_;
			ValaSourceReference* _tmp62_;
			ValaIfStatement* _tmp63_;
			ValaBlock* _tmp64_;
			ValaBlock* _tmp65_;
			ValaIfStatement* _tmp66_;
			_tmp38_ = vala_for_statement_get_condition (self);
			_tmp39_ = _tmp38_;
			_tmp40_ = vala_for_statement_get_condition (self);
			_tmp41_ = _tmp40_;
			_tmp42_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp41_);
			_tmp43_ = _tmp42_;
			_tmp44_ = vala_unary_expression_new (VALA_UNARY_OPERATOR_LOGICAL_NEGATION, _tmp39_, _tmp43_);
			if_condition = _tmp44_;
			_tmp45_ = vala_for_statement_get_condition (self);
			_tmp46_ = _tmp45_;
			_tmp47_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp46_);
			_tmp48_ = _tmp47_;
			_tmp49_ = vala_block_new (_tmp48_);
			true_block = _tmp49_;
			_tmp50_ = true_block;
			_tmp51_ = vala_for_statement_get_condition (self);
			_tmp52_ = _tmp51_;
			_tmp53_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp52_);
			_tmp54_ = _tmp53_;
			_tmp55_ = vala_break_statement_new (_tmp54_);
			_tmp56_ = _tmp55_;
			vala_block_add_statement (_tmp50_, (ValaStatement*) _tmp56_);
			_vala_code_node_unref0 (_tmp56_);
			_tmp57_ = if_condition;
			_tmp58_ = true_block;
			_tmp59_ = vala_for_statement_get_condition (self);
			_tmp60_ = _tmp59_;
			_tmp61_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp60_);
			_tmp62_ = _tmp61_;
			_tmp63_ = vala_if_statement_new ((ValaExpression*) _tmp57_, _tmp58_, NULL, _tmp62_);
			if_stmt = _tmp63_;
			_tmp64_ = vala_for_statement_get_body (self);
			_tmp65_ = _tmp64_;
			_tmp66_ = if_stmt;
			vala_block_insert_statement (_tmp65_, 0, (ValaStatement*) _tmp66_);
			_vala_code_node_unref0 (if_stmt);
			_vala_code_node_unref0 (true_block);
			_vala_code_node_unref0 (if_condition);
		}
	}
	_tmp67_ = context;
	_tmp68_ = vala_code_context_get_analyzer (_tmp67_);
	_tmp69_ = _tmp68_;
	_tmp70_ = _tmp69_->bool_type;
	_tmp71_ = vala_data_type_copy (_tmp70_);
	_tmp72_ = _tmp71_;
	_tmp73_ = vala_code_node_get_temp_name ();
	_tmp74_ = _tmp73_;
	_tmp75_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp76_ = _tmp75_;
	_tmp77_ = vala_boolean_literal_new (TRUE, _tmp76_);
	_tmp78_ = _tmp77_;
	_tmp79_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp80_ = _tmp79_;
	_tmp81_ = vala_local_variable_new (_tmp72_, _tmp74_, (ValaExpression*) _tmp78_, _tmp80_);
	_tmp82_ = _tmp81_;
	_vala_code_node_unref0 (_tmp78_);
	_g_free0 (_tmp74_);
	_vala_code_node_unref0 (_tmp72_);
	first_local = _tmp82_;
	_tmp83_ = block;
	_tmp84_ = first_local;
	_tmp85_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp86_ = _tmp85_;
	_tmp87_ = vala_declaration_statement_new ((ValaSymbol*) _tmp84_, _tmp86_);
	_tmp88_ = _tmp87_;
	vala_block_add_statement (_tmp83_, (ValaStatement*) _tmp88_);
	_vala_code_node_unref0 (_tmp88_);
	_tmp89_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp90_ = _tmp89_;
	_tmp91_ = vala_block_new (_tmp90_);
	iterator_block = _tmp91_;
	{
		ValaList* _it_expr_list = NULL;
		ValaList* _tmp92_;
		ValaList* _tmp93_;
		gint _it_expr_size = 0;
		ValaList* _tmp94_;
		gint _tmp95_;
		gint _tmp96_;
		gint _it_expr_index = 0;
		_tmp92_ = self->priv->iterator;
		_tmp93_ = _vala_iterable_ref0 (_tmp92_);
		_it_expr_list = _tmp93_;
		_tmp94_ = _it_expr_list;
		_tmp95_ = vala_collection_get_size ((ValaCollection*) _tmp94_);
		_tmp96_ = _tmp95_;
		_it_expr_size = _tmp96_;
		_it_expr_index = -1;
		while (TRUE) {
			gint _tmp97_;
			gint _tmp98_;
			gint _tmp99_;
			ValaExpression* it_expr = NULL;
			ValaList* _tmp100_;
			gint _tmp101_;
			gpointer _tmp102_;
			ValaBlock* _tmp103_;
			ValaExpression* _tmp104_;
			ValaExpression* _tmp105_;
			ValaSourceReference* _tmp106_;
			ValaSourceReference* _tmp107_;
			ValaExpressionStatement* _tmp108_;
			ValaExpressionStatement* _tmp109_;
			_tmp97_ = _it_expr_index;
			_it_expr_index = _tmp97_ + 1;
			_tmp98_ = _it_expr_index;
			_tmp99_ = _it_expr_size;
			if (!(_tmp98_ < _tmp99_)) {
				break;
			}
			_tmp100_ = _it_expr_list;
			_tmp101_ = _it_expr_index;
			_tmp102_ = vala_list_get (_tmp100_, _tmp101_);
			it_expr = (ValaExpression*) _tmp102_;
			_tmp103_ = iterator_block;
			_tmp104_ = it_expr;
			_tmp105_ = it_expr;
			_tmp106_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp105_);
			_tmp107_ = _tmp106_;
			_tmp108_ = vala_expression_statement_new (_tmp104_, _tmp107_);
			_tmp109_ = _tmp108_;
			vala_block_add_statement (_tmp103_, (ValaStatement*) _tmp109_);
			_vala_code_node_unref0 (_tmp109_);
			_vala_code_node_unref0 (it_expr);
		}
		_vala_iterable_unref0 (_it_expr_list);
	}
	_tmp110_ = first_local;
	_tmp111_ = vala_symbol_get_name ((ValaSymbol*) _tmp110_);
	_tmp112_ = _tmp111_;
	_tmp113_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp114_ = _tmp113_;
	_tmp115_ = vala_member_access_new_simple (_tmp112_, _tmp114_);
	_tmp116_ = _tmp115_;
	_tmp117_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp118_ = _tmp117_;
	_tmp119_ = vala_unary_expression_new (VALA_UNARY_OPERATOR_LOGICAL_NEGATION, (ValaExpression*) _tmp116_, _tmp118_);
	_tmp120_ = _tmp119_;
	_tmp121_ = iterator_block;
	_tmp122_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp123_ = _tmp122_;
	_tmp124_ = vala_if_statement_new ((ValaExpression*) _tmp120_, _tmp121_, NULL, _tmp123_);
	_tmp125_ = _tmp124_;
	_vala_code_node_unref0 (_tmp120_);
	_vala_code_node_unref0 (_tmp116_);
	first_if = _tmp125_;
	_tmp126_ = vala_for_statement_get_body (self);
	_tmp127_ = _tmp126_;
	vala_block_insert_statement (_tmp127_, 0, (ValaStatement*) first_if);
	_tmp128_ = vala_for_statement_get_body (self);
	_tmp129_ = _tmp128_;
	_tmp130_ = first_local;
	_tmp131_ = vala_symbol_get_name ((ValaSymbol*) _tmp130_);
	_tmp132_ = _tmp131_;
	_tmp133_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp134_ = _tmp133_;
	_tmp135_ = vala_member_access_new_simple (_tmp132_, _tmp134_);
	_tmp136_ = _tmp135_;
	_tmp137_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp138_ = _tmp137_;
	_tmp139_ = vala_boolean_literal_new (FALSE, _tmp138_);
	_tmp140_ = _tmp139_;
	_tmp141_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp142_ = _tmp141_;
	_tmp143_ = vala_assignment_new ((ValaExpression*) _tmp136_, (ValaExpression*) _tmp140_, VALA_ASSIGNMENT_OPERATOR_SIMPLE, _tmp142_);
	_tmp144_ = _tmp143_;
	_tmp145_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp146_ = _tmp145_;
	_tmp147_ = vala_expression_statement_new ((ValaExpression*) _tmp144_, _tmp146_);
	_tmp148_ = _tmp147_;
	vala_block_insert_statement (_tmp129_, 1, (ValaStatement*) _tmp148_);
	_vala_code_node_unref0 (_tmp148_);
	_vala_code_node_unref0 (_tmp144_);
	_vala_code_node_unref0 (_tmp140_);
	_vala_code_node_unref0 (_tmp136_);
	_tmp149_ = block;
	_tmp150_ = vala_for_statement_get_body (self);
	_tmp151_ = _tmp150_;
	_tmp152_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp153_ = _tmp152_;
	_tmp154_ = vala_loop_new (_tmp151_, _tmp153_);
	_tmp155_ = _tmp154_;
	vala_block_add_statement (_tmp149_, (ValaStatement*) _tmp155_);
	_vala_code_node_unref0 (_tmp155_);
	_tmp156_ = vala_code_node_get_parent_node ((ValaCodeNode*) self);
	_tmp157_ = _tmp156_;
	_tmp158_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp157_, VALA_TYPE_BLOCK, ValaBlock));
	parent_block = _tmp158_;
	_tmp159_ = block;
	vala_block_replace_statement (parent_block, (ValaStatement*) self, (ValaStatement*) _tmp159_);
	_tmp160_ = block;
	_tmp161_ = context;
	_tmp162_ = vala_code_node_check ((ValaCodeNode*) _tmp160_, _tmp161_);
	result = _tmp162_;
	_vala_code_node_unref0 (parent_block);
	_vala_code_node_unref0 (first_if);
	_vala_code_node_unref0 (iterator_block);
	_vala_code_node_unref0 (first_local);
	_vala_code_node_unref0 (block);
	return result;
}


ValaExpression* vala_for_statement_get_condition (ValaForStatement* self) {
	ValaExpression* result;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_condition;
	result = _tmp0_;
	return result;
}


void vala_for_statement_set_condition (ValaForStatement* self, ValaExpression* value) {
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_condition);
	self->priv->_condition = _tmp1_;
	_tmp2_ = self->priv->_condition;
	if (_tmp2_ != NULL) {
		ValaExpression* _tmp3_;
		_tmp3_ = self->priv->_condition;
		vala_code_node_set_parent_node ((ValaCodeNode*) _tmp3_, (ValaCodeNode*) self);
	}
}


ValaBlock* vala_for_statement_get_body (ValaForStatement* self) {
	ValaBlock* result;
	ValaBlock* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_body;
	result = _tmp0_;
	return result;
}


void vala_for_statement_set_body (ValaForStatement* self, ValaBlock* value) {
	ValaBlock* _tmp0_;
	ValaBlock* _tmp1_;
	ValaBlock* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_body);
	self->priv->_body = _tmp1_;
	_tmp2_ = self->priv->_body;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp2_, (ValaCodeNode*) self);
}


static void vala_for_statement_class_init (ValaForStatementClass * klass) {
	vala_for_statement_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_for_statement_finalize;
	g_type_class_add_private (klass, sizeof (ValaForStatementPrivate));
	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode *, ValaCodeVisitor*)) vala_for_statement_real_accept;
	((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode *, ValaCodeVisitor*)) vala_for_statement_real_accept_children;
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode *, ValaCodeContext*)) vala_for_statement_real_check;
}


static void vala_for_statement_vala_statement_interface_init (ValaStatementIface * iface) {
	vala_for_statement_vala_statement_parent_iface = g_type_interface_peek_parent (iface);
}


static void vala_for_statement_instance_init (ValaForStatement * self) {
	GEqualFunc _tmp0_;
	ValaArrayList* _tmp1_;
	GEqualFunc _tmp2_;
	ValaArrayList* _tmp3_;
	self->priv = VALA_FOR_STATEMENT_GET_PRIVATE (self);
	_tmp0_ = g_direct_equal;
	_tmp1_ = vala_array_list_new (VALA_TYPE_EXPRESSION, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp0_);
	self->priv->initializer = (ValaList*) _tmp1_;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_array_list_new (VALA_TYPE_EXPRESSION, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp2_);
	self->priv->iterator = (ValaList*) _tmp3_;
}


static void vala_for_statement_finalize (ValaCodeNode * obj) {
	ValaForStatement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_FOR_STATEMENT, ValaForStatement);
	_vala_iterable_unref0 (self->priv->initializer);
	_vala_iterable_unref0 (self->priv->iterator);
	_vala_code_node_unref0 (self->priv->_condition);
	_vala_code_node_unref0 (self->priv->_body);
	VALA_CODE_NODE_CLASS (vala_for_statement_parent_class)->finalize (obj);
}


/**
 * Represents a for iteration statement in the source code.
 */
GType vala_for_statement_get_type (void) {
	static volatile gsize vala_for_statement_type_id__volatile = 0;
	if (g_once_init_enter (&vala_for_statement_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaForStatementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_for_statement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaForStatement), 0, (GInstanceInitFunc) vala_for_statement_instance_init, NULL };
		static const GInterfaceInfo vala_statement_info = { (GInterfaceInitFunc) vala_for_statement_vala_statement_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType vala_for_statement_type_id;
		vala_for_statement_type_id = g_type_register_static (VALA_TYPE_CODE_NODE, "ValaForStatement", &g_define_type_info, 0);
		g_type_add_interface_static (vala_for_statement_type_id, VALA_TYPE_STATEMENT, &vala_statement_info);
		g_once_init_leave (&vala_for_statement_type_id__volatile, vala_for_statement_type_id);
	}
	return vala_for_statement_type_id__volatile;
}



