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

/* teeiterator.vala
 *
 * Copyright (C) 2013  Maciej Piechotka
 *
 * 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:
 * 	Maciej Piechotka <uzytkownik2@gmail.com>
 */

#include <glib-object.h>
#include "gee.h"
#include <glib.h>
#include <gobject/gvaluecollector.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 GEE_TYPE_TEE_ITERATOR (gee_tee_iterator_get_type ())
#define GEE_TEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEE_ITERATOR, GeeTeeIterator))
#define GEE_TEE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEE_ITERATOR, GeeTeeIteratorClass))
#define GEE_IS_TEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEE_ITERATOR))
#define GEE_IS_TEE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEE_ITERATOR))
#define GEE_TEE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEE_ITERATOR, GeeTeeIteratorClass))

typedef struct _GeeTeeIterator GeeTeeIterator;
typedef struct _GeeTeeIteratorClass GeeTeeIteratorClass;
typedef struct _GeeTeeIteratorPrivate GeeTeeIteratorPrivate;

#define GEE_TEE_ITERATOR_TYPE_NODE (gee_tee_iterator_node_get_type ())
#define GEE_TEE_ITERATOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNode))
#define GEE_TEE_ITERATOR_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNodeClass))
#define GEE_TEE_ITERATOR_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TEE_ITERATOR_TYPE_NODE))
#define GEE_TEE_ITERATOR_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TEE_ITERATOR_TYPE_NODE))
#define GEE_TEE_ITERATOR_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNodeClass))

typedef struct _GeeTeeIteratorNode GeeTeeIteratorNode;
typedef struct _GeeTeeIteratorNodeClass GeeTeeIteratorNodeClass;
enum  {
	GEE_TEE_ITERATOR_0_PROPERTY,
	GEE_TEE_ITERATOR_G_TYPE,
	GEE_TEE_ITERATOR_G_DUP_FUNC,
	GEE_TEE_ITERATOR_G_DESTROY_FUNC,
	GEE_TEE_ITERATOR_VALID_PROPERTY,
	GEE_TEE_ITERATOR_READ_ONLY_PROPERTY,
	GEE_TEE_ITERATOR_NUM_PROPERTIES
};
static GParamSpec* gee_tee_iterator_properties[GEE_TEE_ITERATOR_NUM_PROPERTIES];
#define _gee_tee_iterator_node_unref0(var) ((var == NULL) ? NULL : (var = (gee_tee_iterator_node_unref (var), NULL)))
typedef struct _GeeTeeIteratorNodePrivate GeeTeeIteratorNodePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _gee_lazy_unref0(var) ((var == NULL) ? NULL : (var = (gee_lazy_unref (var), NULL)))
typedef struct _Block13Data Block13Data;
typedef struct _Block14Data Block14Data;
typedef struct _GeeTeeIteratorParamSpecNode GeeTeeIteratorParamSpecNode;

struct _GeeTeeIterator {
	GObject parent_instance;
	GeeTeeIteratorPrivate * priv;
};

struct _GeeTeeIteratorClass {
	GObjectClass parent_class;
};

struct _GeeTeeIteratorPrivate {
	GType g_type;
	GBoxedCopyFunc g_dup_func;
	GDestroyNotify g_destroy_func;
	GeeTeeIteratorNode* _head;
	gboolean _valid;
};

struct _GeeTeeIteratorNode {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GeeTeeIteratorNodePrivate * priv;
	GeeLazy* _data;
	GeeLazy* _next;
};

struct _GeeTeeIteratorNodeClass {
	GTypeClass parent_class;
	void (*finalize) (GeeTeeIteratorNode *self);
};

struct _Block13Data {
	int _ref_count_;
	GType g_type;
	GBoxedCopyFunc g_dup_func;
	GDestroyNotify g_destroy_func;
	GeeIterator* iterator;
	GeeLazy* dependent;
};

struct _Block14Data {
	int _ref_count_;
	Block13Data * _data13_;
};

struct _GeeTeeIteratorNodePrivate {
	GType g_type;
	GBoxedCopyFunc g_dup_func;
	GDestroyNotify g_destroy_func;
};

struct _GeeTeeIteratorParamSpecNode {
	GParamSpec parent_instance;
};

static gint GeeTeeIterator_private_offset;
static gpointer gee_tee_iterator_parent_class = NULL;
static gint GeeTeeIteratorNode_private_offset;
static gpointer gee_tee_iterator_node_parent_class = NULL;
static GeeTraversableIface * gee_tee_iterator_gee_traversable_parent_iface = NULL;
static GeeIteratorIface * gee_tee_iterator_gee_iterator_parent_iface = NULL;

 G_GNUC_INTERNAL GType gee_tee_iterator_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL gpointer gee_tee_iterator_node_ref (gpointer instance);
 G_GNUC_INTERNAL void gee_tee_iterator_node_unref (gpointer instance);
 G_GNUC_INTERNAL GParamSpec* gee_tee_iterator_param_spec_node (const gchar* name,
                                              const gchar* nick,
                                              const gchar* blurb,
                                              GType object_type,
                                              GParamFlags flags);
 G_GNUC_INTERNAL void gee_tee_iterator_value_set_node (GValue* value,
                                      gpointer v_object) G_GNUC_UNUSED ;
 G_GNUC_INTERNAL void gee_tee_iterator_value_take_node (GValue* value,
                                       gpointer v_object);
 G_GNUC_INTERNAL gpointer gee_tee_iterator_value_get_node (const GValue* value) G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GType gee_tee_iterator_node_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GeeTeeIterator* gee_tee_iterator_new (GType g_type,
                                      GBoxedCopyFunc g_dup_func,
                                      GDestroyNotify g_destroy_func,
                                      GeeTeeIteratorNode* head,
                                      gboolean valid);
 G_GNUC_INTERNAL GeeTeeIterator* gee_tee_iterator_construct (GType object_type,
                                            GType g_type,
                                            GBoxedCopyFunc g_dup_func,
                                            GDestroyNotify g_destroy_func,
                                            GeeTeeIteratorNode* head,
                                            gboolean valid);
static gboolean gee_tee_iterator_real_foreach (GeeTraversable* base,
                                        GeeForallFunc f,
                                        gpointer f_target);
static GeeIterator** gee_tee_iterator_real_tee (GeeTraversable* base,
                                         guint forks,
                                         gint* result_length1);
static gboolean gee_tee_iterator_real_next (GeeIterator* base);
static gboolean gee_tee_iterator_real_has_next (GeeIterator* base);
static gpointer gee_tee_iterator_real_get (GeeIterator* base);
static void gee_tee_iterator_real_remove (GeeIterator* base);
 G_GNUC_INTERNAL GeeLazy* gee_tee_iterator_create_nodes (GType g_type,
                                        GBoxedCopyFunc g_dup_func,
                                        GDestroyNotify g_destroy_func,
                                        GeeIterator* iterator,
                                        GeeLazy* dependent);
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_data_unref (void * _userdata_);
static GeeTeeIteratorNode* __lambda23_ (Block13Data* _data13_);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static gpointer __lambda24_ (Block14Data* _data14_);
static gpointer ___lambda24__gee_lazy_func (gpointer self);
 G_GNUC_INTERNAL GeeTeeIteratorNode* gee_tee_iterator_node_new (GType g_type,
                                               GBoxedCopyFunc g_dup_func,
                                               GDestroyNotify g_destroy_func,
                                               GeeLazy* data,
                                               GeeLazy* next);
 G_GNUC_INTERNAL GeeTeeIteratorNode* gee_tee_iterator_node_construct (GType object_type,
                                                     GType g_type,
                                                     GBoxedCopyFunc g_dup_func,
                                                     GDestroyNotify g_destroy_func,
                                                     GeeLazy* data,
                                                     GeeLazy* next);
static gpointer ___lambda23__gee_lazy_func (gpointer self);
static void gee_tee_iterator_node_finalize (GeeTeeIteratorNode * obj);
static GType gee_tee_iterator_node_get_type_once (void);
static void gee_tee_iterator_finalize (GObject * obj);
static GType gee_tee_iterator_get_type_once (void);
static void _vala_gee_tee_iterator_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static void _vala_gee_tee_iterator_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
gee_tee_iterator_get_instance_private (GeeTeeIterator* self)
{
	return G_STRUCT_MEMBER_P (self, GeeTeeIterator_private_offset);
}

static gpointer
_gee_tee_iterator_node_ref0 (gpointer self)
{
	return self ? gee_tee_iterator_node_ref (self) : NULL;
}

 G_GNUC_INTERNAL GeeTeeIterator*
gee_tee_iterator_construct (GType object_type,
                            GType g_type,
                            GBoxedCopyFunc g_dup_func,
                            GDestroyNotify g_destroy_func,
                            GeeTeeIteratorNode* head,
                            gboolean valid)
{
	GeeTeeIterator * self = NULL;
	GeeTeeIteratorNode* _tmp0_;
	self = (GeeTeeIterator*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, "g-destroy-func", g_destroy_func, NULL);
	self->priv->g_type = g_type;
	self->priv->g_dup_func = g_dup_func;
	self->priv->g_destroy_func = g_destroy_func;
	_tmp0_ = _gee_tee_iterator_node_ref0 (head);
	_gee_tee_iterator_node_unref0 (self->priv->_head);
	self->priv->_head = _tmp0_;
	self->priv->_valid = valid;
	return self;
}

 G_GNUC_INTERNAL GeeTeeIterator*
gee_tee_iterator_new (GType g_type,
                      GBoxedCopyFunc g_dup_func,
                      GDestroyNotify g_destroy_func,
                      GeeTeeIteratorNode* head,
                      gboolean valid)
{
	return gee_tee_iterator_construct (GEE_TYPE_TEE_ITERATOR, g_type, g_dup_func, g_destroy_func, head, valid);
}

static gboolean
gee_tee_iterator_real_foreach (GeeTraversable* base,
                               GeeForallFunc f,
                               gpointer f_target)
{
	GeeTeeIterator * self;
	GeeTeeIteratorNode* head = NULL;
	GeeTeeIteratorNode* _tmp0_;
	gboolean valid = FALSE;
	GeeTeeIteratorNode* next_head = NULL;
	GeeTeeIteratorNode* _tmp4_;
	GeeLazy* _tmp5_;
	gconstpointer _tmp6_;
	gconstpointer _tmp7_;
	GeeTeeIteratorNode* _tmp15_;
	gboolean result;
	self = (GeeTeeIterator*) base;
	_tmp0_ = self->priv->_head;
	self->priv->_head = NULL;
	head = _tmp0_;
	valid = self->priv->_valid;
	if (valid) {
		GeeTeeIteratorNode* _tmp1_;
		GeeLazy* _tmp2_;
		gpointer _tmp3_;
		_tmp1_ = head;
		_tmp2_ = _tmp1_->_data;
		_tmp3_ = gee_lazy_get (_tmp2_);
		if (!f (_tmp3_, f_target)) {
			result = FALSE;
			_gee_tee_iterator_node_unref0 (head);
			return result;
		}
	}
	_tmp4_ = head;
	_tmp5_ = _tmp4_->_next;
	_tmp6_ = gee_lazy_get_value (_tmp5_);
	_tmp7_ = _tmp6_;
	next_head = (GeeTeeIteratorNode*) _tmp7_;
	while (TRUE) {
		GeeTeeIteratorNode* _tmp8_;
		GeeTeeIteratorNode* _tmp9_;
		GeeTeeIteratorNode* _tmp10_;
		GeeTeeIteratorNode* _tmp11_;
		GeeLazy* _tmp12_;
		gpointer _tmp13_;
		_tmp8_ = next_head;
		if (!(_tmp8_ != NULL)) {
			break;
		}
		_tmp9_ = next_head;
		_tmp10_ = _gee_tee_iterator_node_ref0 (_tmp9_);
		_gee_tee_iterator_node_unref0 (head);
		head = _tmp10_;
		valid = TRUE;
		_tmp11_ = head;
		_tmp12_ = _tmp11_->_data;
		_tmp13_ = gee_lazy_get (_tmp12_);
		if (!f (_tmp13_, f_target)) {
			GeeTeeIteratorNode* _tmp14_;
			_tmp14_ = head;
			head = NULL;
			_gee_tee_iterator_node_unref0 (self->priv->_head);
			self->priv->_head = _tmp14_;
			self->priv->_valid = valid;
			result = FALSE;
			_gee_tee_iterator_node_unref0 (head);
			return result;
		}
	}
	_tmp15_ = head;
	head = NULL;
	_gee_tee_iterator_node_unref0 (self->priv->_head);
	self->priv->_head = _tmp15_;
	self->priv->_valid = valid;
	result = TRUE;
	_gee_tee_iterator_node_unref0 (head);
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static GeeIterator**
gee_tee_iterator_real_tee (GeeTraversable* base,
                           guint forks,
                           gint* result_length1)
{
	GeeTeeIterator * self;
	GeeIterator** result;
	self = (GeeTeeIterator*) base;
	if (forks == ((guint) 0)) {
		GeeIterator** _tmp0_;
		GeeIterator** _tmp1_;
		gint _tmp1__length1;
		_tmp0_ = g_new0 (GeeIterator*, 0 + 1);
		_tmp1_ = _tmp0_;
		_tmp1__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp1__length1;
		}
		result = _tmp1_;
		return result;
	} else {
		GeeIterator** _result_ = NULL;
		GeeIterator** _tmp2_;
		gint _result__length1;
		gint __result__size_;
		GeeIterator** _tmp3_;
		gint _tmp3__length1;
		GeeIterator* _tmp4_;
		GeeIterator** _tmp10_;
		gint _tmp10__length1;
		_tmp2_ = g_new0 (GeeIterator*, forks + 1);
		_result_ = _tmp2_;
		_result__length1 = forks;
		__result__size_ = _result__length1;
		_tmp3_ = _result_;
		_tmp3__length1 = _result__length1;
		_tmp4_ = _g_object_ref0 ((GeeIterator*) self);
		_g_object_unref0 (_tmp3_[0]);
		_tmp3_[0] = _tmp4_;
		{
			guint i = 0U;
			i = (guint) 1;
			{
				gboolean _tmp5_ = FALSE;
				_tmp5_ = TRUE;
				while (TRUE) {
					GeeIterator** _tmp7_;
					gint _tmp7__length1;
					GeeTeeIteratorNode* _tmp8_;
					GeeTeeIterator* _tmp9_;
					if (!_tmp5_) {
						guint _tmp6_;
						_tmp6_ = i;
						i = _tmp6_ + 1;
					}
					_tmp5_ = FALSE;
					if (!(i < forks)) {
						break;
					}
					_tmp7_ = _result_;
					_tmp7__length1 = _result__length1;
					_tmp8_ = self->priv->_head;
					_tmp9_ = gee_tee_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, (GDestroyNotify) self->priv->g_destroy_func, _tmp8_, self->priv->_valid);
					_g_object_unref0 (_tmp7_[i]);
					_tmp7_[i] = (GeeIterator*) _tmp9_;
				}
			}
		}
		_tmp10_ = _result_;
		_tmp10__length1 = _result__length1;
		if (result_length1) {
			*result_length1 = _tmp10__length1;
		}
		result = _tmp10_;
		return result;
	}
}

static gboolean
gee_tee_iterator_real_next (GeeIterator* base)
{
	GeeTeeIterator * self;
	GeeTeeIteratorNode* next = NULL;
	GeeTeeIteratorNode* _tmp0_;
	GeeLazy* _tmp1_;
	gconstpointer _tmp2_;
	gconstpointer _tmp3_;
	GeeTeeIteratorNode* _tmp4_;
	gboolean result;
	self = (GeeTeeIterator*) base;
	_tmp0_ = self->priv->_head;
	_tmp1_ = _tmp0_->_next;
	_tmp2_ = gee_lazy_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	next = (GeeTeeIteratorNode*) _tmp3_;
	_tmp4_ = next;
	if (_tmp4_ != NULL) {
		GeeTeeIteratorNode* _tmp5_;
		GeeTeeIteratorNode* _tmp6_;
		_tmp5_ = next;
		_tmp6_ = _gee_tee_iterator_node_ref0 (_tmp5_);
		_gee_tee_iterator_node_unref0 (self->priv->_head);
		self->priv->_head = _tmp6_;
		self->priv->_valid = TRUE;
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static gboolean
gee_tee_iterator_real_has_next (GeeIterator* base)
{
	GeeTeeIterator * self;
	GeeTeeIteratorNode* _tmp0_;
	GeeLazy* _tmp1_;
	gpointer _tmp2_;
	GeeTeeIteratorNode* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	self = (GeeTeeIterator*) base;
	_tmp0_ = self->priv->_head;
	_tmp1_ = _tmp0_->_next;
	_tmp2_ = gee_lazy_get (_tmp1_);
	_tmp3_ = (GeeTeeIteratorNode*) _tmp2_;
	_tmp4_ = _tmp3_ != NULL;
	_gee_tee_iterator_node_unref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

static gpointer
gee_tee_iterator_real_get (GeeIterator* base)
{
	GeeTeeIterator * self;
	GeeTeeIteratorNode* _tmp0_;
	GeeLazy* _tmp1_;
	gpointer _tmp2_;
	gpointer result;
	self = (GeeTeeIterator*) base;
	_tmp0_ = self->priv->_head;
	_tmp1_ = _tmp0_->_data;
	_tmp2_ = gee_lazy_get (_tmp1_);
	result = _tmp2_;
	return result;
}

static void
gee_tee_iterator_real_remove (GeeIterator* base)
{
	GeeTeeIterator * self;
	self = (GeeTeeIterator*) base;
	g_assert_not_reached ();
}

static gpointer
_gee_lazy_ref0 (gpointer self)
{
	return self ? gee_lazy_ref (self) : NULL;
}

static Block13Data*
block13_data_ref (Block13Data* _data13_)
{
	g_atomic_int_inc (&_data13_->_ref_count_);
	return _data13_;
}

static void
block13_data_unref (void * _userdata_)
{
	Block13Data* _data13_;
	_data13_ = (Block13Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
		GType g_type;
		GBoxedCopyFunc g_dup_func;
		GDestroyNotify g_destroy_func;
		g_type = _data13_->g_type;
		g_dup_func = _data13_->g_dup_func;
		g_destroy_func = _data13_->g_destroy_func;
		_g_object_unref0 (_data13_->iterator);
		_gee_lazy_unref0 (_data13_->dependent);
		g_slice_free (Block13Data, _data13_);
	}
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		GType g_type;
		GBoxedCopyFunc g_dup_func;
		GDestroyNotify g_destroy_func;
		g_type = _data14_->_data13_->g_type;
		g_dup_func = _data14_->_data13_->g_dup_func;
		g_destroy_func = _data14_->_data13_->g_destroy_func;
		block13_data_unref (_data14_->_data13_);
		_data14_->_data13_ = NULL;
		g_slice_free (Block14Data, _data14_);
	}
}

static gpointer
__lambda24_ (Block14Data* _data14_)
{
	Block13Data* _data13_;
	GType g_type;
	GBoxedCopyFunc g_dup_func;
	GDestroyNotify g_destroy_func;
	gpointer _tmp0_;
	gpointer result;
	_data13_ = _data14_->_data13_;
	g_type = _data13_->g_type;
	g_dup_func = _data13_->g_dup_func;
	g_destroy_func = _data13_->g_destroy_func;
	_tmp0_ = gee_iterator_get (_data13_->iterator);
	result = _tmp0_;
	return result;
}

static gpointer
___lambda24__gee_lazy_func (gpointer self)
{
	gpointer result;
	result = __lambda24_ (self);
	return result;
}

static GeeTeeIteratorNode*
__lambda23_ (Block13Data* _data13_)
{
	GType g_type;
	GBoxedCopyFunc g_dup_func;
	GDestroyNotify g_destroy_func;
	Block14Data* _data14_;
	GeeLazy* data = NULL;
	GeeLazy* _tmp0_;
	GeeLazy* next = NULL;
	GeeLazy* _tmp1_;
	GeeLazy* _tmp2_;
	GeeLazy* _tmp3_;
	GeeLazy* _tmp4_;
	GeeTeeIteratorNode* _tmp5_;
	GeeTeeIteratorNode* result;
	g_type = _data13_->g_type;
	g_dup_func = _data13_->g_dup_func;
	g_destroy_func = _data13_->g_destroy_func;
	_data14_ = g_slice_new0 (Block14Data);
	_data14_->_ref_count_ = 1;
	_data14_->_data13_ = block13_data_ref (_data13_);
	gee_lazy_eval (_data13_->dependent);
	if (!gee_iterator_next (_data13_->iterator)) {
		result = NULL;
		block14_data_unref (_data14_);
		_data14_ = NULL;
		return result;
	}
	_tmp0_ = gee_lazy_new (g_type, (GBoxedCopyFunc) g_dup_func, (GDestroyNotify) g_destroy_func, ___lambda24__gee_lazy_func, block14_data_ref (_data14_), block14_data_unref);
	data = _tmp0_;
	_tmp1_ = data;
	_tmp2_ = gee_tee_iterator_create_nodes (g_type, (GBoxedCopyFunc) g_dup_func, (GDestroyNotify) g_destroy_func, _data13_->iterator, _tmp1_);
	next = _tmp2_;
	_tmp3_ = data;
	data = NULL;
	_tmp4_ = next;
	next = NULL;
	_tmp5_ = gee_tee_iterator_node_new (g_type, (GBoxedCopyFunc) g_dup_func, (GDestroyNotify) g_destroy_func, _tmp3_, _tmp4_);
	result = _tmp5_;
	_gee_lazy_unref0 (next);
	_gee_lazy_unref0 (data);
	block14_data_unref (_data14_);
	_data14_ = NULL;
	return result;
}

static gpointer
___lambda23__gee_lazy_func (gpointer self)
{
	gpointer result;
	result = __lambda23_ (self);
	return result;
}

 G_GNUC_INTERNAL GeeLazy*
gee_tee_iterator_create_nodes (GType g_type,
                               GBoxedCopyFunc g_dup_func,
                               GDestroyNotify g_destroy_func,
                               GeeIterator* iterator,
                               GeeLazy* dependent)
{
	Block13Data* _data13_;
	GeeIterator* _tmp0_;
	GeeLazy* _tmp1_;
	GeeLazy* _tmp2_;
	GeeLazy* result;
	g_return_val_if_fail (iterator != NULL, NULL);
	g_return_val_if_fail (dependent != NULL, NULL);
	_data13_ = g_slice_new0 (Block13Data);
	_data13_->_ref_count_ = 1;
	_data13_->g_type = g_type;
	_data13_->g_dup_func = g_dup_func;
	_data13_->g_destroy_func = g_destroy_func;
	_tmp0_ = _g_object_ref0 (iterator);
	_g_object_unref0 (_data13_->iterator);
	_data13_->iterator = _tmp0_;
	_tmp1_ = _gee_lazy_ref0 (dependent);
	_gee_lazy_unref0 (_data13_->dependent);
	_data13_->dependent = _tmp1_;
	_tmp2_ = gee_lazy_new (GEE_TEE_ITERATOR_TYPE_NODE, (GBoxedCopyFunc) gee_tee_iterator_node_ref, (GDestroyNotify) gee_tee_iterator_node_unref, ___lambda23__gee_lazy_func, block13_data_ref (_data13_), block13_data_unref);
	result = _tmp2_;
	block13_data_unref (_data13_);
	_data13_ = NULL;
	return result;
}

static gboolean
gee_tee_iterator_real_get_valid (GeeIterator* base)
{
	gboolean result;
	GeeTeeIterator* self;
	self = (GeeTeeIterator*) base;
	result = self->priv->_valid;
	return result;
}

static gboolean
gee_tee_iterator_real_get_read_only (GeeIterator* base)
{
	gboolean result;
	GeeTeeIterator* self;
	self = (GeeTeeIterator*) base;
	result = TRUE;
	return result;
}

static inline gpointer
gee_tee_iterator_node_get_instance_private (GeeTeeIteratorNode* self)
{
	return G_STRUCT_MEMBER_P (self, GeeTeeIteratorNode_private_offset);
}

 G_GNUC_INTERNAL GeeTeeIteratorNode*
gee_tee_iterator_node_construct (GType object_type,
                                 GType g_type,
                                 GBoxedCopyFunc g_dup_func,
                                 GDestroyNotify g_destroy_func,
                                 GeeLazy* data,
                                 GeeLazy* next)
{
	GeeTeeIteratorNode* self = NULL;
	GeeLazy* _tmp0_;
	GeeLazy* _tmp1_;
	g_return_val_if_fail (data != NULL, NULL);
	g_return_val_if_fail (next != NULL, NULL);
	self = (GeeTeeIteratorNode*) g_type_create_instance (object_type);
	self->priv->g_type = g_type;
	self->priv->g_dup_func = g_dup_func;
	self->priv->g_destroy_func = g_destroy_func;
	_tmp0_ = data;
	data = NULL;
	_gee_lazy_unref0 (self->_data);
	self->_data = _tmp0_;
	_tmp1_ = next;
	next = NULL;
	_gee_lazy_unref0 (self->_next);
	self->_next = _tmp1_;
	_gee_lazy_unref0 (data);
	_gee_lazy_unref0 (next);
	return self;
}

 G_GNUC_INTERNAL GeeTeeIteratorNode*
gee_tee_iterator_node_new (GType g_type,
                           GBoxedCopyFunc g_dup_func,
                           GDestroyNotify g_destroy_func,
                           GeeLazy* data,
                           GeeLazy* next)
{
	return gee_tee_iterator_node_construct (GEE_TEE_ITERATOR_TYPE_NODE, g_type, g_dup_func, g_destroy_func, data, next);
}

static void
gee_tee_iterator_value_node_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
gee_tee_iterator_value_node_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		gee_tee_iterator_node_unref (value->data[0].v_pointer);
	}
}

static void
gee_tee_iterator_value_node_copy_value (const GValue* src_value,
                                        GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = gee_tee_iterator_node_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
gee_tee_iterator_value_node_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
gee_tee_iterator_value_node_collect_value (GValue* value,
                                           guint n_collect_values,
                                           GTypeCValue* collect_values,
                                           guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		GeeTeeIteratorNode * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = gee_tee_iterator_node_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
gee_tee_iterator_value_node_lcopy_value (const GValue* value,
                                         guint n_collect_values,
                                         GTypeCValue* collect_values,
                                         guint collect_flags)
{
	GeeTeeIteratorNode ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = gee_tee_iterator_node_ref (value->data[0].v_pointer);
	}
	return NULL;
}

 G_GNUC_INTERNAL GParamSpec*
gee_tee_iterator_param_spec_node (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags)
{
	GeeTeeIteratorParamSpecNode* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GEE_TEE_ITERATOR_TYPE_NODE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

 G_GNUC_INTERNAL gpointer
gee_tee_iterator_value_get_node (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEE_ITERATOR_TYPE_NODE), NULL);
	return value->data[0].v_pointer;
}

 G_GNUC_INTERNAL void
gee_tee_iterator_value_set_node (GValue* value,
                                 gpointer v_object)
{
	GeeTeeIteratorNode * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEE_ITERATOR_TYPE_NODE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TEE_ITERATOR_TYPE_NODE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		gee_tee_iterator_node_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gee_tee_iterator_node_unref (old);
	}
}

 G_GNUC_INTERNAL void
gee_tee_iterator_value_take_node (GValue* value,
                                  gpointer v_object)
{
	GeeTeeIteratorNode * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEE_ITERATOR_TYPE_NODE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TEE_ITERATOR_TYPE_NODE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gee_tee_iterator_node_unref (old);
	}
}

static void
gee_tee_iterator_node_class_init (GeeTeeIteratorNodeClass * klass,
                                  gpointer klass_data)
{
	gee_tee_iterator_node_parent_class = g_type_class_peek_parent (klass);
	((GeeTeeIteratorNodeClass *) klass)->finalize = gee_tee_iterator_node_finalize;
	g_type_class_adjust_private_offset (klass, &GeeTeeIteratorNode_private_offset);
}

static void
gee_tee_iterator_node_instance_init (GeeTeeIteratorNode * self,
                                     gpointer klass)
{
	self->priv = gee_tee_iterator_node_get_instance_private (self);
	self->ref_count = 1;
}

static void
gee_tee_iterator_node_finalize (GeeTeeIteratorNode * obj)
{
	GeeTeeIteratorNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNode);
	g_signal_handlers_destroy (self);
	_gee_lazy_unref0 (self->_data);
	_gee_lazy_unref0 (self->_next);
}

static GType
gee_tee_iterator_node_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { gee_tee_iterator_value_node_init, gee_tee_iterator_value_node_free_value, gee_tee_iterator_value_node_copy_value, gee_tee_iterator_value_node_peek_pointer, "p", gee_tee_iterator_value_node_collect_value, "p", gee_tee_iterator_value_node_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (GeeTeeIteratorNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tee_iterator_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTeeIteratorNode), 0, (GInstanceInitFunc) gee_tee_iterator_node_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType gee_tee_iterator_node_type_id;
	gee_tee_iterator_node_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeTeeIteratorNode", &g_define_type_info, &g_define_type_fundamental_info, 0);
	GeeTeeIteratorNode_private_offset = g_type_add_instance_private (gee_tee_iterator_node_type_id, sizeof (GeeTeeIteratorNodePrivate));
	return gee_tee_iterator_node_type_id;
}

 G_GNUC_INTERNAL GType
gee_tee_iterator_node_get_type (void)
{
	static volatile gsize gee_tee_iterator_node_type_id__once = 0;
	if (g_once_init_enter (&gee_tee_iterator_node_type_id__once)) {
		GType gee_tee_iterator_node_type_id;
		gee_tee_iterator_node_type_id = gee_tee_iterator_node_get_type_once ();
		g_once_init_leave (&gee_tee_iterator_node_type_id__once, gee_tee_iterator_node_type_id);
	}
	return gee_tee_iterator_node_type_id__once;
}

 G_GNUC_INTERNAL gpointer
gee_tee_iterator_node_ref (gpointer instance)
{
	GeeTeeIteratorNode * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

 G_GNUC_INTERNAL void
gee_tee_iterator_node_unref (gpointer instance)
{
	GeeTeeIteratorNode * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GEE_TEE_ITERATOR_NODE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
gee_tee_iterator_class_init (GeeTeeIteratorClass * klass,
                             gpointer klass_data)
{
	gee_tee_iterator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GeeTeeIterator_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gee_tee_iterator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gee_tee_iterator_set_property;
	G_OBJECT_CLASS (klass)->finalize = gee_tee_iterator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TEE_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TEE_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TEE_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TEE_ITERATOR_VALID_PROPERTY, gee_tee_iterator_properties[GEE_TEE_ITERATOR_VALID_PROPERTY] = g_param_spec_boolean ("valid", "valid", "valid", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TEE_ITERATOR_READ_ONLY_PROPERTY, gee_tee_iterator_properties[GEE_TEE_ITERATOR_READ_ONLY_PROPERTY] = g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static GType
gee_tee_iterator_gee_traversable_get_g_type (GeeTeeIterator* self)
{
	return (GType) self->priv->g_type;
}

static GBoxedCopyFunc
gee_tee_iterator_gee_traversable_get_g_dup_func (GeeTeeIterator* self)
{
	return (GBoxedCopyFunc) self->priv->g_dup_func;
}

static GDestroyNotify
gee_tee_iterator_gee_traversable_get_g_destroy_func (GeeTeeIterator* self)
{
	return (GDestroyNotify) self->priv->g_destroy_func;
}

static void
gee_tee_iterator_gee_traversable_interface_init (GeeTraversableIface * iface,
                                                 gpointer iface_data)
{
	gee_tee_iterator_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
	iface->foreach = (gboolean (*) (GeeTraversable*, GeeForallFunc, gpointer)) gee_tee_iterator_real_foreach;
	iface->tee = (GeeIterator** (*) (GeeTraversable*, guint, gint*)) gee_tee_iterator_real_tee;
	iface->get_g_type = (GType (*) (GeeTraversable *)) gee_tee_iterator_gee_traversable_get_g_type;
	iface->get_g_dup_func = (GBoxedCopyFunc (*) (GeeTraversable *)) gee_tee_iterator_gee_traversable_get_g_dup_func;
	iface->get_g_destroy_func = (GDestroyNotify (*) (GeeTraversable *)) gee_tee_iterator_gee_traversable_get_g_destroy_func;
}

static void
gee_tee_iterator_gee_iterator_interface_init (GeeIteratorIface * iface,
                                              gpointer iface_data)
{
	gee_tee_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
	iface->next = (gboolean (*) (GeeIterator*)) gee_tee_iterator_real_next;
	iface->has_next = (gboolean (*) (GeeIterator*)) gee_tee_iterator_real_has_next;
	iface->get = (gpointer (*) (GeeIterator*)) gee_tee_iterator_real_get;
	iface->remove = (void (*) (GeeIterator*)) gee_tee_iterator_real_remove;
	iface->get_valid = gee_tee_iterator_real_get_valid;
	iface->get_read_only = gee_tee_iterator_real_get_read_only;
}

static void
gee_tee_iterator_instance_init (GeeTeeIterator * self,
                                gpointer klass)
{
	self->priv = gee_tee_iterator_get_instance_private (self);
}

static void
gee_tee_iterator_finalize (GObject * obj)
{
	GeeTeeIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TEE_ITERATOR, GeeTeeIterator);
	_gee_tee_iterator_node_unref0 (self->priv->_head);
	G_OBJECT_CLASS (gee_tee_iterator_parent_class)->finalize (obj);
}

static GType
gee_tee_iterator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GeeTeeIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tee_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTeeIterator), 0, (GInstanceInitFunc) gee_tee_iterator_instance_init, NULL };
	static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gee_tee_iterator_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_tee_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gee_tee_iterator_type_id;
	gee_tee_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTeeIterator", &g_define_type_info, 0);
	g_type_add_interface_static (gee_tee_iterator_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
	g_type_add_interface_static (gee_tee_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
	GeeTeeIterator_private_offset = g_type_add_instance_private (gee_tee_iterator_type_id, sizeof (GeeTeeIteratorPrivate));
	return gee_tee_iterator_type_id;
}

 G_GNUC_INTERNAL GType
gee_tee_iterator_get_type (void)
{
	static volatile gsize gee_tee_iterator_type_id__once = 0;
	if (g_once_init_enter (&gee_tee_iterator_type_id__once)) {
		GType gee_tee_iterator_type_id;
		gee_tee_iterator_type_id = gee_tee_iterator_get_type_once ();
		g_once_init_leave (&gee_tee_iterator_type_id__once, gee_tee_iterator_type_id);
	}
	return gee_tee_iterator_type_id__once;
}

static void
_vala_gee_tee_iterator_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	GeeTeeIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TEE_ITERATOR, GeeTeeIterator);
	switch (property_id) {
		case GEE_TEE_ITERATOR_VALID_PROPERTY:
		g_value_set_boolean (value, gee_iterator_get_valid ((GeeIterator*) self));
		break;
		case GEE_TEE_ITERATOR_READ_ONLY_PROPERTY:
		g_value_set_boolean (value, gee_iterator_get_read_only ((GeeIterator*) self));
		break;
		case GEE_TEE_ITERATOR_G_TYPE:
		g_value_set_gtype (value, self->priv->g_type);
		break;
		case GEE_TEE_ITERATOR_G_DUP_FUNC:
		g_value_set_pointer (value, self->priv->g_dup_func);
		break;
		case GEE_TEE_ITERATOR_G_DESTROY_FUNC:
		g_value_set_pointer (value, self->priv->g_destroy_func);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gee_tee_iterator_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec)
{
	GeeTeeIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TEE_ITERATOR, GeeTeeIterator);
	switch (property_id) {
		case GEE_TEE_ITERATOR_G_TYPE:
		self->priv->g_type = g_value_get_gtype (value);
		break;
		case GEE_TEE_ITERATOR_G_DUP_FUNC:
		self->priv->g_dup_func = g_value_get_pointer (value);
		break;
		case GEE_TEE_ITERATOR_G_DESTROY_FUNC:
		self->priv->g_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

