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

/* valagirwriter.vala
 *
 * Copyright (C) 2008-2012  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 <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <valagee.h>
#include <glib/gstdio.h>


#define VALA_TYPE_GIR_WRITER (vala_gir_writer_get_type ())
#define VALA_GIR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_GIR_WRITER, ValaGIRWriter))
#define VALA_GIR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_GIR_WRITER, ValaGIRWriterClass))
#define VALA_IS_GIR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_GIR_WRITER))
#define VALA_IS_GIR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_GIR_WRITER))
#define VALA_GIR_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_GIR_WRITER, ValaGIRWriterClass))

typedef struct _ValaGIRWriter ValaGIRWriter;
typedef struct _ValaGIRWriterClass ValaGIRWriterClass;
typedef struct _ValaGIRWriterPrivate ValaGIRWriterPrivate;

#define VALA_GIR_WRITER_TYPE_GIR_NAMESPACE (vala_gir_writer_gir_namespace_get_type ())
typedef struct _ValaGIRWriterGIRNamespace ValaGIRWriterGIRNamespace;
#define _vala_code_context_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_context_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))
#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 _vala_gir_writer_gir_namespace_free0(var) ((var == NULL) ? NULL : (var = (vala_gir_writer_gir_namespace_free (var), NULL)))
#define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
#define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _ValaGIRWriter {
	ValaCodeVisitor parent_instance;
	ValaGIRWriterPrivate * priv;
};

struct _ValaGIRWriterClass {
	ValaCodeVisitorClass parent_class;
	gchar* (*get_interface_comment) (ValaGIRWriter* self, ValaInterface* iface);
	gchar* (*get_struct_comment) (ValaGIRWriter* self, ValaStruct* st);
	gchar* (*get_enum_comment) (ValaGIRWriter* self, ValaEnum* en);
	gchar* (*get_class_comment) (ValaGIRWriter* self, ValaClass* c);
	gchar* (*get_error_code_comment) (ValaGIRWriter* self, ValaErrorCode* ecode);
	gchar* (*get_enum_value_comment) (ValaGIRWriter* self, ValaEnumValue* ev);
	gchar* (*get_constant_comment) (ValaGIRWriter* self, ValaConstant* c);
	gchar* (*get_error_domain_comment) (ValaGIRWriter* self, ValaErrorDomain* edomain);
	gchar* (*get_field_comment) (ValaGIRWriter* self, ValaField* f);
	gchar* (*get_delegate_comment) (ValaGIRWriter* self, ValaDelegate* cb);
	gchar* (*get_method_comment) (ValaGIRWriter* self, ValaMethod* m);
	gchar* (*get_property_comment) (ValaGIRWriter* self, ValaProperty* prop);
	gchar* (*get_delegate_return_comment) (ValaGIRWriter* self, ValaDelegate* cb);
	gchar* (*get_signal_return_comment) (ValaGIRWriter* self, ValaSignal* sig);
	gchar* (*get_method_return_comment) (ValaGIRWriter* self, ValaMethod* m);
	gchar* (*get_signal_comment) (ValaGIRWriter* self, ValaSignal* sig);
	gchar* (*get_parameter_comment) (ValaGIRWriter* self, ValaParameter* param);
};

struct _ValaGIRWriterGIRNamespace {
	gchar* ns;
	gchar* version;
};

struct _ValaGIRWriterPrivate {
	ValaCodeContext* context;
	gchar* directory;
	gchar* gir_namespace;
	gchar* gir_version;
	gchar* gir_shared_library;
	GString* buffer;
	FILE* stream;
	ValaHashSet* unannotated_namespaces;
	ValaHashSet* our_namespaces;
	ValaArrayList* hierarchy;
	ValaArrayList* deferred;
	gint indent;
	ValaTypeSymbol* gobject_type;
	ValaTypeSymbol* ginitiallyunowned_type;
	ValaArrayList* externals;
	gint enum_value;
};


static gpointer vala_gir_writer_parent_class = NULL;

GType vala_gir_writer_get_type (void) G_GNUC_CONST;
static GType vala_gir_writer_gir_namespace_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static ValaGIRWriterGIRNamespace* vala_gir_writer_gir_namespace_dup (const ValaGIRWriterGIRNamespace* self);
static void vala_gir_writer_gir_namespace_free (ValaGIRWriterGIRNamespace* self);
static void vala_gir_writer_gir_namespace_copy (const ValaGIRWriterGIRNamespace* self, ValaGIRWriterGIRNamespace* dest);
static void vala_gir_writer_gir_namespace_destroy (ValaGIRWriterGIRNamespace* self);
#define VALA_GIR_WRITER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_GIR_WRITER, ValaGIRWriterPrivate))
enum  {
	VALA_GIR_WRITER_DUMMY_PROPERTY
};
static gboolean vala_gir_writer_gir_namespace_equal (ValaGIRWriterGIRNamespace *self, ValaGIRWriterGIRNamespace* g);
gchar* vala_gir_writer_get_interface_comment (ValaGIRWriter* self, ValaInterface* iface);
static gchar* vala_gir_writer_real_get_interface_comment (ValaGIRWriter* self, ValaInterface* iface);
gchar* vala_gir_writer_get_struct_comment (ValaGIRWriter* self, ValaStruct* st);
static gchar* vala_gir_writer_real_get_struct_comment (ValaGIRWriter* self, ValaStruct* st);
gchar* vala_gir_writer_get_enum_comment (ValaGIRWriter* self, ValaEnum* en);
static gchar* vala_gir_writer_real_get_enum_comment (ValaGIRWriter* self, ValaEnum* en);
gchar* vala_gir_writer_get_class_comment (ValaGIRWriter* self, ValaClass* c);
static gchar* vala_gir_writer_real_get_class_comment (ValaGIRWriter* self, ValaClass* c);
gchar* vala_gir_writer_get_error_code_comment (ValaGIRWriter* self, ValaErrorCode* ecode);
static gchar* vala_gir_writer_real_get_error_code_comment (ValaGIRWriter* self, ValaErrorCode* ecode);
gchar* vala_gir_writer_get_enum_value_comment (ValaGIRWriter* self, ValaEnumValue* ev);
static gchar* vala_gir_writer_real_get_enum_value_comment (ValaGIRWriter* self, ValaEnumValue* ev);
gchar* vala_gir_writer_get_constant_comment (ValaGIRWriter* self, ValaConstant* c);
static gchar* vala_gir_writer_real_get_constant_comment (ValaGIRWriter* self, ValaConstant* c);
gchar* vala_gir_writer_get_error_domain_comment (ValaGIRWriter* self, ValaErrorDomain* edomain);
static gchar* vala_gir_writer_real_get_error_domain_comment (ValaGIRWriter* self, ValaErrorDomain* edomain);
gchar* vala_gir_writer_get_field_comment (ValaGIRWriter* self, ValaField* f);
static gchar* vala_gir_writer_real_get_field_comment (ValaGIRWriter* self, ValaField* f);
gchar* vala_gir_writer_get_delegate_comment (ValaGIRWriter* self, ValaDelegate* cb);
static gchar* vala_gir_writer_real_get_delegate_comment (ValaGIRWriter* self, ValaDelegate* cb);
gchar* vala_gir_writer_get_method_comment (ValaGIRWriter* self, ValaMethod* m);
static gchar* vala_gir_writer_real_get_method_comment (ValaGIRWriter* self, ValaMethod* m);
gchar* vala_gir_writer_get_property_comment (ValaGIRWriter* self, ValaProperty* prop);
static gchar* vala_gir_writer_real_get_property_comment (ValaGIRWriter* self, ValaProperty* prop);
gchar* vala_gir_writer_get_delegate_return_comment (ValaGIRWriter* self, ValaDelegate* cb);
static gchar* vala_gir_writer_real_get_delegate_return_comment (ValaGIRWriter* self, ValaDelegate* cb);
gchar* vala_gir_writer_get_signal_return_comment (ValaGIRWriter* self, ValaSignal* sig);
static gchar* vala_gir_writer_real_get_signal_return_comment (ValaGIRWriter* self, ValaSignal* sig);
gchar* vala_gir_writer_get_method_return_comment (ValaGIRWriter* self, ValaMethod* m);
static gchar* vala_gir_writer_real_get_method_return_comment (ValaGIRWriter* self, ValaMethod* m);
gchar* vala_gir_writer_get_signal_comment (ValaGIRWriter* self, ValaSignal* sig);
static gchar* vala_gir_writer_real_get_signal_comment (ValaGIRWriter* self, ValaSignal* sig);
gchar* vala_gir_writer_get_parameter_comment (ValaGIRWriter* self, ValaParameter* param);
static gchar* vala_gir_writer_real_get_parameter_comment (ValaGIRWriter* self, ValaParameter* param);
void vala_gir_writer_write_includes (ValaGIRWriter* self);
static void vala_gir_writer_write_indent_stream (ValaGIRWriter* self);
void vala_gir_writer_write_file (ValaGIRWriter* self, ValaCodeContext* context, const gchar* directory, const gchar* gir_filename, const gchar* gir_namespace, const gchar* gir_version, const gchar* package, const gchar* gir_shared_library);
static void vala_gir_writer_write_package (ValaGIRWriter* self, const gchar* package);
static void vala_gir_writer_write_doc (ValaGIRWriter* self, const gchar* comment);
static void vala_gir_writer_write_indent (ValaGIRWriter* self);
static void vala_gir_writer_write_c_includes (ValaGIRWriter* self, ValaNamespace* ns);
gchar* vala_ccode_base_module_get_ccode_header_filenames (ValaSymbol* sym);
static void vala_gir_writer_write_c_include (ValaGIRWriter* self, const gchar* name);
static void vala_gir_writer_real_visit_namespace (ValaCodeVisitor* base, ValaNamespace* ns);
gchar* vala_ccode_base_module_get_ccode_prefix (ValaSymbol* sym);
static void vala_gir_writer_write_annotations (ValaGIRWriter* self, ValaCodeNode* node);
static void vala_gir_writer_visit_deferred (ValaGIRWriter* self);
static void vala_gir_writer_write_symbol_attributes (ValaGIRWriter* self, ValaSymbol* symbol);
static void vala_gir_writer_real_visit_class (ValaCodeVisitor* base, ValaClass* cl);
static gboolean vala_gir_writer_check_accessibility (ValaGIRWriter* self, ValaSymbol* sym);
static gchar* vala_gir_writer_get_gir_name (ValaGIRWriter* self, ValaSymbol* symbol);
static void vala_gir_writer_write_gtype_attributes (ValaGIRWriter* self, ValaTypeSymbol* symbol);
static gchar* vala_gir_writer_gi_type_name (ValaGIRWriter* self, ValaTypeSymbol* type_symbol);
gchar* vala_ccode_base_module_get_ccode_name (ValaCodeNode* node);
static void vala_gir_writer_write_ctype_attributes (ValaGIRWriter* self, ValaTypeSymbol* symbol, const gchar* suffix);
static void vala_gir_writer_do_write_signature (ValaGIRWriter* self, ValaMethod* m, const gchar* tag_name, gboolean instance, const gchar* name, const gchar* cname, ValaList* params, ValaDataType* return_type, gboolean can_fail, gboolean write_comment);
gchar* vala_ccode_base_module_get_ccode_finish_name (ValaMethod* m);
static void vala_gir_writer_write_signature (ValaGIRWriter* self, ValaMethod* m, const gchar* tag_name, gboolean write_doc, gboolean instance);
static void vala_gir_writer_real_visit_struct (ValaCodeVisitor* base, ValaStruct* st);
static void vala_gir_writer_real_visit_interface (ValaCodeVisitor* base, ValaInterface* iface);
static void vala_gir_writer_real_visit_enum (ValaCodeVisitor* base, ValaEnum* en);
static void vala_gir_writer_real_visit_enum_value (ValaCodeVisitor* base, ValaEnumValue* ev);
static gchar* vala_gir_writer_literal_expression_to_value_string (ValaGIRWriter* self, ValaExpression* literal);
static void vala_gir_writer_real_visit_error_domain (ValaCodeVisitor* base, ValaErrorDomain* edomain);
gchar* vala_ccode_base_module_get_quark_name (ValaErrorDomain* edomain);
static void vala_gir_writer_real_visit_error_code (ValaCodeVisitor* base, ValaErrorCode* ecode);
static void vala_gir_writer_real_visit_constant (ValaCodeVisitor* base, ValaConstant* c);
static void vala_gir_writer_write_type (ValaGIRWriter* self, ValaDataType* type, gint index, ValaParameterDirection direction);
static void vala_gir_writer_real_visit_field (ValaCodeVisitor* base, ValaField* f);
static void vala_gir_writer_write_implicit_params (ValaGIRWriter* self, ValaDataType* type, gint* index, gboolean has_array_length, const gchar* name, ValaParameterDirection direction);
static void vala_gir_writer_write_param_or_return (ValaGIRWriter* self, ValaDataType* type, gboolean is_parameter, gint* index, gboolean has_array_length, const gchar* name, const gchar* comment, ValaParameterDirection direction, gboolean constructor, gboolean caller_allocates);
static void vala_gir_writer_skip_implicit_params (ValaGIRWriter* self, ValaDataType* type, gint* index, gboolean has_array_length);
static void vala_gir_writer_write_params_and_return (ValaGIRWriter* self, ValaList* params, ValaDataType* return_type, gboolean return_array_length, const gchar* return_comment, gboolean constructor, ValaDataType* instance_type, gboolean user_data);
gboolean vala_ccode_base_module_get_ccode_array_length (ValaCodeNode* node);
static void vala_gir_writer_real_visit_delegate (ValaCodeVisitor* base, ValaDelegate* cb);
static void vala_gir_writer_real_visit_method (ValaCodeVisitor* base, ValaMethod* m);
static gboolean vala_gir_writer_check_signature (ValaGIRWriter* self, ValaMethod* m);
static gboolean vala_gir_writer_check_type (ValaGIRWriter* self, ValaDataType* type);
gchar* vala_ccode_base_module_get_ccode_lower_case_prefix (ValaSymbol* sym);
ValaDataType* vala_ccode_base_module_get_data_type_for_symbol (ValaTypeSymbol* sym);
static void vala_gir_writer_real_visit_creation_method (ValaCodeVisitor* base, ValaCreationMethod* m);
static void vala_gir_writer_real_visit_property (ValaCodeVisitor* base, ValaProperty* prop);
static void vala_gir_writer_real_visit_signal (ValaCodeVisitor* base, ValaSignal* sig);
static gchar* vala_gir_writer_camel_case_to_canonical (ValaGIRWriter* self, const gchar* name);
static gchar* vala_gir_writer_get_full_gir_name (ValaGIRWriter* self, ValaSymbol* sym);
static void vala_gir_writer_gir_namespace_init (ValaGIRWriterGIRNamespace *self, const gchar* ns, const gchar* version);
ValaGIRWriter* vala_gir_writer_new (void);
ValaGIRWriter* vala_gir_writer_construct (GType object_type);
static void vala_gir_writer_finalize (ValaCodeVisitor * obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static gchar* vala_gir_writer_real_get_interface_comment (ValaGIRWriter* self, ValaInterface* iface) {
	gchar* result = NULL;
	g_return_val_if_fail (iface != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_interface_comment (ValaGIRWriter* self, ValaInterface* iface) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_interface_comment (self, iface);
}


static gchar* vala_gir_writer_real_get_struct_comment (ValaGIRWriter* self, ValaStruct* st) {
	gchar* result = NULL;
	g_return_val_if_fail (st != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_struct_comment (ValaGIRWriter* self, ValaStruct* st) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_struct_comment (self, st);
}


static gchar* vala_gir_writer_real_get_enum_comment (ValaGIRWriter* self, ValaEnum* en) {
	gchar* result = NULL;
	g_return_val_if_fail (en != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_enum_comment (ValaGIRWriter* self, ValaEnum* en) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_enum_comment (self, en);
}


static gchar* vala_gir_writer_real_get_class_comment (ValaGIRWriter* self, ValaClass* c) {
	gchar* result = NULL;
	g_return_val_if_fail (c != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_class_comment (ValaGIRWriter* self, ValaClass* c) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_class_comment (self, c);
}


static gchar* vala_gir_writer_real_get_error_code_comment (ValaGIRWriter* self, ValaErrorCode* ecode) {
	gchar* result = NULL;
	g_return_val_if_fail (ecode != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_error_code_comment (ValaGIRWriter* self, ValaErrorCode* ecode) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_error_code_comment (self, ecode);
}


static gchar* vala_gir_writer_real_get_enum_value_comment (ValaGIRWriter* self, ValaEnumValue* ev) {
	gchar* result = NULL;
	g_return_val_if_fail (ev != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_enum_value_comment (ValaGIRWriter* self, ValaEnumValue* ev) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_enum_value_comment (self, ev);
}


static gchar* vala_gir_writer_real_get_constant_comment (ValaGIRWriter* self, ValaConstant* c) {
	gchar* result = NULL;
	g_return_val_if_fail (c != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_constant_comment (ValaGIRWriter* self, ValaConstant* c) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_constant_comment (self, c);
}


static gchar* vala_gir_writer_real_get_error_domain_comment (ValaGIRWriter* self, ValaErrorDomain* edomain) {
	gchar* result = NULL;
	g_return_val_if_fail (edomain != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_error_domain_comment (ValaGIRWriter* self, ValaErrorDomain* edomain) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_error_domain_comment (self, edomain);
}


static gchar* vala_gir_writer_real_get_field_comment (ValaGIRWriter* self, ValaField* f) {
	gchar* result = NULL;
	g_return_val_if_fail (f != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_field_comment (ValaGIRWriter* self, ValaField* f) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_field_comment (self, f);
}


static gchar* vala_gir_writer_real_get_delegate_comment (ValaGIRWriter* self, ValaDelegate* cb) {
	gchar* result = NULL;
	g_return_val_if_fail (cb != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_delegate_comment (ValaGIRWriter* self, ValaDelegate* cb) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_delegate_comment (self, cb);
}


static gchar* vala_gir_writer_real_get_method_comment (ValaGIRWriter* self, ValaMethod* m) {
	gchar* result = NULL;
	g_return_val_if_fail (m != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_method_comment (ValaGIRWriter* self, ValaMethod* m) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_method_comment (self, m);
}


static gchar* vala_gir_writer_real_get_property_comment (ValaGIRWriter* self, ValaProperty* prop) {
	gchar* result = NULL;
	g_return_val_if_fail (prop != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_property_comment (ValaGIRWriter* self, ValaProperty* prop) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_property_comment (self, prop);
}


static gchar* vala_gir_writer_real_get_delegate_return_comment (ValaGIRWriter* self, ValaDelegate* cb) {
	gchar* result = NULL;
	g_return_val_if_fail (cb != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_delegate_return_comment (ValaGIRWriter* self, ValaDelegate* cb) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_delegate_return_comment (self, cb);
}


static gchar* vala_gir_writer_real_get_signal_return_comment (ValaGIRWriter* self, ValaSignal* sig) {
	gchar* result = NULL;
	g_return_val_if_fail (sig != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_signal_return_comment (ValaGIRWriter* self, ValaSignal* sig) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_signal_return_comment (self, sig);
}


static gchar* vala_gir_writer_real_get_method_return_comment (ValaGIRWriter* self, ValaMethod* m) {
	gchar* result = NULL;
	g_return_val_if_fail (m != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_method_return_comment (ValaGIRWriter* self, ValaMethod* m) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_method_return_comment (self, m);
}


static gchar* vala_gir_writer_real_get_signal_comment (ValaGIRWriter* self, ValaSignal* sig) {
	gchar* result = NULL;
	g_return_val_if_fail (sig != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_signal_comment (ValaGIRWriter* self, ValaSignal* sig) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_signal_comment (self, sig);
}


static gchar* vala_gir_writer_real_get_parameter_comment (ValaGIRWriter* self, ValaParameter* param) {
	gchar* result = NULL;
	g_return_val_if_fail (param != NULL, NULL);
	result = NULL;
	return result;
}


gchar* vala_gir_writer_get_parameter_comment (ValaGIRWriter* self, ValaParameter* param) {
	g_return_val_if_fail (self != NULL, NULL);
	return VALA_GIR_WRITER_GET_CLASS (self)->get_parameter_comment (self, param);
}


static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


void vala_gir_writer_write_includes (ValaGIRWriter* self) {
	g_return_if_fail (self != NULL);
	{
		ValaArrayList* _i_list = NULL;
		ValaArrayList* _tmp0_;
		ValaArrayList* _tmp1_;
		gint _i_size = 0;
		ValaArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _i_index = 0;
		_tmp0_ = self->priv->externals;
		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
		_i_list = _tmp1_;
		_tmp2_ = _i_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_i_size = _tmp4_;
		_i_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			ValaGIRWriterGIRNamespace* i = NULL;
			ValaArrayList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			ValaGIRWriterGIRNamespace* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			_tmp5_ = _i_index;
			_i_index = _tmp5_ + 1;
			_tmp6_ = _i_index;
			_tmp7_ = _i_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _i_list;
			_tmp9_ = _i_index;
			_tmp10_ = vala_list_get ((ValaList*) _tmp8_, _tmp9_);
			i = (ValaGIRWriterGIRNamespace*) _tmp10_;
			_tmp11_ = i;
			_tmp12_ = (*_tmp11_).ns;
			_tmp13_ = self->priv->gir_namespace;
			if (g_strcmp0 (_tmp12_, _tmp13_) != 0) {
				FILE* _tmp14_;
				ValaGIRWriterGIRNamespace* _tmp15_;
				const gchar* _tmp16_;
				ValaGIRWriterGIRNamespace* _tmp17_;
				const gchar* _tmp18_;
				vala_gir_writer_write_indent_stream (self);
				_tmp14_ = self->priv->stream;
				_tmp15_ = i;
				_tmp16_ = (*_tmp15_).ns;
				_tmp17_ = i;
				_tmp18_ = (*_tmp17_).version;
				fprintf (_tmp14_, "<include name=\"%s\" version=\"%s\"/>\n", _tmp16_, _tmp18_);
			}
			_vala_gir_writer_gir_namespace_free0 (i);
		}
		_vala_iterable_unref0 (_i_list);
	}
}


/**
 * Writes the public interface of the specified code context into the
 * specified file.
 *
 * @param context      a code context
 * @param gir_filename a relative or absolute filename
 */
static gpointer _vala_code_context_ref0 (gpointer self) {
	return self ? vala_code_context_ref (self) : NULL;
}


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


void vala_gir_writer_write_file (ValaGIRWriter* self, ValaCodeContext* context, const gchar* directory, const gchar* gir_filename, const gchar* gir_namespace, const gchar* gir_version, const gchar* package, const gchar* gir_shared_library) {
	ValaCodeContext* _tmp0_;
	ValaCodeContext* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	ValaNamespace* root_symbol = NULL;
	ValaCodeContext* _tmp10_;
	ValaNamespace* _tmp11_;
	ValaNamespace* _tmp12_;
	ValaNamespace* _tmp13_;
	ValaSymbol* glib_ns = NULL;
	ValaNamespace* _tmp14_;
	ValaScope* _tmp15_;
	ValaScope* _tmp16_;
	ValaSymbol* _tmp17_;
	ValaSymbol* _tmp18_;
	ValaScope* _tmp19_;
	ValaScope* _tmp20_;
	ValaSymbol* _tmp21_;
	ValaSymbol* _tmp22_;
	ValaScope* _tmp23_;
	ValaScope* _tmp24_;
	ValaSymbol* _tmp25_;
	const gchar* _tmp26_;
	ValaCodeContext* _tmp27_;
	gint _tmp28_;
	GString* _tmp29_;
	gchar* filename = NULL;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	const gchar* _tmp33_;
	FILE* _tmp34_;
	FILE* _tmp35_;
	FILE* _tmp39_;
	FILE* _tmp40_;
	FILE* _tmp41_;
	FILE* _tmp42_;
	FILE* _tmp43_;
	FILE* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	FILE* _tmp47_;
	GString* _tmp48_;
	const gchar* _tmp49_;
	ValaHashSet* _tmp85_;
	gint _tmp86_;
	gint _tmp87_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	g_return_if_fail (directory != NULL);
	g_return_if_fail (gir_filename != NULL);
	g_return_if_fail (gir_namespace != NULL);
	g_return_if_fail (gir_version != NULL);
	g_return_if_fail (package != NULL);
	_tmp0_ = context;
	_tmp1_ = _vala_code_context_ref0 (_tmp0_);
	_vala_code_context_unref0 (self->priv->context);
	self->priv->context = _tmp1_;
	_tmp2_ = directory;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->directory);
	self->priv->directory = _tmp3_;
	_tmp4_ = gir_namespace;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 (self->priv->gir_namespace);
	self->priv->gir_namespace = _tmp5_;
	_tmp6_ = gir_version;
	_tmp7_ = g_strdup (_tmp6_);
	_g_free0 (self->priv->gir_version);
	self->priv->gir_version = _tmp7_;
	_tmp8_ = gir_shared_library;
	_tmp9_ = g_strdup (_tmp8_);
	_g_free0 (self->priv->gir_shared_library);
	self->priv->gir_shared_library = _tmp9_;
	_tmp10_ = context;
	_tmp11_ = vala_code_context_get_root (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = _vala_code_node_ref0 (_tmp12_);
	root_symbol = _tmp13_;
	_tmp14_ = root_symbol;
	_tmp15_ = vala_symbol_get_scope ((ValaSymbol*) _tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = vala_scope_lookup (_tmp16_, "GLib");
	glib_ns = _tmp17_;
	_tmp18_ = glib_ns;
	_tmp19_ = vala_symbol_get_scope (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = vala_scope_lookup (_tmp20_, "Object");
	_vala_code_node_unref0 (self->priv->gobject_type);
	self->priv->gobject_type = G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol);
	_tmp22_ = glib_ns;
	_tmp23_ = vala_symbol_get_scope (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = vala_scope_lookup (_tmp24_, "InitiallyUnowned");
	_vala_code_node_unref0 (self->priv->ginitiallyunowned_type);
	self->priv->ginitiallyunowned_type = G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol);
	_tmp26_ = package;
	vala_gir_writer_write_package (self, _tmp26_);
	_tmp27_ = context;
	vala_code_context_accept (_tmp27_, (ValaCodeVisitor*) self);
	_tmp28_ = self->priv->indent;
	self->priv->indent = _tmp28_ - 1;
	_tmp29_ = self->priv->buffer;
	g_string_append_printf (_tmp29_, "</repository>\n");
	_tmp30_ = directory;
	_tmp31_ = gir_filename;
	_tmp32_ = g_strdup_printf ("%s%c%s", _tmp30_, (gint) G_DIR_SEPARATOR, _tmp31_);
	filename = _tmp32_;
	_tmp33_ = filename;
	_tmp34_ = g_fopen (_tmp33_, "w");
	_fclose0 (self->priv->stream);
	self->priv->stream = _tmp34_;
	_tmp35_ = self->priv->stream;
	if (_tmp35_ == NULL) {
		const gchar* _tmp36_;
		gchar* _tmp37_;
		gchar* _tmp38_;
		_tmp36_ = filename;
		_tmp37_ = g_strdup_printf ("unable to open `%s' for writing", _tmp36_);
		_tmp38_ = _tmp37_;
		vala_report_error (NULL, _tmp38_);
		_g_free0 (_tmp38_);
		_g_free0 (filename);
		_vala_code_node_unref0 (glib_ns);
		_vala_code_node_unref0 (root_symbol);
		return;
	}
	_tmp39_ = self->priv->stream;
	fprintf (_tmp39_, "<?xml version=\"1.0\"?>\n");
	_tmp40_ = self->priv->stream;
	fprintf (_tmp40_, "<repository version=\"1.2\"");
	_tmp41_ = self->priv->stream;
	fprintf (_tmp41_, " xmlns=\"http://www.gtk.org/introspection/core/1.0\"");
	_tmp42_ = self->priv->stream;
	fprintf (_tmp42_, " xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"");
	_tmp43_ = self->priv->stream;
	fprintf (_tmp43_, " xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\"");
	_tmp44_ = self->priv->stream;
	fprintf (_tmp44_, ">\n");
	_tmp45_ = self->priv->indent;
	self->priv->indent = _tmp45_ + 1;
	vala_gir_writer_write_includes (self);
	_tmp46_ = self->priv->indent;
	self->priv->indent = _tmp46_ - 1;
	_tmp47_ = self->priv->stream;
	_tmp48_ = self->priv->buffer;
	_tmp49_ = _tmp48_->str;
	fputs (_tmp49_, _tmp47_);
	_fclose0 (self->priv->stream);
	self->priv->stream = NULL;
	{
		ValaIterator* _ns_it = NULL;
		ValaHashSet* _tmp50_;
		ValaIterator* _tmp51_;
		_tmp50_ = self->priv->unannotated_namespaces;
		_tmp51_ = vala_iterable_iterator ((ValaIterable*) _tmp50_);
		_ns_it = _tmp51_;
		while (TRUE) {
			ValaIterator* _tmp52_;
			gboolean _tmp53_;
			ValaNamespace* ns = NULL;
			ValaIterator* _tmp54_;
			gpointer _tmp55_;
			ValaHashSet* _tmp56_;
			ValaNamespace* _tmp57_;
			gboolean _tmp58_;
			_tmp52_ = _ns_it;
			_tmp53_ = vala_iterator_next (_tmp52_);
			if (!_tmp53_) {
				break;
			}
			_tmp54_ = _ns_it;
			_tmp55_ = vala_iterator_get (_tmp54_);
			ns = (ValaNamespace*) _tmp55_;
			_tmp56_ = self->priv->our_namespaces;
			_tmp57_ = ns;
			_tmp58_ = vala_collection_contains ((ValaCollection*) _tmp56_, _tmp57_);
			if (!_tmp58_) {
				ValaNamespace* _tmp59_;
				ValaSourceReference* _tmp60_;
				ValaSourceReference* _tmp61_;
				ValaNamespace* _tmp62_;
				const gchar* _tmp63_;
				const gchar* _tmp64_;
				gchar* _tmp65_;
				gchar* _tmp66_;
				_tmp59_ = ns;
				_tmp60_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp59_);
				_tmp61_ = _tmp60_;
				_tmp62_ = ns;
				_tmp63_ = vala_symbol_get_name ((ValaSymbol*) _tmp62_);
				_tmp64_ = _tmp63_;
				_tmp65_ = g_strdup_printf ("Namespace %s does not have a GIR namespace and version annotation", _tmp64_);
				_tmp66_ = _tmp65_;
				vala_report_warning (_tmp61_, _tmp66_);
				_g_free0 (_tmp66_);
			}
			_vala_code_node_unref0 (ns);
		}
		_vala_iterator_unref0 (_ns_it);
	}
	{
		ValaIterator* _ns_it = NULL;
		ValaHashSet* _tmp67_;
		ValaIterator* _tmp68_;
		_tmp67_ = self->priv->our_namespaces;
		_tmp68_ = vala_iterable_iterator ((ValaIterable*) _tmp67_);
		_ns_it = _tmp68_;
		while (TRUE) {
			ValaIterator* _tmp69_;
			gboolean _tmp70_;
			ValaNamespace* ns = NULL;
			ValaIterator* _tmp71_;
			gpointer _tmp72_;
			ValaNamespace* _tmp73_;
			ValaSourceReference* _tmp74_;
			ValaSourceReference* _tmp75_;
			ValaSourceFile* _tmp76_;
			ValaSourceFile* _tmp77_;
			const gchar* _tmp78_;
			ValaNamespace* _tmp79_;
			ValaSourceReference* _tmp80_;
			ValaSourceReference* _tmp81_;
			ValaSourceFile* _tmp82_;
			ValaSourceFile* _tmp83_;
			const gchar* _tmp84_;
			_tmp69_ = _ns_it;
			_tmp70_ = vala_iterator_next (_tmp69_);
			if (!_tmp70_) {
				break;
			}
			_tmp71_ = _ns_it;
			_tmp72_ = vala_iterator_get (_tmp71_);
			ns = (ValaNamespace*) _tmp72_;
			_tmp73_ = ns;
			_tmp74_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp73_);
			_tmp75_ = _tmp74_;
			_tmp76_ = vala_source_reference_get_file (_tmp75_);
			_tmp77_ = _tmp76_;
			_tmp78_ = gir_namespace;
			vala_source_file_set_gir_namespace (_tmp77_, _tmp78_);
			_tmp79_ = ns;
			_tmp80_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp79_);
			_tmp81_ = _tmp80_;
			_tmp82_ = vala_source_reference_get_file (_tmp81_);
			_tmp83_ = _tmp82_;
			_tmp84_ = gir_version;
			vala_source_file_set_gir_version (_tmp83_, _tmp84_);
			_vala_code_node_unref0 (ns);
		}
		_vala_iterator_unref0 (_ns_it);
	}
	_tmp85_ = self->priv->our_namespaces;
	_tmp86_ = vala_collection_get_size ((ValaCollection*) _tmp85_);
	_tmp87_ = _tmp86_;
	if (_tmp87_ == 0) {
		vala_report_error (NULL, "No suitable namespace found to export for GIR");
	}
	_g_free0 (filename);
	_vala_code_node_unref0 (glib_ns);
	_vala_code_node_unref0 (root_symbol);
}


static void vala_gir_writer_write_doc (ValaGIRWriter* self, const gchar* comment) {
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = comment;
	if (_tmp0_ != NULL) {
		GString* _tmp1_;
		GString* _tmp2_;
		const gchar* _tmp3_;
		GString* _tmp4_;
		vala_gir_writer_write_indent (self);
		_tmp1_ = self->priv->buffer;
		g_string_append (_tmp1_, "<doc xml:whitespace=\"preserve\">");
		_tmp2_ = self->priv->buffer;
		_tmp3_ = comment;
		g_string_append (_tmp2_, _tmp3_);
		_tmp4_ = self->priv->buffer;
		g_string_append (_tmp4_, "</doc>\n");
	}
}


static void vala_gir_writer_write_package (ValaGIRWriter* self, const gchar* package) {
	GString* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (package != NULL);
	vala_gir_writer_write_indent (self);
	_tmp0_ = self->priv->buffer;
	_tmp1_ = package;
	g_string_append_printf (_tmp0_, "<package name=\"%s\"/>\n", _tmp1_);
}


static void vala_gir_writer_write_c_includes (ValaGIRWriter* self, ValaNamespace* ns) {
	ValaSet* header_filenames = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	ValaHashSet* _tmp2_;
	ValaNamespace* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ns != NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = vala_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp0_, _tmp1_);
	header_filenames = (ValaSet*) _tmp2_;
	_tmp3_ = ns;
	_tmp4_ = vala_ccode_base_module_get_ccode_header_filenames ((ValaSymbol*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp7_ = _tmp6_ = g_strsplit (_tmp5_, ",", 0);
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _vala_array_length (_tmp6_);
	_g_free0 (_tmp5_);
	{
		gchar** c_header_filename_collection = NULL;
		gint c_header_filename_collection_length1 = 0;
		gint _c_header_filename_collection_size_ = 0;
		gint c_header_filename_it = 0;
		c_header_filename_collection = _tmp8_;
		c_header_filename_collection_length1 = _tmp8__length1;
		for (c_header_filename_it = 0; c_header_filename_it < _tmp8__length1; c_header_filename_it = c_header_filename_it + 1) {
			const gchar* c_header_filename = NULL;
			c_header_filename = c_header_filename_collection[c_header_filename_it];
			{
				ValaSet* _tmp9_;
				const gchar* _tmp10_;
				_tmp9_ = header_filenames;
				_tmp10_ = c_header_filename;
				vala_collection_add ((ValaCollection*) _tmp9_, _tmp10_);
			}
		}
		c_header_filename_collection = (_vala_array_free (c_header_filename_collection, c_header_filename_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	{
		ValaIterator* _symbol_it = NULL;
		ValaNamespace* _tmp11_;
		ValaScope* _tmp12_;
		ValaScope* _tmp13_;
		ValaMap* _tmp14_;
		ValaMap* _tmp15_;
		ValaCollection* _tmp16_;
		ValaCollection* _tmp17_;
		ValaIterator* _tmp18_;
		ValaIterator* _tmp19_;
		_tmp11_ = ns;
		_tmp12_ = vala_symbol_get_scope ((ValaSymbol*) _tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = vala_scope_get_symbol_table (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = vala_map_get_values (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = vala_iterable_iterator ((ValaIterable*) _tmp17_);
		_tmp19_ = _tmp18_;
		_vala_iterable_unref0 (_tmp17_);
		_vala_map_unref0 (_tmp15_);
		_symbol_it = _tmp19_;
		while (TRUE) {
			ValaIterator* _tmp20_;
			gboolean _tmp21_;
			ValaSymbol* symbol = NULL;
			ValaIterator* _tmp22_;
			gpointer _tmp23_;
			ValaSymbol* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			gchar** _tmp27_;
			gchar** _tmp28_;
			gchar** _tmp29_;
			gint _tmp29__length1;
			_tmp20_ = _symbol_it;
			_tmp21_ = vala_iterator_next (_tmp20_);
			if (!_tmp21_) {
				break;
			}
			_tmp22_ = _symbol_it;
			_tmp23_ = vala_iterator_get (_tmp22_);
			symbol = (ValaSymbol*) _tmp23_;
			_tmp24_ = symbol;
			_tmp25_ = vala_ccode_base_module_get_ccode_header_filenames (_tmp24_);
			_tmp26_ = _tmp25_;
			_tmp28_ = _tmp27_ = g_strsplit (_tmp26_, ",", 0);
			_tmp29_ = _tmp28_;
			_tmp29__length1 = _vala_array_length (_tmp27_);
			_g_free0 (_tmp26_);
			{
				gchar** c_header_filename_collection = NULL;
				gint c_header_filename_collection_length1 = 0;
				gint _c_header_filename_collection_size_ = 0;
				gint c_header_filename_it = 0;
				c_header_filename_collection = _tmp29_;
				c_header_filename_collection_length1 = _tmp29__length1;
				for (c_header_filename_it = 0; c_header_filename_it < _tmp29__length1; c_header_filename_it = c_header_filename_it + 1) {
					const gchar* c_header_filename = NULL;
					c_header_filename = c_header_filename_collection[c_header_filename_it];
					{
						ValaSet* _tmp30_;
						const gchar* _tmp31_;
						_tmp30_ = header_filenames;
						_tmp31_ = c_header_filename;
						vala_collection_add ((ValaCollection*) _tmp30_, _tmp31_);
					}
				}
				c_header_filename_collection = (_vala_array_free (c_header_filename_collection, c_header_filename_collection_length1, (GDestroyNotify) g_free), NULL);
			}
			_vala_code_node_unref0 (symbol);
		}
		_vala_iterator_unref0 (_symbol_it);
	}
	{
		ValaIterator* _c_header_filename_it = NULL;
		ValaSet* _tmp32_;
		ValaIterator* _tmp33_;
		_tmp32_ = header_filenames;
		_tmp33_ = vala_iterable_iterator ((ValaIterable*) _tmp32_);
		_c_header_filename_it = _tmp33_;
		while (TRUE) {
			ValaIterator* _tmp34_;
			gboolean _tmp35_;
			gchar* c_header_filename = NULL;
			ValaIterator* _tmp36_;
			gpointer _tmp37_;
			const gchar* _tmp38_;
			_tmp34_ = _c_header_filename_it;
			_tmp35_ = vala_iterator_next (_tmp34_);
			if (!_tmp35_) {
				break;
			}
			_tmp36_ = _c_header_filename_it;
			_tmp37_ = vala_iterator_get (_tmp36_);
			c_header_filename = (gchar*) _tmp37_;
			_tmp38_ = c_header_filename;
			vala_gir_writer_write_c_include (self, _tmp38_);
			_g_free0 (c_header_filename);
		}
		_vala_iterator_unref0 (_c_header_filename_it);
	}
	_vala_iterable_unref0 (header_filenames);
}


static void vala_gir_writer_write_c_include (ValaGIRWriter* self, const gchar* name) {
	GString* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	vala_gir_writer_write_indent (self);
	_tmp0_ = self->priv->buffer;
	_tmp1_ = name;
	g_string_append_printf (_tmp0_, "<c:include name=\"%s\"/>\n", _tmp1_);
}


static void vala_gir_writer_real_visit_namespace (ValaCodeVisitor* base, ValaNamespace* ns) {
	ValaGIRWriter * self;
	ValaNamespace* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaNamespace* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	ValaNamespace* _tmp10_;
	ValaSymbol* _tmp11_;
	ValaSymbol* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	ValaNamespace* _tmp16_;
	GString* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* cprefix = NULL;
	ValaNamespace* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp25_;
	GString* _tmp28_;
	gint _tmp29_;
	ValaNamespace* _tmp30_;
	ValaArrayList* _tmp31_;
	ValaNamespace* _tmp32_;
	ValaNamespace* _tmp33_;
	ValaArrayList* _tmp34_;
	gint _tmp35_;
	GString* _tmp36_;
	ValaHashSet* _tmp37_;
	ValaNamespace* _tmp38_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (ns != NULL);
	_tmp0_ = ns;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = ns;
	_tmp4_ = vala_symbol_get_name ((ValaSymbol*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == NULL) {
		ValaArrayList* _tmp6_;
		ValaNamespace* _tmp7_;
		ValaNamespace* _tmp8_;
		ValaArrayList* _tmp9_;
		_tmp6_ = self->priv->hierarchy;
		_tmp7_ = ns;
		vala_list_insert ((ValaList*) _tmp6_, 0, (ValaSymbol*) _tmp7_);
		_tmp8_ = ns;
		vala_code_node_accept_children ((ValaCodeNode*) _tmp8_, (ValaCodeVisitor*) self);
		_tmp9_ = self->priv->hierarchy;
		vala_list_remove_at ((ValaList*) _tmp9_, 0);
		return;
	}
	_tmp10_ = ns;
	_tmp11_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = vala_symbol_get_name (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ != NULL) {
		ValaNamespace* _tmp15_;
		_tmp15_ = ns;
		vala_code_node_accept_children ((ValaCodeNode*) _tmp15_, (ValaCodeVisitor*) self);
		return;
	}
	_tmp16_ = ns;
	vala_gir_writer_write_c_includes (self, _tmp16_);
	vala_gir_writer_write_indent (self);
	_tmp17_ = self->priv->buffer;
	_tmp18_ = self->priv->gir_namespace;
	_tmp19_ = self->priv->gir_version;
	g_string_append_printf (_tmp17_, "<namespace name=\"%s\" version=\"%s\"", _tmp18_, _tmp19_);
	_tmp20_ = ns;
	_tmp21_ = vala_ccode_base_module_get_ccode_prefix ((ValaSymbol*) _tmp20_);
	cprefix = _tmp21_;
	_tmp22_ = self->priv->gir_shared_library;
	if (_tmp22_ != NULL) {
		GString* _tmp23_;
		const gchar* _tmp24_;
		_tmp23_ = self->priv->buffer;
		_tmp24_ = self->priv->gir_shared_library;
		g_string_append_printf (_tmp23_, " shared-library=\"%s\"", _tmp24_);
	}
	_tmp25_ = cprefix;
	if (_tmp25_ != NULL) {
		GString* _tmp26_;
		const gchar* _tmp27_;
		_tmp26_ = self->priv->buffer;
		_tmp27_ = cprefix;
		g_string_append_printf (_tmp26_, " c:prefix=\"%s\"", _tmp27_);
	}
	_tmp28_ = self->priv->buffer;
	g_string_append_printf (_tmp28_, ">\n");
	_tmp29_ = self->priv->indent;
	self->priv->indent = _tmp29_ + 1;
	_tmp30_ = ns;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp30_);
	_tmp31_ = self->priv->hierarchy;
	_tmp32_ = ns;
	vala_list_insert ((ValaList*) _tmp31_, 0, (ValaSymbol*) _tmp32_);
	_tmp33_ = ns;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp33_, (ValaCodeVisitor*) self);
	_tmp34_ = self->priv->hierarchy;
	vala_list_remove_at ((ValaList*) _tmp34_, 0);
	_tmp35_ = self->priv->indent;
	self->priv->indent = _tmp35_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp36_ = self->priv->buffer;
	g_string_append_printf (_tmp36_, "</namespace>\n");
	_tmp37_ = self->priv->our_namespaces;
	_tmp38_ = ns;
	vala_collection_add ((ValaCollection*) _tmp37_, _tmp38_);
	vala_gir_writer_visit_deferred (self);
	_g_free0 (cprefix);
}


static void vala_gir_writer_write_symbol_attributes (ValaGIRWriter* self, ValaSymbol* symbol) {
	ValaSymbol* _tmp0_;
	ValaVersionAttribute* _tmp1_;
	ValaVersionAttribute* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	ValaSymbol* _tmp36_;
	ValaVersionAttribute* _tmp37_;
	ValaVersionAttribute* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gboolean _tmp42_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	_tmp0_ = symbol;
	_tmp1_ = vala_symbol_get_version (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = vala_version_attribute_get_deprecated (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		gchar* _tmp5_ = NULL;
		ValaSymbol* _tmp6_;
		ValaVersionAttribute* _tmp7_;
		ValaVersionAttribute* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gboolean _tmp12_;
		GString* _tmp21_;
		ValaSymbol* _tmp22_;
		ValaVersionAttribute* _tmp23_;
		ValaVersionAttribute* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		gboolean _tmp28_;
		_tmp6_ = symbol;
		_tmp7_ = vala_symbol_get_version (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = vala_version_attribute_get_replacement (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp11_ == NULL;
		_g_free0 (_tmp11_);
		if (_tmp12_) {
			gchar* _tmp13_;
			_tmp13_ = g_strdup ("");
			_g_free0 (_tmp5_);
			_tmp5_ = _tmp13_;
		} else {
			ValaSymbol* _tmp14_;
			ValaVersionAttribute* _tmp15_;
			ValaVersionAttribute* _tmp16_;
			gchar* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			_tmp14_ = symbol;
			_tmp15_ = vala_symbol_get_version (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = vala_version_attribute_get_replacement (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = _tmp18_;
			_tmp20_ = g_strdup_printf ("Use %s", _tmp19_);
			_g_free0 (_tmp5_);
			_tmp5_ = _tmp20_;
			_g_free0 (_tmp19_);
		}
		_tmp21_ = self->priv->buffer;
		g_string_append_printf (_tmp21_, " deprecated=\"%s\"", _tmp5_);
		_tmp22_ = symbol;
		_tmp23_ = vala_symbol_get_version (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = vala_version_attribute_get_deprecated_since (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = _tmp26_;
		_tmp28_ = _tmp27_ != NULL;
		_g_free0 (_tmp27_);
		if (_tmp28_) {
			GString* _tmp29_;
			ValaSymbol* _tmp30_;
			ValaVersionAttribute* _tmp31_;
			ValaVersionAttribute* _tmp32_;
			gchar* _tmp33_;
			gchar* _tmp34_;
			gchar* _tmp35_;
			_tmp29_ = self->priv->buffer;
			_tmp30_ = symbol;
			_tmp31_ = vala_symbol_get_version (_tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = vala_version_attribute_get_deprecated_since (_tmp32_);
			_tmp34_ = _tmp33_;
			_tmp35_ = _tmp34_;
			g_string_append_printf (_tmp29_, " deprecated-version=\"%s\"", _tmp35_);
			_g_free0 (_tmp35_);
		}
		_g_free0 (_tmp5_);
	}
	_tmp36_ = symbol;
	_tmp37_ = vala_symbol_get_version (_tmp36_);
	_tmp38_ = _tmp37_;
	_tmp39_ = vala_version_attribute_get_since (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = _tmp40_;
	_tmp42_ = _tmp41_ != NULL;
	_g_free0 (_tmp41_);
	if (_tmp42_) {
		GString* _tmp43_;
		ValaSymbol* _tmp44_;
		ValaVersionAttribute* _tmp45_;
		ValaVersionAttribute* _tmp46_;
		gchar* _tmp47_;
		gchar* _tmp48_;
		gchar* _tmp49_;
		_tmp43_ = self->priv->buffer;
		_tmp44_ = symbol;
		_tmp45_ = vala_symbol_get_version (_tmp44_);
		_tmp46_ = _tmp45_;
		_tmp47_ = vala_version_attribute_get_since (_tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = _tmp48_;
		g_string_append_printf (_tmp43_, " version=\"%s\"", _tmp49_);
		_g_free0 (_tmp49_);
	}
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* end = NULL;
	gchar* _tmp0_;
	glong _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = end;
		_tmp6_ = str;
		result = (glong) (_tmp5_ - _tmp6_);
		return result;
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_;
	glong _tmp8_;
	glong _tmp14_;
	glong _tmp17_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	glong _tmp21_;
	gchar* _tmp22_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		glong _tmp3_;
		glong _tmp4_;
		glong _tmp5_;
		_tmp3_ = offset;
		_tmp4_ = len;
		_tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
		string_length = _tmp5_;
	} else {
		gint _tmp6_;
		gint _tmp7_;
		_tmp6_ = strlen (self);
		_tmp7_ = _tmp6_;
		string_length = (glong) _tmp7_;
	}
	_tmp8_ = offset;
	if (_tmp8_ < ((glong) 0)) {
		glong _tmp9_;
		glong _tmp10_;
		glong _tmp11_;
		_tmp9_ = string_length;
		_tmp10_ = offset;
		offset = _tmp9_ + _tmp10_;
		_tmp11_ = offset;
		g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
	} else {
		glong _tmp12_;
		glong _tmp13_;
		_tmp12_ = offset;
		_tmp13_ = string_length;
		g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
	}
	_tmp14_ = len;
	if (_tmp14_ < ((glong) 0)) {
		glong _tmp15_;
		glong _tmp16_;
		_tmp15_ = string_length;
		_tmp16_ = offset;
		len = _tmp15_ - _tmp16_;
	}
	_tmp17_ = offset;
	_tmp18_ = len;
	_tmp19_ = string_length;
	g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
	_tmp20_ = offset;
	_tmp21_ = len;
	_tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
	result = _tmp22_;
	return result;
}


static void vala_gir_writer_real_visit_class (ValaCodeVisitor* base, ValaClass* cl) {
	ValaGIRWriter * self;
	ValaClass* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaClass* _tmp3_;
	gboolean _tmp4_;
	ValaArrayList* _tmp5_;
	gpointer _tmp6_;
	ValaSymbol* _tmp7_;
	gboolean _tmp8_;
	ValaClass* _tmp11_;
	ValaTypeSymbol* _tmp12_;
	gboolean _tmp13_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (cl != NULL);
	_tmp0_ = cl;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = cl;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	_tmp5_ = self->priv->hierarchy;
	_tmp6_ = vala_list_get ((ValaList*) _tmp5_, 0);
	_tmp7_ = (ValaSymbol*) _tmp6_;
	_tmp8_ = !G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_NAMESPACE);
	_vala_code_node_unref0 (_tmp7_);
	if (_tmp8_) {
		ValaArrayList* _tmp9_;
		ValaClass* _tmp10_;
		_tmp9_ = self->priv->deferred;
		_tmp10_ = cl;
		vala_collection_add ((ValaCollection*) _tmp9_, (ValaCodeNode*) _tmp10_);
		return;
	}
	_tmp11_ = cl;
	_tmp12_ = self->priv->gobject_type;
	_tmp13_ = vala_typesymbol_is_subtype_of ((ValaTypeSymbol*) _tmp11_, _tmp12_);
	if (_tmp13_) {
		gchar* gtype_struct_name = NULL;
		ValaClass* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		GString* _tmp19_;
		ValaClass* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		ValaClass* _tmp23_;
		GString* _tmp24_;
		const gchar* _tmp25_;
		GString* _tmp26_;
		ValaClass* _tmp27_;
		ValaClass* _tmp28_;
		ValaClass* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		ValaClass* _tmp32_;
		gboolean _tmp33_;
		gboolean _tmp34_;
		ValaClass* _tmp36_;
		GString* _tmp37_;
		gint _tmp38_;
		ValaClass* _tmp39_;
		gchar* _tmp40_;
		gchar* _tmp41_;
		ValaClass* _tmp64_;
		GString* _tmp65_;
		gint _tmp66_;
		GString* _tmp67_;
		ValaClass* _tmp68_;
		ValaClass* _tmp69_;
		ValaClass* _tmp70_;
		gchar* _tmp71_;
		gchar* _tmp72_;
		ValaClass* _tmp73_;
		ValaClass* _tmp74_;
		ValaClass* _tmp75_;
		gchar* _tmp76_;
		gchar* _tmp77_;
		gint _tmp78_;
		GString* _tmp79_;
		GString* _tmp80_;
		gint _tmp81_;
		GString* _tmp82_;
		ValaClass* _tmp83_;
		gchar* _tmp84_;
		gchar* _tmp85_;
		ValaClass* _tmp86_;
		gchar* _tmp87_;
		gchar* _tmp88_;
		gint _tmp89_;
		GString* _tmp90_;
		ValaArrayList* _tmp91_;
		ValaClass* _tmp92_;
		ValaClass* _tmp93_;
		ValaArrayList* _tmp94_;
		gint _tmp95_;
		GString* _tmp96_;
		GString* _tmp97_;
		const gchar* _tmp98_;
		ValaClass* _tmp99_;
		GString* _tmp100_;
		ValaClass* _tmp101_;
		const gchar* _tmp102_;
		const gchar* _tmp103_;
		GString* _tmp104_;
		gint _tmp105_;
		GString* _tmp106_;
		gint _tmp107_;
		GString* _tmp108_;
		ValaClass* _tmp109_;
		ValaClass* _tmp110_;
		ValaClass* _tmp111_;
		gchar* _tmp112_;
		gchar* _tmp113_;
		ValaClass* _tmp114_;
		ValaClass* _tmp115_;
		ValaClass* _tmp116_;
		gchar* _tmp117_;
		gchar* _tmp118_;
		gint _tmp119_;
		GString* _tmp120_;
		gint _tmp242_;
		GString* _tmp243_;
		GString* _tmp244_;
		ValaClass* _tmp245_;
		gchar* _tmp246_;
		gchar* _tmp247_;
		ValaClass* _tmp248_;
		gchar* _tmp249_;
		gchar* _tmp250_;
		_tmp14_ = cl;
		_tmp15_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = g_strconcat (_tmp16_, "Class", NULL);
		_tmp18_ = _tmp17_;
		_g_free0 (_tmp16_);
		gtype_struct_name = _tmp18_;
		vala_gir_writer_write_indent (self);
		_tmp19_ = self->priv->buffer;
		_tmp20_ = cl;
		_tmp21_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp20_);
		_tmp22_ = _tmp21_;
		g_string_append_printf (_tmp19_, "<class name=\"%s\"", _tmp22_);
		_g_free0 (_tmp22_);
		_tmp23_ = cl;
		vala_gir_writer_write_gtype_attributes (self, (ValaTypeSymbol*) _tmp23_);
		_tmp24_ = self->priv->buffer;
		_tmp25_ = gtype_struct_name;
		g_string_append_printf (_tmp24_, " glib:type-struct=\"%s\"", _tmp25_);
		_tmp26_ = self->priv->buffer;
		_tmp27_ = cl;
		_tmp28_ = vala_class_get_base_class (_tmp27_);
		_tmp29_ = _tmp28_;
		_tmp30_ = vala_gir_writer_gi_type_name (self, (ValaTypeSymbol*) _tmp29_);
		_tmp31_ = _tmp30_;
		g_string_append_printf (_tmp26_, " parent=\"%s\"", _tmp31_);
		_g_free0 (_tmp31_);
		_tmp32_ = cl;
		_tmp33_ = vala_class_get_is_abstract (_tmp32_);
		_tmp34_ = _tmp33_;
		if (_tmp34_) {
			GString* _tmp35_;
			_tmp35_ = self->priv->buffer;
			g_string_append_printf (_tmp35_, " abstract=\"1\"");
		}
		_tmp36_ = cl;
		vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp36_);
		_tmp37_ = self->priv->buffer;
		g_string_append_printf (_tmp37_, ">\n");
		_tmp38_ = self->priv->indent;
		self->priv->indent = _tmp38_ + 1;
		_tmp39_ = cl;
		_tmp40_ = vala_gir_writer_get_class_comment (self, _tmp39_);
		_tmp41_ = _tmp40_;
		vala_gir_writer_write_doc (self, _tmp41_);
		_g_free0 (_tmp41_);
		{
			ValaList* _base_type_list = NULL;
			ValaClass* _tmp42_;
			ValaList* _tmp43_;
			gint _base_type_size = 0;
			ValaList* _tmp44_;
			gint _tmp45_;
			gint _tmp46_;
			gint _base_type_index = 0;
			_tmp42_ = cl;
			_tmp43_ = vala_class_get_base_types (_tmp42_);
			_base_type_list = _tmp43_;
			_tmp44_ = _base_type_list;
			_tmp45_ = vala_collection_get_size ((ValaCollection*) _tmp44_);
			_tmp46_ = _tmp45_;
			_base_type_size = _tmp46_;
			_base_type_index = -1;
			while (TRUE) {
				gint _tmp47_;
				gint _tmp48_;
				gint _tmp49_;
				ValaDataType* base_type = NULL;
				ValaList* _tmp50_;
				gint _tmp51_;
				gpointer _tmp52_;
				ValaObjectType* object_type = NULL;
				ValaDataType* _tmp53_;
				ValaObjectType* _tmp54_;
				ValaObjectType* _tmp55_;
				ValaObjectTypeSymbol* _tmp56_;
				ValaObjectTypeSymbol* _tmp57_;
				_tmp47_ = _base_type_index;
				_base_type_index = _tmp47_ + 1;
				_tmp48_ = _base_type_index;
				_tmp49_ = _base_type_size;
				if (!(_tmp48_ < _tmp49_)) {
					break;
				}
				_tmp50_ = _base_type_list;
				_tmp51_ = _base_type_index;
				_tmp52_ = vala_list_get (_tmp50_, _tmp51_);
				base_type = (ValaDataType*) _tmp52_;
				_tmp53_ = base_type;
				_tmp54_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, VALA_TYPE_OBJECT_TYPE, ValaObjectType));
				object_type = _tmp54_;
				_tmp55_ = object_type;
				_tmp56_ = vala_object_type_get_type_symbol (_tmp55_);
				_tmp57_ = _tmp56_;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp57_, VALA_TYPE_INTERFACE)) {
					GString* _tmp58_;
					ValaObjectType* _tmp59_;
					ValaObjectTypeSymbol* _tmp60_;
					ValaObjectTypeSymbol* _tmp61_;
					gchar* _tmp62_;
					gchar* _tmp63_;
					vala_gir_writer_write_indent (self);
					_tmp58_ = self->priv->buffer;
					_tmp59_ = object_type;
					_tmp60_ = vala_object_type_get_type_symbol (_tmp59_);
					_tmp61_ = _tmp60_;
					_tmp62_ = vala_gir_writer_gi_type_name (self, (ValaTypeSymbol*) _tmp61_);
					_tmp63_ = _tmp62_;
					g_string_append_printf (_tmp58_, "<implements name=\"%s\"/>\n", _tmp63_);
					_g_free0 (_tmp63_);
				}
				_vala_code_node_unref0 (object_type);
				_vala_code_node_unref0 (base_type);
			}
			_vala_iterable_unref0 (_base_type_list);
		}
		_tmp64_ = cl;
		vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp64_);
		vala_gir_writer_write_indent (self);
		_tmp65_ = self->priv->buffer;
		g_string_append_printf (_tmp65_, "<field name=\"parent_instance\">\n");
		_tmp66_ = self->priv->indent;
		self->priv->indent = _tmp66_ + 1;
		vala_gir_writer_write_indent (self);
		_tmp67_ = self->priv->buffer;
		_tmp68_ = cl;
		_tmp69_ = vala_class_get_base_class (_tmp68_);
		_tmp70_ = _tmp69_;
		_tmp71_ = vala_gir_writer_gi_type_name (self, (ValaTypeSymbol*) _tmp70_);
		_tmp72_ = _tmp71_;
		_tmp73_ = cl;
		_tmp74_ = vala_class_get_base_class (_tmp73_);
		_tmp75_ = _tmp74_;
		_tmp76_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp75_);
		_tmp77_ = _tmp76_;
		g_string_append_printf (_tmp67_, "<type name=\"%s\" c:type=\"%s\"/>\n", _tmp72_, _tmp77_);
		_g_free0 (_tmp77_);
		_g_free0 (_tmp72_);
		_tmp78_ = self->priv->indent;
		self->priv->indent = _tmp78_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp79_ = self->priv->buffer;
		g_string_append_printf (_tmp79_, "</field>\n");
		vala_gir_writer_write_indent (self);
		_tmp80_ = self->priv->buffer;
		g_string_append_printf (_tmp80_, "<field name=\"priv\">\n");
		_tmp81_ = self->priv->indent;
		self->priv->indent = _tmp81_ + 1;
		vala_gir_writer_write_indent (self);
		_tmp82_ = self->priv->buffer;
		_tmp83_ = cl;
		_tmp84_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp83_);
		_tmp85_ = _tmp84_;
		_tmp86_ = cl;
		_tmp87_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp86_);
		_tmp88_ = _tmp87_;
		g_string_append_printf (_tmp82_, "<type name=\"%sPrivate\" c:type=\"%sPrivate*\"/>\n", _tmp85_, _tmp88_);
		_g_free0 (_tmp88_);
		_g_free0 (_tmp85_);
		_tmp89_ = self->priv->indent;
		self->priv->indent = _tmp89_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp90_ = self->priv->buffer;
		g_string_append_printf (_tmp90_, "</field>\n");
		_tmp91_ = self->priv->hierarchy;
		_tmp92_ = cl;
		vala_list_insert ((ValaList*) _tmp91_, 0, (ValaSymbol*) _tmp92_);
		_tmp93_ = cl;
		vala_code_node_accept_children ((ValaCodeNode*) _tmp93_, (ValaCodeVisitor*) self);
		_tmp94_ = self->priv->hierarchy;
		vala_list_remove_at ((ValaList*) _tmp94_, 0);
		_tmp95_ = self->priv->indent;
		self->priv->indent = _tmp95_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp96_ = self->priv->buffer;
		g_string_append_printf (_tmp96_, "</class>\n");
		vala_gir_writer_write_indent (self);
		_tmp97_ = self->priv->buffer;
		_tmp98_ = gtype_struct_name;
		g_string_append_printf (_tmp97_, "<record name=\"%s\"", _tmp98_);
		_tmp99_ = cl;
		vala_gir_writer_write_ctype_attributes (self, (ValaTypeSymbol*) _tmp99_, "Class");
		_tmp100_ = self->priv->buffer;
		_tmp101_ = cl;
		_tmp102_ = vala_symbol_get_name ((ValaSymbol*) _tmp101_);
		_tmp103_ = _tmp102_;
		g_string_append_printf (_tmp100_, " glib:is-gtype-struct-for=\"%s\"", _tmp103_);
		_tmp104_ = self->priv->buffer;
		g_string_append_printf (_tmp104_, ">\n");
		_tmp105_ = self->priv->indent;
		self->priv->indent = _tmp105_ + 1;
		vala_gir_writer_write_indent (self);
		_tmp106_ = self->priv->buffer;
		g_string_append_printf (_tmp106_, "<field name=\"parent_class\">\n");
		_tmp107_ = self->priv->indent;
		self->priv->indent = _tmp107_ + 1;
		vala_gir_writer_write_indent (self);
		_tmp108_ = self->priv->buffer;
		_tmp109_ = cl;
		_tmp110_ = vala_class_get_base_class (_tmp109_);
		_tmp111_ = _tmp110_;
		_tmp112_ = vala_gir_writer_gi_type_name (self, (ValaTypeSymbol*) _tmp111_);
		_tmp113_ = _tmp112_;
		_tmp114_ = cl;
		_tmp115_ = vala_class_get_base_class (_tmp114_);
		_tmp116_ = _tmp115_;
		_tmp117_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp116_);
		_tmp118_ = _tmp117_;
		g_string_append_printf (_tmp108_, "<type name=\"%sClass\" c:type=\"%sClass\"/>\n", _tmp113_, _tmp118_);
		_g_free0 (_tmp118_);
		_g_free0 (_tmp113_);
		_tmp119_ = self->priv->indent;
		self->priv->indent = _tmp119_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp120_ = self->priv->buffer;
		g_string_append_printf (_tmp120_, "</field>\n");
		{
			ValaList* _m_list = NULL;
			ValaClass* _tmp121_;
			ValaList* _tmp122_;
			gint _m_size = 0;
			ValaList* _tmp123_;
			gint _tmp124_;
			gint _tmp125_;
			gint _m_index = 0;
			_tmp121_ = cl;
			_tmp122_ = vala_object_type_symbol_get_methods ((ValaObjectTypeSymbol*) _tmp121_);
			_m_list = _tmp122_;
			_tmp123_ = _m_list;
			_tmp124_ = vala_collection_get_size ((ValaCollection*) _tmp123_);
			_tmp125_ = _tmp124_;
			_m_size = _tmp125_;
			_m_index = -1;
			while (TRUE) {
				gint _tmp126_;
				gint _tmp127_;
				gint _tmp128_;
				ValaMethod* m = NULL;
				ValaList* _tmp129_;
				gint _tmp130_;
				gpointer _tmp131_;
				gboolean _tmp132_ = FALSE;
				ValaMethod* _tmp133_;
				gboolean _tmp134_;
				gboolean _tmp135_;
				_tmp126_ = _m_index;
				_m_index = _tmp126_ + 1;
				_tmp127_ = _m_index;
				_tmp128_ = _m_size;
				if (!(_tmp127_ < _tmp128_)) {
					break;
				}
				_tmp129_ = _m_list;
				_tmp130_ = _m_index;
				_tmp131_ = vala_list_get (_tmp129_, _tmp130_);
				m = (ValaMethod*) _tmp131_;
				_tmp133_ = m;
				_tmp134_ = vala_method_get_is_abstract (_tmp133_);
				_tmp135_ = _tmp134_;
				if (_tmp135_) {
					_tmp132_ = TRUE;
				} else {
					ValaMethod* _tmp136_;
					gboolean _tmp137_;
					gboolean _tmp138_;
					_tmp136_ = m;
					_tmp137_ = vala_method_get_is_virtual (_tmp136_);
					_tmp138_ = _tmp137_;
					_tmp132_ = _tmp138_;
				}
				if (_tmp132_) {
					ValaMethod* _tmp139_;
					gboolean _tmp140_;
					gboolean _tmp141_;
					vala_gir_writer_write_indent (self);
					_tmp139_ = m;
					_tmp140_ = vala_method_get_coroutine (_tmp139_);
					_tmp141_ = _tmp140_;
					if (_tmp141_) {
						gchar* finish_name = NULL;
						ValaMethod* _tmp142_;
						const gchar* _tmp143_;
						const gchar* _tmp144_;
						gchar* _tmp145_;
						const gchar* _tmp146_;
						gboolean _tmp147_;
						const gchar* _tmp155_;
						gchar* _tmp156_;
						GString* _tmp157_;
						ValaMethod* _tmp158_;
						const gchar* _tmp159_;
						const gchar* _tmp160_;
						gint _tmp161_;
						ValaMethod* _tmp162_;
						ValaMethod* _tmp163_;
						const gchar* _tmp164_;
						const gchar* _tmp165_;
						ValaMethod* _tmp166_;
						gchar* _tmp167_;
						gchar* _tmp168_;
						ValaMethod* _tmp169_;
						ValaList* _tmp170_;
						ValaList* _tmp171_;
						ValaVoidType* _tmp172_;
						ValaVoidType* _tmp173_;
						gint _tmp174_;
						GString* _tmp175_;
						GString* _tmp176_;
						const gchar* _tmp177_;
						gint _tmp178_;
						ValaMethod* _tmp179_;
						const gchar* _tmp180_;
						ValaMethod* _tmp181_;
						gchar* _tmp182_;
						gchar* _tmp183_;
						ValaMethod* _tmp184_;
						ValaList* _tmp185_;
						ValaList* _tmp186_;
						ValaMethod* _tmp187_;
						ValaDataType* _tmp188_;
						ValaDataType* _tmp189_;
						ValaMethod* _tmp190_;
						gboolean _tmp191_;
						gboolean _tmp192_;
						gint _tmp193_;
						GString* _tmp194_;
						_tmp142_ = m;
						_tmp143_ = vala_symbol_get_name ((ValaSymbol*) _tmp142_);
						_tmp144_ = _tmp143_;
						_tmp145_ = g_strdup (_tmp144_);
						finish_name = _tmp145_;
						_tmp146_ = finish_name;
						_tmp147_ = g_str_has_suffix (_tmp146_, "_async");
						if (_tmp147_) {
							const gchar* _tmp148_;
							const gchar* _tmp149_;
							gint _tmp150_;
							gint _tmp151_;
							gint _tmp152_;
							gint _tmp153_;
							gchar* _tmp154_;
							_tmp148_ = finish_name;
							_tmp149_ = finish_name;
							_tmp150_ = strlen (_tmp149_);
							_tmp151_ = _tmp150_;
							_tmp152_ = strlen ("_async");
							_tmp153_ = _tmp152_;
							_tmp154_ = string_substring (_tmp148_, (glong) 0, (glong) (_tmp151_ - _tmp153_));
							_g_free0 (finish_name);
							finish_name = _tmp154_;
						}
						_tmp155_ = finish_name;
						_tmp156_ = g_strconcat (_tmp155_, "_finish", NULL);
						_g_free0 (finish_name);
						finish_name = _tmp156_;
						vala_gir_writer_write_indent (self);
						_tmp157_ = self->priv->buffer;
						_tmp158_ = m;
						_tmp159_ = vala_symbol_get_name ((ValaSymbol*) _tmp158_);
						_tmp160_ = _tmp159_;
						g_string_append_printf (_tmp157_, "<field name=\"%s\">\n", _tmp160_);
						_tmp161_ = self->priv->indent;
						self->priv->indent = _tmp161_ + 1;
						_tmp162_ = m;
						_tmp163_ = m;
						_tmp164_ = vala_symbol_get_name ((ValaSymbol*) _tmp163_);
						_tmp165_ = _tmp164_;
						_tmp166_ = m;
						_tmp167_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp166_);
						_tmp168_ = _tmp167_;
						_tmp169_ = m;
						_tmp170_ = vala_method_get_async_begin_parameters (_tmp169_);
						_tmp171_ = _tmp170_;
						_tmp172_ = vala_void_type_new (NULL);
						_tmp173_ = _tmp172_;
						vala_gir_writer_do_write_signature (self, _tmp162_, "callback", TRUE, _tmp165_, _tmp168_, _tmp171_, (ValaDataType*) _tmp173_, FALSE, FALSE);
						_vala_code_node_unref0 (_tmp173_);
						_vala_iterable_unref0 (_tmp171_);
						_g_free0 (_tmp168_);
						_tmp174_ = self->priv->indent;
						self->priv->indent = _tmp174_ - 1;
						vala_gir_writer_write_indent (self);
						_tmp175_ = self->priv->buffer;
						g_string_append_printf (_tmp175_, "</field>\n");
						vala_gir_writer_write_indent (self);
						_tmp176_ = self->priv->buffer;
						_tmp177_ = finish_name;
						g_string_append_printf (_tmp176_, "<field name=\"%s\">\n", _tmp177_);
						_tmp178_ = self->priv->indent;
						self->priv->indent = _tmp178_ + 1;
						_tmp179_ = m;
						_tmp180_ = finish_name;
						_tmp181_ = m;
						_tmp182_ = vala_ccode_base_module_get_ccode_finish_name (_tmp181_);
						_tmp183_ = _tmp182_;
						_tmp184_ = m;
						_tmp185_ = vala_method_get_async_end_parameters (_tmp184_);
						_tmp186_ = _tmp185_;
						_tmp187_ = m;
						_tmp188_ = vala_callable_get_return_type ((ValaCallable*) _tmp187_);
						_tmp189_ = _tmp188_;
						_tmp190_ = m;
						_tmp191_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp190_);
						_tmp192_ = _tmp191_;
						vala_gir_writer_do_write_signature (self, _tmp179_, "callback", TRUE, _tmp180_, _tmp183_, _tmp186_, _tmp189_, _tmp192_, FALSE);
						_vala_iterable_unref0 (_tmp186_);
						_g_free0 (_tmp183_);
						_tmp193_ = self->priv->indent;
						self->priv->indent = _tmp193_ - 1;
						vala_gir_writer_write_indent (self);
						_tmp194_ = self->priv->buffer;
						g_string_append_printf (_tmp194_, "</field>\n");
						_g_free0 (finish_name);
					} else {
						GString* _tmp195_;
						ValaMethod* _tmp196_;
						const gchar* _tmp197_;
						const gchar* _tmp198_;
						gint _tmp199_;
						ValaMethod* _tmp200_;
						ValaMethod* _tmp201_;
						const gchar* _tmp202_;
						const gchar* _tmp203_;
						ValaMethod* _tmp204_;
						gchar* _tmp205_;
						gchar* _tmp206_;
						ValaMethod* _tmp207_;
						ValaList* _tmp208_;
						ValaList* _tmp209_;
						ValaMethod* _tmp210_;
						ValaDataType* _tmp211_;
						ValaDataType* _tmp212_;
						ValaMethod* _tmp213_;
						gboolean _tmp214_;
						gboolean _tmp215_;
						gint _tmp216_;
						GString* _tmp217_;
						vala_gir_writer_write_indent (self);
						_tmp195_ = self->priv->buffer;
						_tmp196_ = m;
						_tmp197_ = vala_symbol_get_name ((ValaSymbol*) _tmp196_);
						_tmp198_ = _tmp197_;
						g_string_append_printf (_tmp195_, "<field name=\"%s\">\n", _tmp198_);
						_tmp199_ = self->priv->indent;
						self->priv->indent = _tmp199_ + 1;
						_tmp200_ = m;
						_tmp201_ = m;
						_tmp202_ = vala_symbol_get_name ((ValaSymbol*) _tmp201_);
						_tmp203_ = _tmp202_;
						_tmp204_ = m;
						_tmp205_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp204_);
						_tmp206_ = _tmp205_;
						_tmp207_ = m;
						_tmp208_ = vala_callable_get_parameters ((ValaCallable*) _tmp207_);
						_tmp209_ = _tmp208_;
						_tmp210_ = m;
						_tmp211_ = vala_callable_get_return_type ((ValaCallable*) _tmp210_);
						_tmp212_ = _tmp211_;
						_tmp213_ = m;
						_tmp214_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp213_);
						_tmp215_ = _tmp214_;
						vala_gir_writer_do_write_signature (self, _tmp200_, "callback", TRUE, _tmp203_, _tmp206_, _tmp209_, _tmp212_, _tmp215_, FALSE);
						_vala_iterable_unref0 (_tmp209_);
						_g_free0 (_tmp206_);
						_tmp216_ = self->priv->indent;
						self->priv->indent = _tmp216_ - 1;
						vala_gir_writer_write_indent (self);
						_tmp217_ = self->priv->buffer;
						g_string_append_printf (_tmp217_, "</field>\n");
					}
				}
				_vala_code_node_unref0 (m);
			}
			_vala_iterable_unref0 (_m_list);
		}
		{
			ValaList* _sig_list = NULL;
			ValaClass* _tmp218_;
			ValaList* _tmp219_;
			gint _sig_size = 0;
			ValaList* _tmp220_;
			gint _tmp221_;
			gint _tmp222_;
			gint _sig_index = 0;
			_tmp218_ = cl;
			_tmp219_ = vala_object_type_symbol_get_signals ((ValaObjectTypeSymbol*) _tmp218_);
			_sig_list = _tmp219_;
			_tmp220_ = _sig_list;
			_tmp221_ = vala_collection_get_size ((ValaCollection*) _tmp220_);
			_tmp222_ = _tmp221_;
			_sig_size = _tmp222_;
			_sig_index = -1;
			while (TRUE) {
				gint _tmp223_;
				gint _tmp224_;
				gint _tmp225_;
				ValaSignal* sig = NULL;
				ValaList* _tmp226_;
				gint _tmp227_;
				gpointer _tmp228_;
				ValaSignal* _tmp229_;
				ValaMethod* _tmp230_;
				ValaMethod* _tmp231_;
				_tmp223_ = _sig_index;
				_sig_index = _tmp223_ + 1;
				_tmp224_ = _sig_index;
				_tmp225_ = _sig_size;
				if (!(_tmp224_ < _tmp225_)) {
					break;
				}
				_tmp226_ = _sig_list;
				_tmp227_ = _sig_index;
				_tmp228_ = vala_list_get (_tmp226_, _tmp227_);
				sig = (ValaSignal*) _tmp228_;
				_tmp229_ = sig;
				_tmp230_ = vala_signal_get_default_handler (_tmp229_);
				_tmp231_ = _tmp230_;
				if (_tmp231_ != NULL) {
					GString* _tmp232_;
					ValaSignal* _tmp233_;
					const gchar* _tmp234_;
					const gchar* _tmp235_;
					gint _tmp236_;
					ValaSignal* _tmp237_;
					ValaMethod* _tmp238_;
					ValaMethod* _tmp239_;
					gint _tmp240_;
					GString* _tmp241_;
					vala_gir_writer_write_indent (self);
					_tmp232_ = self->priv->buffer;
					_tmp233_ = sig;
					_tmp234_ = vala_symbol_get_name ((ValaSymbol*) _tmp233_);
					_tmp235_ = _tmp234_;
					g_string_append_printf (_tmp232_, "<field name=\"%s\">\n", _tmp235_);
					_tmp236_ = self->priv->indent;
					self->priv->indent = _tmp236_ + 1;
					_tmp237_ = sig;
					_tmp238_ = vala_signal_get_default_handler (_tmp237_);
					_tmp239_ = _tmp238_;
					vala_gir_writer_write_signature (self, _tmp239_, "callback", FALSE, TRUE);
					_tmp240_ = self->priv->indent;
					self->priv->indent = _tmp240_ - 1;
					vala_gir_writer_write_indent (self);
					_tmp241_ = self->priv->buffer;
					g_string_append_printf (_tmp241_, "</field>\n");
				}
				_vala_code_node_unref0 (sig);
			}
			_vala_iterable_unref0 (_sig_list);
		}
		_tmp242_ = self->priv->indent;
		self->priv->indent = _tmp242_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp243_ = self->priv->buffer;
		g_string_append_printf (_tmp243_, "</record>\n");
		vala_gir_writer_write_indent (self);
		_tmp244_ = self->priv->buffer;
		_tmp245_ = cl;
		_tmp246_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp245_);
		_tmp247_ = _tmp246_;
		_tmp248_ = cl;
		_tmp249_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp248_);
		_tmp250_ = _tmp249_;
		g_string_append_printf (_tmp244_, "<record name=\"%sPrivate\" c:type=\"%sPrivate\" disguised=\"1\"/>\n", _tmp247_, _tmp250_);
		_g_free0 (_tmp250_);
		_g_free0 (_tmp247_);
		_g_free0 (gtype_struct_name);
	} else {
		GString* _tmp251_;
		ValaClass* _tmp252_;
		gchar* _tmp253_;
		gchar* _tmp254_;
		ValaClass* _tmp255_;
		GString* _tmp256_;
		gint _tmp257_;
		ValaClass* _tmp258_;
		gchar* _tmp259_;
		gchar* _tmp260_;
		ValaClass* _tmp261_;
		ValaArrayList* _tmp262_;
		ValaClass* _tmp263_;
		ValaClass* _tmp264_;
		ValaArrayList* _tmp265_;
		gint _tmp266_;
		GString* _tmp267_;
		vala_gir_writer_write_indent (self);
		_tmp251_ = self->priv->buffer;
		_tmp252_ = cl;
		_tmp253_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp252_);
		_tmp254_ = _tmp253_;
		g_string_append_printf (_tmp251_, "<record name=\"%s\"", _tmp254_);
		_g_free0 (_tmp254_);
		_tmp255_ = cl;
		vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp255_);
		_tmp256_ = self->priv->buffer;
		g_string_append_printf (_tmp256_, ">\n");
		_tmp257_ = self->priv->indent;
		self->priv->indent = _tmp257_ + 1;
		_tmp258_ = cl;
		_tmp259_ = vala_gir_writer_get_class_comment (self, _tmp258_);
		_tmp260_ = _tmp259_;
		vala_gir_writer_write_doc (self, _tmp260_);
		_g_free0 (_tmp260_);
		_tmp261_ = cl;
		vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp261_);
		_tmp262_ = self->priv->hierarchy;
		_tmp263_ = cl;
		vala_list_insert ((ValaList*) _tmp262_, 0, (ValaSymbol*) _tmp263_);
		_tmp264_ = cl;
		vala_code_node_accept_children ((ValaCodeNode*) _tmp264_, (ValaCodeVisitor*) self);
		_tmp265_ = self->priv->hierarchy;
		vala_list_remove_at ((ValaList*) _tmp265_, 0);
		_tmp266_ = self->priv->indent;
		self->priv->indent = _tmp266_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp267_ = self->priv->buffer;
		g_string_append_printf (_tmp267_, "</record>\n");
	}
	vala_gir_writer_visit_deferred (self);
}


static void vala_gir_writer_real_visit_struct (ValaCodeVisitor* base, ValaStruct* st) {
	ValaGIRWriter * self;
	ValaStruct* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaStruct* _tmp3_;
	gboolean _tmp4_;
	ValaArrayList* _tmp5_;
	gpointer _tmp6_;
	ValaSymbol* _tmp7_;
	gboolean _tmp8_;
	GString* _tmp11_;
	ValaStruct* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	ValaStruct* _tmp15_;
	GString* _tmp16_;
	gint _tmp17_;
	ValaStruct* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	ValaStruct* _tmp21_;
	ValaArrayList* _tmp22_;
	ValaStruct* _tmp23_;
	ValaStruct* _tmp24_;
	ValaArrayList* _tmp25_;
	gint _tmp26_;
	GString* _tmp27_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (st != NULL);
	_tmp0_ = st;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = st;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	_tmp5_ = self->priv->hierarchy;
	_tmp6_ = vala_list_get ((ValaList*) _tmp5_, 0);
	_tmp7_ = (ValaSymbol*) _tmp6_;
	_tmp8_ = !G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_NAMESPACE);
	_vala_code_node_unref0 (_tmp7_);
	if (_tmp8_) {
		ValaArrayList* _tmp9_;
		ValaStruct* _tmp10_;
		_tmp9_ = self->priv->deferred;
		_tmp10_ = st;
		vala_collection_add ((ValaCollection*) _tmp9_, (ValaCodeNode*) _tmp10_);
		return;
	}
	vala_gir_writer_write_indent (self);
	_tmp11_ = self->priv->buffer;
	_tmp12_ = st;
	_tmp13_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp12_);
	_tmp14_ = _tmp13_;
	g_string_append_printf (_tmp11_, "<record name=\"%s\"", _tmp14_);
	_g_free0 (_tmp14_);
	_tmp15_ = st;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp15_);
	_tmp16_ = self->priv->buffer;
	g_string_append_printf (_tmp16_, ">\n");
	_tmp17_ = self->priv->indent;
	self->priv->indent = _tmp17_ + 1;
	_tmp18_ = st;
	_tmp19_ = vala_gir_writer_get_struct_comment (self, _tmp18_);
	_tmp20_ = _tmp19_;
	vala_gir_writer_write_doc (self, _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = st;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp21_);
	_tmp22_ = self->priv->hierarchy;
	_tmp23_ = st;
	vala_list_insert ((ValaList*) _tmp22_, 0, (ValaSymbol*) _tmp23_);
	_tmp24_ = st;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp24_, (ValaCodeVisitor*) self);
	_tmp25_ = self->priv->hierarchy;
	vala_list_remove_at ((ValaList*) _tmp25_, 0);
	_tmp26_ = self->priv->indent;
	self->priv->indent = _tmp26_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp27_ = self->priv->buffer;
	g_string_append_printf (_tmp27_, "</record>\n");
	vala_gir_writer_visit_deferred (self);
}


static void vala_gir_writer_real_visit_interface (ValaCodeVisitor* base, ValaInterface* iface) {
	ValaGIRWriter * self;
	ValaInterface* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaInterface* _tmp3_;
	gboolean _tmp4_;
	ValaArrayList* _tmp5_;
	gpointer _tmp6_;
	ValaSymbol* _tmp7_;
	gboolean _tmp8_;
	gchar* gtype_struct_name = NULL;
	ValaInterface* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	GString* _tmp15_;
	ValaInterface* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	ValaInterface* _tmp19_;
	GString* _tmp20_;
	const gchar* _tmp21_;
	ValaInterface* _tmp22_;
	GString* _tmp23_;
	gint _tmp24_;
	ValaInterface* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	ValaInterface* _tmp28_;
	ValaList* _tmp29_;
	ValaList* _tmp30_;
	gint _tmp31_;
	gint _tmp32_;
	gboolean _tmp33_;
	ValaInterface* _tmp51_;
	ValaArrayList* _tmp52_;
	ValaInterface* _tmp53_;
	ValaInterface* _tmp54_;
	ValaArrayList* _tmp55_;
	gint _tmp56_;
	GString* _tmp57_;
	GString* _tmp58_;
	const gchar* _tmp59_;
	ValaInterface* _tmp60_;
	GString* _tmp61_;
	ValaInterface* _tmp62_;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	GString* _tmp65_;
	gint _tmp66_;
	GString* _tmp67_;
	gint _tmp68_;
	GString* _tmp69_;
	gint _tmp70_;
	GString* _tmp71_;
	gint _tmp247_;
	GString* _tmp248_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (iface != NULL);
	_tmp0_ = iface;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = iface;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	_tmp5_ = self->priv->hierarchy;
	_tmp6_ = vala_list_get ((ValaList*) _tmp5_, 0);
	_tmp7_ = (ValaSymbol*) _tmp6_;
	_tmp8_ = !G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_NAMESPACE);
	_vala_code_node_unref0 (_tmp7_);
	if (_tmp8_) {
		ValaArrayList* _tmp9_;
		ValaInterface* _tmp10_;
		_tmp9_ = self->priv->deferred;
		_tmp10_ = iface;
		vala_collection_add ((ValaCollection*) _tmp9_, (ValaCodeNode*) _tmp10_);
		return;
	}
	_tmp11_ = iface;
	_tmp12_ = vala_symbol_get_name ((ValaSymbol*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp13_, "Iface", NULL);
	gtype_struct_name = _tmp14_;
	vala_gir_writer_write_indent (self);
	_tmp15_ = self->priv->buffer;
	_tmp16_ = iface;
	_tmp17_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp16_);
	_tmp18_ = _tmp17_;
	g_string_append_printf (_tmp15_, "<interface name=\"%s\"", _tmp18_);
	_g_free0 (_tmp18_);
	_tmp19_ = iface;
	vala_gir_writer_write_gtype_attributes (self, (ValaTypeSymbol*) _tmp19_);
	_tmp20_ = self->priv->buffer;
	_tmp21_ = gtype_struct_name;
	g_string_append_printf (_tmp20_, " glib:type-struct=\"%s\"", _tmp21_);
	_tmp22_ = iface;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp22_);
	_tmp23_ = self->priv->buffer;
	g_string_append_printf (_tmp23_, ">\n");
	_tmp24_ = self->priv->indent;
	self->priv->indent = _tmp24_ + 1;
	_tmp25_ = iface;
	_tmp26_ = vala_gir_writer_get_interface_comment (self, _tmp25_);
	_tmp27_ = _tmp26_;
	vala_gir_writer_write_doc (self, _tmp27_);
	_g_free0 (_tmp27_);
	_tmp28_ = iface;
	_tmp29_ = vala_interface_get_prerequisites (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = vala_collection_get_size ((ValaCollection*) _tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = _tmp32_ > 0;
	_vala_iterable_unref0 (_tmp30_);
	if (_tmp33_) {
		{
			ValaList* _base_type_list = NULL;
			ValaInterface* _tmp34_;
			ValaList* _tmp35_;
			gint _base_type_size = 0;
			ValaList* _tmp36_;
			gint _tmp37_;
			gint _tmp38_;
			gint _base_type_index = 0;
			_tmp34_ = iface;
			_tmp35_ = vala_interface_get_prerequisites (_tmp34_);
			_base_type_list = _tmp35_;
			_tmp36_ = _base_type_list;
			_tmp37_ = vala_collection_get_size ((ValaCollection*) _tmp36_);
			_tmp38_ = _tmp37_;
			_base_type_size = _tmp38_;
			_base_type_index = -1;
			while (TRUE) {
				gint _tmp39_;
				gint _tmp40_;
				gint _tmp41_;
				ValaDataType* base_type = NULL;
				ValaList* _tmp42_;
				gint _tmp43_;
				gpointer _tmp44_;
				GString* _tmp45_;
				ValaDataType* _tmp46_;
				ValaObjectTypeSymbol* _tmp47_;
				ValaObjectTypeSymbol* _tmp48_;
				gchar* _tmp49_;
				gchar* _tmp50_;
				_tmp39_ = _base_type_index;
				_base_type_index = _tmp39_ + 1;
				_tmp40_ = _base_type_index;
				_tmp41_ = _base_type_size;
				if (!(_tmp40_ < _tmp41_)) {
					break;
				}
				_tmp42_ = _base_type_list;
				_tmp43_ = _base_type_index;
				_tmp44_ = vala_list_get (_tmp42_, _tmp43_);
				base_type = (ValaDataType*) _tmp44_;
				vala_gir_writer_write_indent (self);
				_tmp45_ = self->priv->buffer;
				_tmp46_ = base_type;
				_tmp47_ = vala_object_type_get_type_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp46_, VALA_TYPE_OBJECT_TYPE, ValaObjectType));
				_tmp48_ = _tmp47_;
				_tmp49_ = vala_gir_writer_gi_type_name (self, (ValaTypeSymbol*) _tmp48_);
				_tmp50_ = _tmp49_;
				g_string_append_printf (_tmp45_, "<prerequisite name=\"%s\"/>\n", _tmp50_);
				_g_free0 (_tmp50_);
				_vala_code_node_unref0 (base_type);
			}
			_vala_iterable_unref0 (_base_type_list);
		}
	}
	_tmp51_ = iface;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp51_);
	_tmp52_ = self->priv->hierarchy;
	_tmp53_ = iface;
	vala_list_insert ((ValaList*) _tmp52_, 0, (ValaSymbol*) _tmp53_);
	_tmp54_ = iface;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp54_, (ValaCodeVisitor*) self);
	_tmp55_ = self->priv->hierarchy;
	vala_list_remove_at ((ValaList*) _tmp55_, 0);
	_tmp56_ = self->priv->indent;
	self->priv->indent = _tmp56_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp57_ = self->priv->buffer;
	g_string_append_printf (_tmp57_, "</interface>\n");
	vala_gir_writer_write_indent (self);
	_tmp58_ = self->priv->buffer;
	_tmp59_ = gtype_struct_name;
	g_string_append_printf (_tmp58_, "<record name=\"%s\"", _tmp59_);
	_tmp60_ = iface;
	vala_gir_writer_write_ctype_attributes (self, (ValaTypeSymbol*) _tmp60_, "Iface");
	_tmp61_ = self->priv->buffer;
	_tmp62_ = iface;
	_tmp63_ = vala_symbol_get_name ((ValaSymbol*) _tmp62_);
	_tmp64_ = _tmp63_;
	g_string_append_printf (_tmp61_, " glib:is-gtype-struct-for=\"%s\"", _tmp64_);
	_tmp65_ = self->priv->buffer;
	g_string_append_printf (_tmp65_, ">\n");
	_tmp66_ = self->priv->indent;
	self->priv->indent = _tmp66_ + 1;
	vala_gir_writer_write_indent (self);
	_tmp67_ = self->priv->buffer;
	g_string_append_printf (_tmp67_, "<field name=\"parent_iface\">\n");
	_tmp68_ = self->priv->indent;
	self->priv->indent = _tmp68_ + 1;
	vala_gir_writer_write_indent (self);
	_tmp69_ = self->priv->buffer;
	g_string_append_printf (_tmp69_, "<type name=\"GObject.TypeInterface\" c:type=\"GTypeInterface\"/>\n");
	_tmp70_ = self->priv->indent;
	self->priv->indent = _tmp70_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp71_ = self->priv->buffer;
	g_string_append_printf (_tmp71_, "</field>\n");
	{
		ValaList* _m_list = NULL;
		ValaInterface* _tmp72_;
		ValaList* _tmp73_;
		gint _m_size = 0;
		ValaList* _tmp74_;
		gint _tmp75_;
		gint _tmp76_;
		gint _m_index = 0;
		_tmp72_ = iface;
		_tmp73_ = vala_object_type_symbol_get_methods ((ValaObjectTypeSymbol*) _tmp72_);
		_m_list = _tmp73_;
		_tmp74_ = _m_list;
		_tmp75_ = vala_collection_get_size ((ValaCollection*) _tmp74_);
		_tmp76_ = _tmp75_;
		_m_size = _tmp76_;
		_m_index = -1;
		while (TRUE) {
			gint _tmp77_;
			gint _tmp78_;
			gint _tmp79_;
			ValaMethod* m = NULL;
			ValaList* _tmp80_;
			gint _tmp81_;
			gpointer _tmp82_;
			gboolean _tmp83_ = FALSE;
			ValaMethod* _tmp84_;
			gboolean _tmp85_;
			gboolean _tmp86_;
			_tmp77_ = _m_index;
			_m_index = _tmp77_ + 1;
			_tmp78_ = _m_index;
			_tmp79_ = _m_size;
			if (!(_tmp78_ < _tmp79_)) {
				break;
			}
			_tmp80_ = _m_list;
			_tmp81_ = _m_index;
			_tmp82_ = vala_list_get (_tmp80_, _tmp81_);
			m = (ValaMethod*) _tmp82_;
			_tmp84_ = m;
			_tmp85_ = vala_method_get_is_abstract (_tmp84_);
			_tmp86_ = _tmp85_;
			if (_tmp86_) {
				_tmp83_ = TRUE;
			} else {
				ValaMethod* _tmp87_;
				gboolean _tmp88_;
				gboolean _tmp89_;
				_tmp87_ = m;
				_tmp88_ = vala_method_get_is_virtual (_tmp87_);
				_tmp89_ = _tmp88_;
				_tmp83_ = _tmp89_;
			}
			if (_tmp83_) {
				ValaMethod* _tmp90_;
				gboolean _tmp91_;
				gboolean _tmp92_;
				_tmp90_ = m;
				_tmp91_ = vala_method_get_coroutine (_tmp90_);
				_tmp92_ = _tmp91_;
				if (_tmp92_) {
					gchar* finish_name = NULL;
					ValaMethod* _tmp93_;
					const gchar* _tmp94_;
					const gchar* _tmp95_;
					gchar* _tmp96_;
					const gchar* _tmp97_;
					gboolean _tmp98_;
					const gchar* _tmp106_;
					gchar* _tmp107_;
					GString* _tmp108_;
					ValaMethod* _tmp109_;
					const gchar* _tmp110_;
					const gchar* _tmp111_;
					gint _tmp112_;
					ValaMethod* _tmp113_;
					ValaMethod* _tmp114_;
					const gchar* _tmp115_;
					const gchar* _tmp116_;
					ValaMethod* _tmp117_;
					gchar* _tmp118_;
					gchar* _tmp119_;
					ValaMethod* _tmp120_;
					ValaList* _tmp121_;
					ValaList* _tmp122_;
					ValaVoidType* _tmp123_;
					ValaVoidType* _tmp124_;
					gint _tmp125_;
					GString* _tmp126_;
					GString* _tmp127_;
					const gchar* _tmp128_;
					gint _tmp129_;
					ValaMethod* _tmp130_;
					const gchar* _tmp131_;
					ValaMethod* _tmp132_;
					gchar* _tmp133_;
					gchar* _tmp134_;
					ValaMethod* _tmp135_;
					ValaList* _tmp136_;
					ValaList* _tmp137_;
					ValaMethod* _tmp138_;
					ValaDataType* _tmp139_;
					ValaDataType* _tmp140_;
					ValaMethod* _tmp141_;
					gboolean _tmp142_;
					gboolean _tmp143_;
					gint _tmp144_;
					GString* _tmp145_;
					_tmp93_ = m;
					_tmp94_ = vala_symbol_get_name ((ValaSymbol*) _tmp93_);
					_tmp95_ = _tmp94_;
					_tmp96_ = g_strdup (_tmp95_);
					finish_name = _tmp96_;
					_tmp97_ = finish_name;
					_tmp98_ = g_str_has_suffix (_tmp97_, "_async");
					if (_tmp98_) {
						const gchar* _tmp99_;
						const gchar* _tmp100_;
						gint _tmp101_;
						gint _tmp102_;
						gint _tmp103_;
						gint _tmp104_;
						gchar* _tmp105_;
						_tmp99_ = finish_name;
						_tmp100_ = finish_name;
						_tmp101_ = strlen (_tmp100_);
						_tmp102_ = _tmp101_;
						_tmp103_ = strlen ("_async");
						_tmp104_ = _tmp103_;
						_tmp105_ = string_substring (_tmp99_, (glong) 0, (glong) (_tmp102_ - _tmp104_));
						_g_free0 (finish_name);
						finish_name = _tmp105_;
					}
					_tmp106_ = finish_name;
					_tmp107_ = g_strconcat (_tmp106_, "_finish", NULL);
					_g_free0 (finish_name);
					finish_name = _tmp107_;
					vala_gir_writer_write_indent (self);
					_tmp108_ = self->priv->buffer;
					_tmp109_ = m;
					_tmp110_ = vala_symbol_get_name ((ValaSymbol*) _tmp109_);
					_tmp111_ = _tmp110_;
					g_string_append_printf (_tmp108_, "<field name=\"%s\">\n", _tmp111_);
					_tmp112_ = self->priv->indent;
					self->priv->indent = _tmp112_ + 1;
					_tmp113_ = m;
					_tmp114_ = m;
					_tmp115_ = vala_symbol_get_name ((ValaSymbol*) _tmp114_);
					_tmp116_ = _tmp115_;
					_tmp117_ = m;
					_tmp118_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp117_);
					_tmp119_ = _tmp118_;
					_tmp120_ = m;
					_tmp121_ = vala_method_get_async_begin_parameters (_tmp120_);
					_tmp122_ = _tmp121_;
					_tmp123_ = vala_void_type_new (NULL);
					_tmp124_ = _tmp123_;
					vala_gir_writer_do_write_signature (self, _tmp113_, "callback", TRUE, _tmp116_, _tmp119_, _tmp122_, (ValaDataType*) _tmp124_, FALSE, FALSE);
					_vala_code_node_unref0 (_tmp124_);
					_vala_iterable_unref0 (_tmp122_);
					_g_free0 (_tmp119_);
					_tmp125_ = self->priv->indent;
					self->priv->indent = _tmp125_ - 1;
					vala_gir_writer_write_indent (self);
					_tmp126_ = self->priv->buffer;
					g_string_append_printf (_tmp126_, "</field>\n");
					vala_gir_writer_write_indent (self);
					_tmp127_ = self->priv->buffer;
					_tmp128_ = finish_name;
					g_string_append_printf (_tmp127_, "<field name=\"%s\">\n", _tmp128_);
					_tmp129_ = self->priv->indent;
					self->priv->indent = _tmp129_ + 1;
					_tmp130_ = m;
					_tmp131_ = finish_name;
					_tmp132_ = m;
					_tmp133_ = vala_ccode_base_module_get_ccode_finish_name (_tmp132_);
					_tmp134_ = _tmp133_;
					_tmp135_ = m;
					_tmp136_ = vala_method_get_async_end_parameters (_tmp135_);
					_tmp137_ = _tmp136_;
					_tmp138_ = m;
					_tmp139_ = vala_callable_get_return_type ((ValaCallable*) _tmp138_);
					_tmp140_ = _tmp139_;
					_tmp141_ = m;
					_tmp142_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp141_);
					_tmp143_ = _tmp142_;
					vala_gir_writer_do_write_signature (self, _tmp130_, "callback", TRUE, _tmp131_, _tmp134_, _tmp137_, _tmp140_, _tmp143_, FALSE);
					_vala_iterable_unref0 (_tmp137_);
					_g_free0 (_tmp134_);
					_tmp144_ = self->priv->indent;
					self->priv->indent = _tmp144_ - 1;
					vala_gir_writer_write_indent (self);
					_tmp145_ = self->priv->buffer;
					g_string_append_printf (_tmp145_, "</field>\n");
					_g_free0 (finish_name);
				} else {
					GString* _tmp146_;
					ValaMethod* _tmp147_;
					const gchar* _tmp148_;
					const gchar* _tmp149_;
					gint _tmp150_;
					ValaMethod* _tmp151_;
					ValaMethod* _tmp152_;
					const gchar* _tmp153_;
					const gchar* _tmp154_;
					ValaMethod* _tmp155_;
					gchar* _tmp156_;
					gchar* _tmp157_;
					ValaMethod* _tmp158_;
					ValaList* _tmp159_;
					ValaList* _tmp160_;
					ValaMethod* _tmp161_;
					ValaDataType* _tmp162_;
					ValaDataType* _tmp163_;
					ValaMethod* _tmp164_;
					gboolean _tmp165_;
					gboolean _tmp166_;
					gint _tmp167_;
					GString* _tmp168_;
					vala_gir_writer_write_indent (self);
					_tmp146_ = self->priv->buffer;
					_tmp147_ = m;
					_tmp148_ = vala_symbol_get_name ((ValaSymbol*) _tmp147_);
					_tmp149_ = _tmp148_;
					g_string_append_printf (_tmp146_, "<field name=\"%s\">\n", _tmp149_);
					_tmp150_ = self->priv->indent;
					self->priv->indent = _tmp150_ + 1;
					_tmp151_ = m;
					_tmp152_ = m;
					_tmp153_ = vala_symbol_get_name ((ValaSymbol*) _tmp152_);
					_tmp154_ = _tmp153_;
					_tmp155_ = m;
					_tmp156_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp155_);
					_tmp157_ = _tmp156_;
					_tmp158_ = m;
					_tmp159_ = vala_callable_get_parameters ((ValaCallable*) _tmp158_);
					_tmp160_ = _tmp159_;
					_tmp161_ = m;
					_tmp162_ = vala_callable_get_return_type ((ValaCallable*) _tmp161_);
					_tmp163_ = _tmp162_;
					_tmp164_ = m;
					_tmp165_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp164_);
					_tmp166_ = _tmp165_;
					vala_gir_writer_do_write_signature (self, _tmp151_, "callback", TRUE, _tmp154_, _tmp157_, _tmp160_, _tmp163_, _tmp166_, FALSE);
					_vala_iterable_unref0 (_tmp160_);
					_g_free0 (_tmp157_);
					_tmp167_ = self->priv->indent;
					self->priv->indent = _tmp167_ - 1;
					vala_gir_writer_write_indent (self);
					_tmp168_ = self->priv->buffer;
					g_string_append_printf (_tmp168_, "</field>\n");
				}
			}
			_vala_code_node_unref0 (m);
		}
		_vala_iterable_unref0 (_m_list);
	}
	{
		ValaList* _prop_list = NULL;
		ValaInterface* _tmp169_;
		ValaList* _tmp170_;
		gint _prop_size = 0;
		ValaList* _tmp171_;
		gint _tmp172_;
		gint _tmp173_;
		gint _prop_index = 0;
		_tmp169_ = iface;
		_tmp170_ = vala_object_type_symbol_get_properties ((ValaObjectTypeSymbol*) _tmp169_);
		_prop_list = _tmp170_;
		_tmp171_ = _prop_list;
		_tmp172_ = vala_collection_get_size ((ValaCollection*) _tmp171_);
		_tmp173_ = _tmp172_;
		_prop_size = _tmp173_;
		_prop_index = -1;
		while (TRUE) {
			gint _tmp174_;
			gint _tmp175_;
			gint _tmp176_;
			ValaProperty* prop = NULL;
			ValaList* _tmp177_;
			gint _tmp178_;
			gpointer _tmp179_;
			gboolean _tmp180_ = FALSE;
			ValaProperty* _tmp181_;
			gboolean _tmp182_;
			gboolean _tmp183_;
			_tmp174_ = _prop_index;
			_prop_index = _tmp174_ + 1;
			_tmp175_ = _prop_index;
			_tmp176_ = _prop_size;
			if (!(_tmp175_ < _tmp176_)) {
				break;
			}
			_tmp177_ = _prop_list;
			_tmp178_ = _prop_index;
			_tmp179_ = vala_list_get (_tmp177_, _tmp178_);
			prop = (ValaProperty*) _tmp179_;
			_tmp181_ = prop;
			_tmp182_ = vala_property_get_is_abstract (_tmp181_);
			_tmp183_ = _tmp182_;
			if (_tmp183_) {
				_tmp180_ = TRUE;
			} else {
				ValaProperty* _tmp184_;
				gboolean _tmp185_;
				gboolean _tmp186_;
				_tmp184_ = prop;
				_tmp185_ = vala_property_get_is_virtual (_tmp184_);
				_tmp186_ = _tmp185_;
				_tmp180_ = _tmp186_;
			}
			if (_tmp180_) {
				ValaProperty* _tmp187_;
				ValaPropertyAccessor* _tmp188_;
				ValaPropertyAccessor* _tmp189_;
				ValaProperty* _tmp217_;
				ValaPropertyAccessor* _tmp218_;
				ValaPropertyAccessor* _tmp219_;
				_tmp187_ = prop;
				_tmp188_ = vala_property_get_get_accessor (_tmp187_);
				_tmp189_ = _tmp188_;
				if (_tmp189_ != NULL) {
					ValaMethod* m = NULL;
					ValaProperty* _tmp190_;
					ValaPropertyAccessor* _tmp191_;
					ValaPropertyAccessor* _tmp192_;
					ValaMethod* _tmp193_;
					GString* _tmp194_;
					ValaMethod* _tmp195_;
					const gchar* _tmp196_;
					const gchar* _tmp197_;
					gint _tmp198_;
					ValaMethod* _tmp199_;
					ValaMethod* _tmp200_;
					const gchar* _tmp201_;
					const gchar* _tmp202_;
					ValaMethod* _tmp203_;
					gchar* _tmp204_;
					gchar* _tmp205_;
					ValaMethod* _tmp206_;
					ValaList* _tmp207_;
					ValaList* _tmp208_;
					ValaMethod* _tmp209_;
					ValaDataType* _tmp210_;
					ValaDataType* _tmp211_;
					ValaMethod* _tmp212_;
					gboolean _tmp213_;
					gboolean _tmp214_;
					gint _tmp215_;
					GString* _tmp216_;
					_tmp190_ = prop;
					_tmp191_ = vala_property_get_get_accessor (_tmp190_);
					_tmp192_ = _tmp191_;
					_tmp193_ = vala_property_accessor_get_method (_tmp192_);
					m = _tmp193_;
					vala_gir_writer_write_indent (self);
					_tmp194_ = self->priv->buffer;
					_tmp195_ = m;
					_tmp196_ = vala_symbol_get_name ((ValaSymbol*) _tmp195_);
					_tmp197_ = _tmp196_;
					g_string_append_printf (_tmp194_, "<field name=\"%s\">\n", _tmp197_);
					_tmp198_ = self->priv->indent;
					self->priv->indent = _tmp198_ + 1;
					_tmp199_ = m;
					_tmp200_ = m;
					_tmp201_ = vala_symbol_get_name ((ValaSymbol*) _tmp200_);
					_tmp202_ = _tmp201_;
					_tmp203_ = m;
					_tmp204_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp203_);
					_tmp205_ = _tmp204_;
					_tmp206_ = m;
					_tmp207_ = vala_callable_get_parameters ((ValaCallable*) _tmp206_);
					_tmp208_ = _tmp207_;
					_tmp209_ = m;
					_tmp210_ = vala_callable_get_return_type ((ValaCallable*) _tmp209_);
					_tmp211_ = _tmp210_;
					_tmp212_ = m;
					_tmp213_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp212_);
					_tmp214_ = _tmp213_;
					vala_gir_writer_do_write_signature (self, _tmp199_, "callback", TRUE, _tmp202_, _tmp205_, _tmp208_, _tmp211_, _tmp214_, FALSE);
					_vala_iterable_unref0 (_tmp208_);
					_g_free0 (_tmp205_);
					_tmp215_ = self->priv->indent;
					self->priv->indent = _tmp215_ - 1;
					vala_gir_writer_write_indent (self);
					_tmp216_ = self->priv->buffer;
					g_string_append_printf (_tmp216_, "</field>\n");
					_vala_code_node_unref0 (m);
				}
				_tmp217_ = prop;
				_tmp218_ = vala_property_get_set_accessor (_tmp217_);
				_tmp219_ = _tmp218_;
				if (_tmp219_ != NULL) {
					ValaMethod* m = NULL;
					ValaProperty* _tmp220_;
					ValaPropertyAccessor* _tmp221_;
					ValaPropertyAccessor* _tmp222_;
					ValaMethod* _tmp223_;
					GString* _tmp224_;
					ValaMethod* _tmp225_;
					const gchar* _tmp226_;
					const gchar* _tmp227_;
					gint _tmp228_;
					ValaMethod* _tmp229_;
					ValaMethod* _tmp230_;
					const gchar* _tmp231_;
					const gchar* _tmp232_;
					ValaMethod* _tmp233_;
					gchar* _tmp234_;
					gchar* _tmp235_;
					ValaMethod* _tmp236_;
					ValaList* _tmp237_;
					ValaList* _tmp238_;
					ValaMethod* _tmp239_;
					ValaDataType* _tmp240_;
					ValaDataType* _tmp241_;
					ValaMethod* _tmp242_;
					gboolean _tmp243_;
					gboolean _tmp244_;
					gint _tmp245_;
					GString* _tmp246_;
					_tmp220_ = prop;
					_tmp221_ = vala_property_get_set_accessor (_tmp220_);
					_tmp222_ = _tmp221_;
					_tmp223_ = vala_property_accessor_get_method (_tmp222_);
					m = _tmp223_;
					vala_gir_writer_write_indent (self);
					_tmp224_ = self->priv->buffer;
					_tmp225_ = m;
					_tmp226_ = vala_symbol_get_name ((ValaSymbol*) _tmp225_);
					_tmp227_ = _tmp226_;
					g_string_append_printf (_tmp224_, "<field name=\"%s\">\n", _tmp227_);
					_tmp228_ = self->priv->indent;
					self->priv->indent = _tmp228_ + 1;
					_tmp229_ = m;
					_tmp230_ = m;
					_tmp231_ = vala_symbol_get_name ((ValaSymbol*) _tmp230_);
					_tmp232_ = _tmp231_;
					_tmp233_ = m;
					_tmp234_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp233_);
					_tmp235_ = _tmp234_;
					_tmp236_ = m;
					_tmp237_ = vala_callable_get_parameters ((ValaCallable*) _tmp236_);
					_tmp238_ = _tmp237_;
					_tmp239_ = m;
					_tmp240_ = vala_callable_get_return_type ((ValaCallable*) _tmp239_);
					_tmp241_ = _tmp240_;
					_tmp242_ = m;
					_tmp243_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp242_);
					_tmp244_ = _tmp243_;
					vala_gir_writer_do_write_signature (self, _tmp229_, "callback", TRUE, _tmp232_, _tmp235_, _tmp238_, _tmp241_, _tmp244_, FALSE);
					_vala_iterable_unref0 (_tmp238_);
					_g_free0 (_tmp235_);
					_tmp245_ = self->priv->indent;
					self->priv->indent = _tmp245_ - 1;
					vala_gir_writer_write_indent (self);
					_tmp246_ = self->priv->buffer;
					g_string_append_printf (_tmp246_, "</field>\n");
					_vala_code_node_unref0 (m);
				}
			}
			_vala_code_node_unref0 (prop);
		}
		_vala_iterable_unref0 (_prop_list);
	}
	_tmp247_ = self->priv->indent;
	self->priv->indent = _tmp247_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp248_ = self->priv->buffer;
	g_string_append_printf (_tmp248_, "</record>\n");
	vala_gir_writer_visit_deferred (self);
	_g_free0 (gtype_struct_name);
}


static void vala_gir_writer_visit_deferred (ValaGIRWriter* self) {
	ValaArrayList* nodes = NULL;
	ValaArrayList* _tmp0_;
	ValaArrayList* _tmp1_;
	GEqualFunc _tmp2_;
	ValaArrayList* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->deferred;
	_tmp1_ = _vala_iterable_ref0 (_tmp0_);
	nodes = _tmp1_;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_array_list_new (VALA_TYPE_CODE_NODE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp2_);
	_vala_iterable_unref0 (self->priv->deferred);
	self->priv->deferred = _tmp3_;
	{
		ValaArrayList* _node_list = NULL;
		ValaArrayList* _tmp4_;
		ValaArrayList* _tmp5_;
		gint _node_size = 0;
		ValaArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _node_index = 0;
		_tmp4_ = nodes;
		_tmp5_ = _vala_iterable_ref0 (_tmp4_);
		_node_list = _tmp5_;
		_tmp6_ = _node_list;
		_tmp7_ = vala_collection_get_size ((ValaCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_node_size = _tmp8_;
		_node_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			ValaCodeNode* node = NULL;
			ValaArrayList* _tmp12_;
			gint _tmp13_;
			gpointer _tmp14_;
			ValaCodeNode* _tmp15_;
			_tmp9_ = _node_index;
			_node_index = _tmp9_ + 1;
			_tmp10_ = _node_index;
			_tmp11_ = _node_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _node_list;
			_tmp13_ = _node_index;
			_tmp14_ = vala_list_get ((ValaList*) _tmp12_, _tmp13_);
			node = (ValaCodeNode*) _tmp14_;
			_tmp15_ = node;
			vala_code_node_accept (_tmp15_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (node);
		}
		_vala_iterable_unref0 (_node_list);
	}
	_vala_iterable_unref0 (nodes);
}


static gchar* vala_gir_writer_get_gir_name (ValaGIRWriter* self, ValaSymbol* symbol) {
	gchar* result = NULL;
	gchar* gir_name = NULL;
	ValaSymbol* h0 = NULL;
	ValaArrayList* _tmp0_;
	gpointer _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	gir_name = NULL;
	_tmp0_ = self->priv->hierarchy;
	_tmp1_ = vala_list_get ((ValaList*) _tmp0_, 0);
	h0 = (ValaSymbol*) _tmp1_;
	{
		ValaSymbol* cur_sym = NULL;
		ValaSymbol* _tmp2_;
		ValaSymbol* _tmp3_;
		_tmp2_ = symbol;
		_tmp3_ = _vala_code_node_ref0 (_tmp2_);
		cur_sym = _tmp3_;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				ValaSymbol* _tmp9_;
				ValaSymbol* _tmp10_;
				ValaSymbol* _tmp11_;
				gchar* cur_name = NULL;
				ValaSymbol* _tmp12_;
				gchar* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				gchar* _tmp21_;
				if (!_tmp4_) {
					ValaSymbol* _tmp5_;
					ValaSymbol* _tmp6_;
					ValaSymbol* _tmp7_;
					ValaSymbol* _tmp8_;
					_tmp5_ = cur_sym;
					_tmp6_ = vala_symbol_get_parent_symbol (_tmp5_);
					_tmp7_ = _tmp6_;
					_tmp8_ = _vala_code_node_ref0 (_tmp7_);
					_vala_code_node_unref0 (cur_sym);
					cur_sym = _tmp8_;
				}
				_tmp4_ = FALSE;
				_tmp9_ = cur_sym;
				if (!(_tmp9_ != NULL)) {
					break;
				}
				_tmp10_ = cur_sym;
				_tmp11_ = h0;
				if (_tmp10_ == _tmp11_) {
					break;
				}
				_tmp12_ = cur_sym;
				_tmp13_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp12_, "GIR", "name", NULL);
				cur_name = _tmp13_;
				_tmp14_ = cur_name;
				if (_tmp14_ == NULL) {
					ValaSymbol* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					gchar* _tmp18_;
					_tmp15_ = cur_sym;
					_tmp16_ = vala_symbol_get_name (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp18_ = g_strdup (_tmp17_);
					_g_free0 (cur_name);
					cur_name = _tmp18_;
				}
				_tmp19_ = cur_name;
				_tmp20_ = gir_name;
				_tmp21_ = g_strconcat (_tmp19_, _tmp20_, NULL);
				_g_free0 (gir_name);
				gir_name = _tmp21_;
				_g_free0 (cur_name);
			}
		}
		_vala_code_node_unref0 (cur_sym);
	}
	result = gir_name;
	_vala_code_node_unref0 (h0);
	return result;
}


static void vala_gir_writer_real_visit_enum (ValaCodeVisitor* base, ValaEnum* en) {
	ValaGIRWriter * self;
	ValaEnum* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaEnum* _tmp3_;
	gboolean _tmp4_;
	ValaArrayList* _tmp5_;
	gpointer _tmp6_;
	ValaSymbol* _tmp7_;
	gboolean _tmp8_;
	const gchar* _tmp11_ = NULL;
	ValaEnum* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gchar* element_name = NULL;
	gchar* _tmp15_;
	GString* _tmp16_;
	const gchar* _tmp17_;
	ValaEnum* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	ValaEnum* _tmp21_;
	ValaEnum* _tmp22_;
	GString* _tmp23_;
	gint _tmp24_;
	ValaEnum* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	ValaEnum* _tmp28_;
	ValaArrayList* _tmp29_;
	ValaEnum* _tmp30_;
	ValaEnum* _tmp31_;
	ValaArrayList* _tmp32_;
	gint _tmp33_;
	GString* _tmp34_;
	const gchar* _tmp35_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (en != NULL);
	_tmp0_ = en;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = en;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	_tmp5_ = self->priv->hierarchy;
	_tmp6_ = vala_list_get ((ValaList*) _tmp5_, 0);
	_tmp7_ = (ValaSymbol*) _tmp6_;
	_tmp8_ = !G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_NAMESPACE);
	_vala_code_node_unref0 (_tmp7_);
	if (_tmp8_) {
		ValaArrayList* _tmp9_;
		ValaEnum* _tmp10_;
		_tmp9_ = self->priv->deferred;
		_tmp10_ = en;
		vala_collection_add ((ValaCollection*) _tmp9_, (ValaCodeNode*) _tmp10_);
		return;
	}
	_tmp12_ = en;
	_tmp13_ = vala_enum_get_is_flags (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_) {
		_tmp11_ = "bitfield";
	} else {
		_tmp11_ = "enumeration";
	}
	_tmp15_ = g_strdup (_tmp11_);
	element_name = _tmp15_;
	vala_gir_writer_write_indent (self);
	_tmp16_ = self->priv->buffer;
	_tmp17_ = element_name;
	_tmp18_ = en;
	_tmp19_ = vala_gir_writer_get_gir_name (self, (ValaSymbol*) _tmp18_);
	_tmp20_ = _tmp19_;
	g_string_append_printf (_tmp16_, "<%s name=\"%s\"", _tmp17_, _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = en;
	vala_gir_writer_write_gtype_attributes (self, (ValaTypeSymbol*) _tmp21_);
	_tmp22_ = en;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp22_);
	_tmp23_ = self->priv->buffer;
	g_string_append_printf (_tmp23_, ">\n");
	_tmp24_ = self->priv->indent;
	self->priv->indent = _tmp24_ + 1;
	_tmp25_ = en;
	_tmp26_ = vala_gir_writer_get_enum_comment (self, _tmp25_);
	_tmp27_ = _tmp26_;
	vala_gir_writer_write_doc (self, _tmp27_);
	_g_free0 (_tmp27_);
	_tmp28_ = en;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp28_);
	self->priv->enum_value = 0;
	_tmp29_ = self->priv->hierarchy;
	_tmp30_ = en;
	vala_list_insert ((ValaList*) _tmp29_, 0, (ValaSymbol*) _tmp30_);
	_tmp31_ = en;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp31_, (ValaCodeVisitor*) self);
	_tmp32_ = self->priv->hierarchy;
	vala_list_remove_at ((ValaList*) _tmp32_, 0);
	_tmp33_ = self->priv->indent;
	self->priv->indent = _tmp33_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp34_ = self->priv->buffer;
	_tmp35_ = element_name;
	g_string_append_printf (_tmp34_, "</%s>\n", _tmp35_);
	vala_gir_writer_visit_deferred (self);
	_g_free0 (element_name);
}


static void vala_gir_writer_real_visit_enum_value (ValaCodeVisitor* base, ValaEnumValue* ev) {
	ValaGIRWriter * self;
	ValaEnum* en = NULL;
	ValaArrayList* _tmp0_;
	gpointer _tmp1_;
	GString* _tmp2_;
	ValaEnumValue* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	ValaEnumValue* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	ValaEnumValue* _tmp11_;
	ValaExpression* _tmp12_;
	ValaExpression* _tmp13_;
	ValaEnumValue* _tmp27_;
	gchar* comment = NULL;
	ValaEnumValue* _tmp28_;
	gchar* _tmp29_;
	const gchar* _tmp30_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (ev != NULL);
	vala_gir_writer_write_indent (self);
	_tmp0_ = self->priv->hierarchy;
	_tmp1_ = vala_list_get ((ValaList*) _tmp0_, 0);
	en = G_TYPE_CHECK_INSTANCE_CAST ((ValaSymbol*) _tmp1_, VALA_TYPE_ENUM, ValaEnum);
	_tmp2_ = self->priv->buffer;
	_tmp3_ = ev;
	_tmp4_ = vala_symbol_get_name ((ValaSymbol*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_utf8_strdown (_tmp5_, (gssize) -1);
	_tmp7_ = _tmp6_;
	_tmp8_ = ev;
	_tmp9_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp8_);
	_tmp10_ = _tmp9_;
	g_string_append_printf (_tmp2_, "<member name=\"%s\" c:identifier=\"%s\"", _tmp7_, _tmp10_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp7_);
	_tmp11_ = ev;
	_tmp12_ = vala_constant_get_value ((ValaConstant*) _tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_ != NULL) {
		gchar* value = NULL;
		ValaEnumValue* _tmp14_;
		ValaExpression* _tmp15_;
		ValaExpression* _tmp16_;
		gchar* _tmp17_;
		GString* _tmp18_;
		const gchar* _tmp19_;
		_tmp14_ = ev;
		_tmp15_ = vala_constant_get_value ((ValaConstant*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = vala_gir_writer_literal_expression_to_value_string (self, _tmp16_);
		value = _tmp17_;
		_tmp18_ = self->priv->buffer;
		_tmp19_ = value;
		g_string_append_printf (_tmp18_, " value=\"%s\"", _tmp19_);
		_g_free0 (value);
	} else {
		ValaEnum* _tmp20_;
		gboolean _tmp21_;
		gboolean _tmp22_;
		_tmp20_ = en;
		_tmp21_ = vala_enum_get_is_flags (_tmp20_);
		_tmp22_ = _tmp21_;
		if (_tmp22_) {
			GString* _tmp23_;
			gint _tmp24_;
			_tmp23_ = self->priv->buffer;
			_tmp24_ = self->priv->enum_value;
			self->priv->enum_value = _tmp24_ + 1;
			g_string_append_printf (_tmp23_, " value=\"%d\"", 1 << _tmp24_);
		} else {
			GString* _tmp25_;
			gint _tmp26_;
			_tmp25_ = self->priv->buffer;
			_tmp26_ = self->priv->enum_value;
			self->priv->enum_value = _tmp26_ + 1;
			g_string_append_printf (_tmp25_, " value=\"%d\"", _tmp26_);
		}
	}
	_tmp27_ = ev;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp27_);
	_tmp28_ = ev;
	_tmp29_ = vala_gir_writer_get_enum_value_comment (self, _tmp28_);
	comment = _tmp29_;
	_tmp30_ = comment;
	if (_tmp30_ == NULL) {
		GString* _tmp31_;
		_tmp31_ = self->priv->buffer;
		g_string_append_printf (_tmp31_, "/>\n");
	} else {
		GString* _tmp32_;
		gint _tmp33_;
		const gchar* _tmp34_;
		gint _tmp35_;
		GString* _tmp36_;
		_tmp32_ = self->priv->buffer;
		g_string_append_printf (_tmp32_, ">\n");
		_tmp33_ = self->priv->indent;
		self->priv->indent = _tmp33_ + 1;
		_tmp34_ = comment;
		vala_gir_writer_write_doc (self, _tmp34_);
		_tmp35_ = self->priv->indent;
		self->priv->indent = _tmp35_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp36_ = self->priv->buffer;
		g_string_append_printf (_tmp36_, "</member>\n");
	}
	_g_free0 (comment);
	_vala_code_node_unref0 (en);
}


static void vala_gir_writer_real_visit_error_domain (ValaCodeVisitor* base, ValaErrorDomain* edomain) {
	ValaGIRWriter * self;
	ValaErrorDomain* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaErrorDomain* _tmp3_;
	gboolean _tmp4_;
	GString* _tmp5_;
	ValaErrorDomain* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	ValaErrorDomain* _tmp9_;
	GString* _tmp10_;
	ValaErrorDomain* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GString* _tmp14_;
	gint _tmp15_;
	ValaErrorDomain* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	ValaArrayList* _tmp19_;
	ValaErrorDomain* _tmp20_;
	ValaErrorDomain* _tmp21_;
	ValaArrayList* _tmp22_;
	gint _tmp23_;
	GString* _tmp24_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (edomain != NULL);
	_tmp0_ = edomain;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = edomain;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	vala_gir_writer_write_indent (self);
	_tmp5_ = self->priv->buffer;
	_tmp6_ = edomain;
	_tmp7_ = vala_symbol_get_name ((ValaSymbol*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_string_append_printf (_tmp5_, "<enumeration name=\"%s\"", _tmp8_);
	_tmp9_ = edomain;
	vala_gir_writer_write_ctype_attributes (self, (ValaTypeSymbol*) _tmp9_, "");
	_tmp10_ = self->priv->buffer;
	_tmp11_ = edomain;
	_tmp12_ = vala_ccode_base_module_get_quark_name (_tmp11_);
	_tmp13_ = _tmp12_;
	g_string_append_printf (_tmp10_, " glib:error-domain=\"%s\"", _tmp13_);
	_g_free0 (_tmp13_);
	_tmp14_ = self->priv->buffer;
	g_string_append_printf (_tmp14_, ">\n");
	_tmp15_ = self->priv->indent;
	self->priv->indent = _tmp15_ + 1;
	_tmp16_ = edomain;
	_tmp17_ = vala_gir_writer_get_error_domain_comment (self, _tmp16_);
	_tmp18_ = _tmp17_;
	vala_gir_writer_write_doc (self, _tmp18_);
	_g_free0 (_tmp18_);
	self->priv->enum_value = 0;
	_tmp19_ = self->priv->hierarchy;
	_tmp20_ = edomain;
	vala_list_insert ((ValaList*) _tmp19_, 0, (ValaSymbol*) _tmp20_);
	_tmp21_ = edomain;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp21_, (ValaCodeVisitor*) self);
	_tmp22_ = self->priv->hierarchy;
	vala_list_remove_at ((ValaList*) _tmp22_, 0);
	_tmp23_ = self->priv->indent;
	self->priv->indent = _tmp23_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp24_ = self->priv->buffer;
	g_string_append_printf (_tmp24_, "</enumeration>\n");
	vala_gir_writer_visit_deferred (self);
}


static void vala_gir_writer_real_visit_error_code (ValaCodeVisitor* base, ValaErrorCode* ecode) {
	ValaGIRWriter * self;
	GString* _tmp0_;
	ValaErrorCode* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	ValaErrorCode* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ValaErrorCode* _tmp9_;
	ValaExpression* _tmp10_;
	ValaExpression* _tmp11_;
	ValaErrorCode* _tmp20_;
	gchar* comment = NULL;
	ValaErrorCode* _tmp21_;
	gchar* _tmp22_;
	const gchar* _tmp23_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (ecode != NULL);
	vala_gir_writer_write_indent (self);
	_tmp0_ = self->priv->buffer;
	_tmp1_ = ecode;
	_tmp2_ = vala_symbol_get_name ((ValaSymbol*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_utf8_strdown (_tmp3_, (gssize) -1);
	_tmp5_ = _tmp4_;
	_tmp6_ = ecode;
	_tmp7_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_string_append_printf (_tmp0_, "<member name=\"%s\" c:identifier=\"%s\"", _tmp5_, _tmp8_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp5_);
	_tmp9_ = ecode;
	_tmp10_ = vala_error_code_get_value (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_ != NULL) {
		gchar* value = NULL;
		ValaErrorCode* _tmp12_;
		ValaExpression* _tmp13_;
		ValaExpression* _tmp14_;
		gchar* _tmp15_;
		GString* _tmp16_;
		const gchar* _tmp17_;
		_tmp12_ = ecode;
		_tmp13_ = vala_error_code_get_value (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = vala_gir_writer_literal_expression_to_value_string (self, _tmp14_);
		value = _tmp15_;
		_tmp16_ = self->priv->buffer;
		_tmp17_ = value;
		g_string_append_printf (_tmp16_, " value=\"%s\"", _tmp17_);
		_g_free0 (value);
	} else {
		GString* _tmp18_;
		gint _tmp19_;
		_tmp18_ = self->priv->buffer;
		_tmp19_ = self->priv->enum_value;
		self->priv->enum_value = _tmp19_ + 1;
		g_string_append_printf (_tmp18_, " value=\"%d\"", _tmp19_);
	}
	_tmp20_ = ecode;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp20_);
	_tmp21_ = ecode;
	_tmp22_ = vala_gir_writer_get_error_code_comment (self, _tmp21_);
	comment = _tmp22_;
	_tmp23_ = comment;
	if (_tmp23_ == NULL) {
		GString* _tmp24_;
		_tmp24_ = self->priv->buffer;
		g_string_append_printf (_tmp24_, "/>\n");
	} else {
		GString* _tmp25_;
		gint _tmp26_;
		const gchar* _tmp27_;
		gint _tmp28_;
		GString* _tmp29_;
		_tmp25_ = self->priv->buffer;
		g_string_append_printf (_tmp25_, ">\n");
		_tmp26_ = self->priv->indent;
		self->priv->indent = _tmp26_ + 1;
		_tmp27_ = comment;
		vala_gir_writer_write_doc (self, _tmp27_);
		_tmp28_ = self->priv->indent;
		self->priv->indent = _tmp28_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp29_ = self->priv->buffer;
		g_string_append_printf (_tmp29_, "</member>\n");
	}
	_g_free0 (comment);
}


static void vala_gir_writer_real_visit_constant (ValaCodeVisitor* base, ValaConstant* c) {
	ValaGIRWriter * self;
	ValaConstant* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaConstant* _tmp3_;
	gboolean _tmp4_;
	ValaExpression* initializer = NULL;
	ValaConstant* _tmp5_;
	ValaExpression* _tmp6_;
	ValaExpression* _tmp7_;
	ValaExpression* _tmp8_;
	gchar* value = NULL;
	ValaExpression* _tmp9_;
	gchar* _tmp10_;
	GString* _tmp11_;
	ValaConstant* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	ValaConstant* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GString* _tmp18_;
	const gchar* _tmp19_;
	ValaConstant* _tmp20_;
	GString* _tmp21_;
	gint _tmp22_;
	ValaConstant* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	ValaExpression* _tmp26_;
	ValaDataType* _tmp27_;
	ValaDataType* _tmp28_;
	gint _tmp29_;
	GString* _tmp30_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (c != NULL);
	_tmp0_ = c;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = c;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	_tmp5_ = c;
	_tmp6_ = vala_constant_get_value (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _vala_code_node_ref0 (_tmp7_);
	initializer = _tmp8_;
	_tmp9_ = initializer;
	_tmp10_ = vala_gir_writer_literal_expression_to_value_string (self, _tmp9_);
	value = _tmp10_;
	vala_gir_writer_write_indent (self);
	_tmp11_ = self->priv->buffer;
	_tmp12_ = c;
	_tmp13_ = vala_symbol_get_name ((ValaSymbol*) _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = c;
	_tmp16_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp15_);
	_tmp17_ = _tmp16_;
	g_string_append_printf (_tmp11_, "<constant name=\"%s\" c:identifier=\"%s\"", _tmp14_, _tmp17_);
	_g_free0 (_tmp17_);
	_tmp18_ = self->priv->buffer;
	_tmp19_ = value;
	g_string_append_printf (_tmp18_, " value=\"%s\"", _tmp19_);
	_tmp20_ = c;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp20_);
	_tmp21_ = self->priv->buffer;
	g_string_append_printf (_tmp21_, ">\n");
	_tmp22_ = self->priv->indent;
	self->priv->indent = _tmp22_ + 1;
	_tmp23_ = c;
	_tmp24_ = vala_gir_writer_get_constant_comment (self, _tmp23_);
	_tmp25_ = _tmp24_;
	vala_gir_writer_write_doc (self, _tmp25_);
	_g_free0 (_tmp25_);
	_tmp26_ = initializer;
	_tmp27_ = vala_expression_get_value_type (_tmp26_);
	_tmp28_ = _tmp27_;
	vala_gir_writer_write_type (self, _tmp28_, -1, VALA_PARAMETER_DIRECTION_IN);
	_tmp29_ = self->priv->indent;
	self->priv->indent = _tmp29_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp30_ = self->priv->buffer;
	g_string_append_printf (_tmp30_, "</constant>\n");
	_g_free0 (value);
	_vala_code_node_unref0 (initializer);
}


static void vala_gir_writer_real_visit_field (ValaCodeVisitor* base, ValaField* f) {
	ValaGIRWriter * self;
	ValaField* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaField* _tmp3_;
	gboolean _tmp4_;
	GString* _tmp5_;
	ValaField* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ValaField* _tmp9_;
	ValaDataType* _tmp10_;
	ValaDataType* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	ValaField* _tmp15_;
	GString* _tmp16_;
	gint _tmp17_;
	ValaField* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	ValaField* _tmp21_;
	ValaField* _tmp22_;
	ValaDataType* _tmp23_;
	ValaDataType* _tmp24_;
	gint _tmp25_;
	GString* _tmp26_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (f != NULL);
	_tmp0_ = f;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = f;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	vala_gir_writer_write_indent (self);
	_tmp5_ = self->priv->buffer;
	_tmp6_ = f;
	_tmp7_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_string_append_printf (_tmp5_, "<field name=\"%s\"", _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = f;
	_tmp10_ = vala_variable_get_variable_type ((ValaVariable*) _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = vala_data_type_get_nullable (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_) {
		GString* _tmp14_;
		_tmp14_ = self->priv->buffer;
		g_string_append_printf (_tmp14_, " allow-none=\"1\"");
	}
	_tmp15_ = f;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp15_);
	_tmp16_ = self->priv->buffer;
	g_string_append_printf (_tmp16_, ">\n");
	_tmp17_ = self->priv->indent;
	self->priv->indent = _tmp17_ + 1;
	_tmp18_ = f;
	_tmp19_ = vala_gir_writer_get_field_comment (self, _tmp18_);
	_tmp20_ = _tmp19_;
	vala_gir_writer_write_doc (self, _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = f;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp21_);
	_tmp22_ = f;
	_tmp23_ = vala_variable_get_variable_type ((ValaVariable*) _tmp22_);
	_tmp24_ = _tmp23_;
	vala_gir_writer_write_type (self, _tmp24_, -1, VALA_PARAMETER_DIRECTION_IN);
	_tmp25_ = self->priv->indent;
	self->priv->indent = _tmp25_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp26_ = self->priv->buffer;
	g_string_append_printf (_tmp26_, "</field>\n");
}


static void vala_gir_writer_write_implicit_params (ValaGIRWriter* self, ValaDataType* type, gint* index, gboolean has_array_length, const gchar* name, ValaParameterDirection direction) {
	gboolean _tmp0_ = FALSE;
	ValaDataType* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (type != NULL);
	g_return_if_fail (name != NULL);
	_tmp1_ = type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_ARRAY_TYPE)) {
		gboolean _tmp2_;
		_tmp2_ = has_array_length;
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ValaIntegerType* int_type = NULL;
		ValaCodeContext* _tmp3_;
		ValaCodeContext* _tmp4_;
		ValaNamespace* _tmp5_;
		ValaNamespace* _tmp6_;
		ValaScope* _tmp7_;
		ValaScope* _tmp8_;
		ValaSymbol* _tmp9_;
		ValaStruct* _tmp10_;
		ValaStruct* _tmp11_;
		ValaIntegerType* _tmp12_;
		ValaIntegerType* _tmp13_;
		_tmp3_ = vala_code_context_get ();
		_tmp4_ = _tmp3_;
		_tmp5_ = vala_code_context_get_root (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = vala_symbol_get_scope ((ValaSymbol*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = vala_scope_lookup (_tmp8_, "int");
		_tmp10_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, VALA_TYPE_STRUCT) ? ((ValaStruct*) _tmp9_) : NULL;
		if (_tmp10_ == NULL) {
			_vala_code_node_unref0 (_tmp9_);
		}
		_tmp11_ = _tmp10_;
		_tmp12_ = vala_integer_type_new (_tmp11_, NULL, NULL);
		_tmp13_ = _tmp12_;
		_vala_code_node_unref0 (_tmp11_);
		_vala_code_context_unref0 (_tmp4_);
		int_type = _tmp13_;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp14_ = FALSE;
				_tmp14_ = TRUE;
				while (TRUE) {
					gint _tmp16_;
					ValaDataType* _tmp17_;
					gint _tmp18_;
					gint _tmp19_;
					ValaIntegerType* _tmp20_;
					gboolean _tmp21_;
					const gchar* _tmp22_;
					gint _tmp23_;
					gchar* _tmp24_;
					gchar* _tmp25_;
					ValaParameterDirection _tmp26_;
					if (!_tmp14_) {
						gint _tmp15_;
						_tmp15_ = i;
						i = _tmp15_ + 1;
					}
					_tmp14_ = FALSE;
					_tmp16_ = i;
					_tmp17_ = type;
					_tmp18_ = vala_array_type_get_rank (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
					_tmp19_ = _tmp18_;
					if (!(_tmp16_ < _tmp19_)) {
						break;
					}
					_tmp20_ = int_type;
					_tmp21_ = has_array_length;
					_tmp22_ = name;
					_tmp23_ = i;
					_tmp24_ = g_strdup_printf ("%s_length%i", _tmp22_, _tmp23_ + 1);
					_tmp25_ = _tmp24_;
					_tmp26_ = direction;
					vala_gir_writer_write_param_or_return (self, (ValaDataType*) _tmp20_, TRUE, index, _tmp21_, _tmp25_, NULL, _tmp26_, FALSE, FALSE);
					_g_free0 (_tmp25_);
				}
			}
		}
		_vala_code_node_unref0 (int_type);
	} else {
		ValaDataType* _tmp27_;
		_tmp27_ = type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp27_, VALA_TYPE_DELEGATE_TYPE)) {
			ValaDelegateType* deleg_type = NULL;
			ValaDataType* _tmp28_;
			ValaDelegateType* _tmp29_;
			ValaDelegateType* _tmp30_;
			ValaDelegate* _tmp31_;
			ValaDelegate* _tmp32_;
			gboolean _tmp33_;
			gboolean _tmp34_;
			_tmp28_ = type;
			_tmp29_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
			deleg_type = _tmp29_;
			_tmp30_ = deleg_type;
			_tmp31_ = vala_delegate_type_get_delegate_symbol (_tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = vala_delegate_get_has_target (_tmp32_);
			_tmp34_ = _tmp33_;
			if (_tmp34_) {
				ValaPointerType* data_type = NULL;
				ValaVoidType* _tmp35_;
				ValaVoidType* _tmp36_;
				ValaPointerType* _tmp37_;
				ValaPointerType* _tmp38_;
				ValaPointerType* _tmp39_;
				const gchar* _tmp40_;
				gchar* _tmp41_;
				gchar* _tmp42_;
				ValaParameterDirection _tmp43_;
				ValaDelegateType* _tmp44_;
				gboolean _tmp45_;
				_tmp35_ = vala_void_type_new (NULL);
				_tmp36_ = _tmp35_;
				_tmp37_ = vala_pointer_type_new ((ValaDataType*) _tmp36_, NULL);
				_tmp38_ = _tmp37_;
				_vala_code_node_unref0 (_tmp36_);
				data_type = _tmp38_;
				_tmp39_ = data_type;
				_tmp40_ = name;
				_tmp41_ = g_strdup_printf ("%s_target", _tmp40_);
				_tmp42_ = _tmp41_;
				_tmp43_ = direction;
				vala_gir_writer_write_param_or_return (self, (ValaDataType*) _tmp39_, TRUE, index, FALSE, _tmp42_, NULL, _tmp43_, FALSE, FALSE);
				_g_free0 (_tmp42_);
				_tmp44_ = deleg_type;
				_tmp45_ = vala_data_type_is_disposable ((ValaDataType*) _tmp44_);
				if (_tmp45_) {
					ValaDelegateType* notify_type = NULL;
					ValaCodeContext* _tmp46_;
					ValaCodeContext* _tmp47_;
					ValaNamespace* _tmp48_;
					ValaNamespace* _tmp49_;
					ValaScope* _tmp50_;
					ValaScope* _tmp51_;
					ValaSymbol* _tmp52_;
					ValaSymbol* _tmp53_;
					ValaScope* _tmp54_;
					ValaScope* _tmp55_;
					ValaSymbol* _tmp56_;
					ValaDelegate* _tmp57_;
					ValaDelegate* _tmp58_;
					ValaDelegateType* _tmp59_;
					ValaDelegateType* _tmp60_;
					ValaDelegateType* _tmp61_;
					const gchar* _tmp62_;
					gchar* _tmp63_;
					gchar* _tmp64_;
					ValaParameterDirection _tmp65_;
					_tmp46_ = vala_code_context_get ();
					_tmp47_ = _tmp46_;
					_tmp48_ = vala_code_context_get_root (_tmp47_);
					_tmp49_ = _tmp48_;
					_tmp50_ = vala_symbol_get_scope ((ValaSymbol*) _tmp49_);
					_tmp51_ = _tmp50_;
					_tmp52_ = vala_scope_lookup (_tmp51_, "GLib");
					_tmp53_ = _tmp52_;
					_tmp54_ = vala_symbol_get_scope (_tmp53_);
					_tmp55_ = _tmp54_;
					_tmp56_ = vala_scope_lookup (_tmp55_, "DestroyNotify");
					_tmp57_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp56_, VALA_TYPE_DELEGATE) ? ((ValaDelegate*) _tmp56_) : NULL;
					if (_tmp57_ == NULL) {
						_vala_code_node_unref0 (_tmp56_);
					}
					_tmp58_ = _tmp57_;
					_tmp59_ = vala_delegate_type_new (_tmp58_);
					_tmp60_ = _tmp59_;
					_vala_code_node_unref0 (_tmp58_);
					_vala_code_node_unref0 (_tmp53_);
					_vala_code_context_unref0 (_tmp47_);
					notify_type = _tmp60_;
					_tmp61_ = notify_type;
					_tmp62_ = name;
					_tmp63_ = g_strdup_printf ("%s_target_destroy_notify", _tmp62_);
					_tmp64_ = _tmp63_;
					_tmp65_ = direction;
					vala_gir_writer_write_param_or_return (self, (ValaDataType*) _tmp61_, TRUE, index, FALSE, _tmp64_, NULL, _tmp65_, FALSE, FALSE);
					_g_free0 (_tmp64_);
					_vala_code_node_unref0 (notify_type);
				}
				_vala_code_node_unref0 (data_type);
			}
			_vala_code_node_unref0 (deleg_type);
		}
	}
}


static void vala_gir_writer_skip_implicit_params (ValaGIRWriter* self, ValaDataType* type, gint* index, gboolean has_array_length) {
	gboolean _tmp0_ = FALSE;
	ValaDataType* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (type != NULL);
	_tmp1_ = type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_ARRAY_TYPE)) {
		gboolean _tmp2_;
		_tmp2_ = has_array_length;
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint _tmp3_;
		ValaDataType* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		_tmp3_ = *index;
		_tmp4_ = type;
		_tmp5_ = vala_array_type_get_rank (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
		_tmp6_ = _tmp5_;
		*index = _tmp3_ + _tmp6_;
	} else {
		ValaDataType* _tmp7_;
		_tmp7_ = type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_DELEGATE_TYPE)) {
			gint _tmp8_;
			ValaDelegateType* deleg_type = NULL;
			ValaDataType* _tmp9_;
			ValaDelegateType* _tmp10_;
			ValaDelegateType* _tmp11_;
			gboolean _tmp12_;
			_tmp8_ = *index;
			*index = _tmp8_ + 1;
			_tmp9_ = type;
			_tmp10_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
			deleg_type = _tmp10_;
			_tmp11_ = deleg_type;
			_tmp12_ = vala_data_type_is_disposable ((ValaDataType*) _tmp11_);
			if (_tmp12_) {
				gint _tmp13_;
				_tmp13_ = *index;
				*index = _tmp13_ + 1;
			}
			_vala_code_node_unref0 (deleg_type);
		}
	}
}


static void vala_gir_writer_write_params_and_return (ValaGIRWriter* self, ValaList* params, ValaDataType* return_type, gboolean return_array_length, const gchar* return_comment, gboolean constructor, ValaDataType* instance_type, gboolean user_data) {
	gint last_index = 0;
	gboolean _tmp0_ = FALSE;
	ValaDataType* _tmp1_;
	gboolean ret_is_struct = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	ValaList* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gboolean _tmp48_ = FALSE;
	ValaDataType* _tmp49_;
	gboolean _tmp59_ = FALSE;
	gboolean _tmp60_ = FALSE;
	gboolean _tmp61_ = FALSE;
	gboolean _tmp62_ = FALSE;
	ValaList* _tmp63_;
	gint _tmp64_;
	gint _tmp65_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (params != NULL);
	last_index = 0;
	_tmp1_ = return_type;
	if (_tmp1_ != NULL) {
		ValaDataType* _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = return_type;
		_tmp3_ = vala_data_type_is_real_non_null_struct_type (_tmp2_);
		_tmp0_ = _tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	ret_is_struct = _tmp0_;
	_tmp8_ = params;
	_tmp9_ = vala_collection_get_size ((ValaCollection*) _tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_ != 0) {
		_tmp7_ = TRUE;
	} else {
		ValaDataType* _tmp11_;
		_tmp11_ = instance_type;
		_tmp7_ = _tmp11_ != NULL;
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		gboolean _tmp12_ = FALSE;
		ValaDataType* _tmp13_;
		_tmp13_ = return_type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, VALA_TYPE_ARRAY_TYPE)) {
			gboolean _tmp14_;
			_tmp14_ = return_array_length;
			_tmp12_ = _tmp14_;
		} else {
			_tmp12_ = FALSE;
		}
		_tmp6_ = _tmp12_;
	}
	if (_tmp6_) {
		_tmp5_ = TRUE;
	} else {
		ValaDataType* _tmp15_;
		_tmp15_ = return_type;
		_tmp5_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, VALA_TYPE_DELEGATE_TYPE);
	}
	if (_tmp5_) {
		_tmp4_ = TRUE;
	} else {
		gboolean _tmp16_;
		_tmp16_ = ret_is_struct;
		_tmp4_ = _tmp16_;
	}
	if (_tmp4_) {
		gint index = 0;
		ValaDataType* _tmp17_;
		gboolean _tmp36_;
		gint _tmp47_;
		index = 0;
		_tmp17_ = instance_type;
		if (_tmp17_ != NULL) {
			gint _tmp18_;
			_tmp18_ = index;
			index = _tmp18_ + 1;
		}
		{
			ValaList* _param_list = NULL;
			ValaList* _tmp19_;
			ValaList* _tmp20_;
			gint _param_size = 0;
			ValaList* _tmp21_;
			gint _tmp22_;
			gint _tmp23_;
			gint _param_index = 0;
			_tmp19_ = params;
			_tmp20_ = _vala_iterable_ref0 (_tmp19_);
			_param_list = _tmp20_;
			_tmp21_ = _param_list;
			_tmp22_ = vala_collection_get_size ((ValaCollection*) _tmp21_);
			_tmp23_ = _tmp22_;
			_param_size = _tmp23_;
			_param_index = -1;
			while (TRUE) {
				gint _tmp24_;
				gint _tmp25_;
				gint _tmp26_;
				ValaParameter* param = NULL;
				ValaList* _tmp27_;
				gint _tmp28_;
				gpointer _tmp29_;
				gint _tmp30_;
				ValaParameter* _tmp31_;
				ValaDataType* _tmp32_;
				ValaDataType* _tmp33_;
				ValaParameter* _tmp34_;
				gboolean _tmp35_;
				_tmp24_ = _param_index;
				_param_index = _tmp24_ + 1;
				_tmp25_ = _param_index;
				_tmp26_ = _param_size;
				if (!(_tmp25_ < _tmp26_)) {
					break;
				}
				_tmp27_ = _param_list;
				_tmp28_ = _param_index;
				_tmp29_ = vala_list_get (_tmp27_, _tmp28_);
				param = (ValaParameter*) _tmp29_;
				_tmp30_ = index;
				index = _tmp30_ + 1;
				_tmp31_ = param;
				_tmp32_ = vala_variable_get_variable_type ((ValaVariable*) _tmp31_);
				_tmp33_ = _tmp32_;
				_tmp34_ = param;
				_tmp35_ = vala_ccode_base_module_get_ccode_array_length ((ValaCodeNode*) _tmp34_);
				vala_gir_writer_skip_implicit_params (self, _tmp33_, &index, _tmp35_);
				_vala_code_node_unref0 (param);
			}
			_vala_iterable_unref0 (_param_list);
		}
		_tmp36_ = ret_is_struct;
		if (_tmp36_) {
			gint _tmp37_;
			_tmp37_ = index;
			index = _tmp37_ + 1;
		} else {
			ValaDataType* _tmp38_;
			gboolean _tmp39_;
			gboolean _tmp40_ = FALSE;
			ValaDataType* _tmp41_;
			_tmp38_ = return_type;
			_tmp39_ = return_array_length;
			vala_gir_writer_skip_implicit_params (self, _tmp38_, &index, _tmp39_);
			_tmp41_ = return_type;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp41_, VALA_TYPE_ARRAY_TYPE)) {
				gboolean _tmp42_;
				_tmp42_ = return_array_length;
				_tmp40_ = _tmp42_;
			} else {
				_tmp40_ = FALSE;
			}
			if (_tmp40_) {
				gint _tmp43_;
				ValaDataType* _tmp44_;
				gint _tmp45_;
				gint _tmp46_;
				_tmp43_ = index;
				_tmp44_ = return_type;
				_tmp45_ = vala_array_type_get_rank (G_TYPE_CHECK_INSTANCE_CAST (_tmp44_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
				_tmp46_ = _tmp45_;
				index = _tmp43_ - (_tmp46_ - 1);
			}
		}
		_tmp47_ = index;
		last_index = _tmp47_ - 1;
	}
	_tmp49_ = return_type;
	if (_tmp49_ != NULL) {
		gboolean _tmp50_;
		_tmp50_ = ret_is_struct;
		_tmp48_ = !_tmp50_;
	} else {
		_tmp48_ = FALSE;
	}
	if (_tmp48_) {
		ValaDataType* _tmp51_;
		gboolean _tmp52_;
		const gchar* _tmp53_;
		gboolean _tmp54_;
		_tmp51_ = return_type;
		_tmp52_ = return_array_length;
		_tmp53_ = return_comment;
		_tmp54_ = constructor;
		vala_gir_writer_write_param_or_return (self, _tmp51_, FALSE, &last_index, _tmp52_, NULL, _tmp53_, VALA_PARAMETER_DIRECTION_IN, _tmp54_, FALSE);
	} else {
		gboolean _tmp55_;
		_tmp55_ = ret_is_struct;
		if (_tmp55_) {
			ValaVoidType* _tmp56_;
			ValaVoidType* _tmp57_;
			const gchar* _tmp58_;
			_tmp56_ = vala_void_type_new (NULL);
			_tmp57_ = _tmp56_;
			_tmp58_ = return_comment;
			vala_gir_writer_write_param_or_return (self, (ValaDataType*) _tmp57_, FALSE, &last_index, FALSE, NULL, _tmp58_, VALA_PARAMETER_DIRECTION_IN, FALSE, FALSE);
			_vala_code_node_unref0 (_tmp57_);
		}
	}
	_tmp63_ = params;
	_tmp64_ = vala_collection_get_size ((ValaCollection*) _tmp63_);
	_tmp65_ = _tmp64_;
	if (_tmp65_ != 0) {
		_tmp62_ = TRUE;
	} else {
		ValaDataType* _tmp66_;
		_tmp66_ = instance_type;
		_tmp62_ = _tmp66_ != NULL;
	}
	if (_tmp62_) {
		_tmp61_ = TRUE;
	} else {
		gboolean _tmp67_ = FALSE;
		ValaDataType* _tmp68_;
		_tmp68_ = return_type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp68_, VALA_TYPE_ARRAY_TYPE)) {
			gboolean _tmp69_;
			_tmp69_ = return_array_length;
			_tmp67_ = _tmp69_;
		} else {
			_tmp67_ = FALSE;
		}
		_tmp61_ = _tmp67_;
	}
	if (_tmp61_) {
		_tmp60_ = TRUE;
	} else {
		ValaDataType* _tmp70_;
		_tmp70_ = return_type;
		_tmp60_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp70_, VALA_TYPE_DELEGATE_TYPE);
	}
	if (_tmp60_) {
		_tmp59_ = TRUE;
	} else {
		gboolean _tmp71_;
		_tmp71_ = ret_is_struct;
		_tmp59_ = _tmp71_;
	}
	if (_tmp59_) {
		GString* _tmp72_;
		gint _tmp73_;
		gint index = 0;
		ValaDataType* _tmp74_;
		gboolean _tmp112_;
		gboolean _tmp118_;
		gint _tmp125_;
		GString* _tmp126_;
		vala_gir_writer_write_indent (self);
		_tmp72_ = self->priv->buffer;
		g_string_append_printf (_tmp72_, "<parameters>\n");
		_tmp73_ = self->priv->indent;
		self->priv->indent = _tmp73_ + 1;
		index = 0;
		_tmp74_ = instance_type;
		if (_tmp74_ != NULL) {
			ValaDataType* _tmp75_;
			_tmp75_ = instance_type;
			vala_gir_writer_write_param_or_return (self, _tmp75_, TRUE, &index, FALSE, "self", NULL, VALA_PARAMETER_DIRECTION_IN, FALSE, FALSE);
		}
		{
			ValaList* _param_list = NULL;
			ValaList* _tmp76_;
			ValaList* _tmp77_;
			gint _param_size = 0;
			ValaList* _tmp78_;
			gint _tmp79_;
			gint _tmp80_;
			gint _param_index = 0;
			_tmp76_ = params;
			_tmp77_ = _vala_iterable_ref0 (_tmp76_);
			_param_list = _tmp77_;
			_tmp78_ = _param_list;
			_tmp79_ = vala_collection_get_size ((ValaCollection*) _tmp78_);
			_tmp80_ = _tmp79_;
			_param_size = _tmp80_;
			_param_index = -1;
			while (TRUE) {
				gint _tmp81_;
				gint _tmp82_;
				gint _tmp83_;
				ValaParameter* param = NULL;
				ValaList* _tmp84_;
				gint _tmp85_;
				gpointer _tmp86_;
				ValaParameter* _tmp87_;
				ValaDataType* _tmp88_;
				ValaDataType* _tmp89_;
				ValaParameter* _tmp90_;
				gboolean _tmp91_;
				ValaParameter* _tmp92_;
				const gchar* _tmp93_;
				const gchar* _tmp94_;
				ValaParameter* _tmp95_;
				gchar* _tmp96_;
				gchar* _tmp97_;
				ValaParameter* _tmp98_;
				ValaParameterDirection _tmp99_;
				ValaParameterDirection _tmp100_;
				ValaParameter* _tmp101_;
				ValaDataType* _tmp102_;
				ValaDataType* _tmp103_;
				ValaParameter* _tmp104_;
				gboolean _tmp105_;
				ValaParameter* _tmp106_;
				const gchar* _tmp107_;
				const gchar* _tmp108_;
				ValaParameter* _tmp109_;
				ValaParameterDirection _tmp110_;
				ValaParameterDirection _tmp111_;
				_tmp81_ = _param_index;
				_param_index = _tmp81_ + 1;
				_tmp82_ = _param_index;
				_tmp83_ = _param_size;
				if (!(_tmp82_ < _tmp83_)) {
					break;
				}
				_tmp84_ = _param_list;
				_tmp85_ = _param_index;
				_tmp86_ = vala_list_get (_tmp84_, _tmp85_);
				param = (ValaParameter*) _tmp86_;
				_tmp87_ = param;
				_tmp88_ = vala_variable_get_variable_type ((ValaVariable*) _tmp87_);
				_tmp89_ = _tmp88_;
				_tmp90_ = param;
				_tmp91_ = vala_ccode_base_module_get_ccode_array_length ((ValaCodeNode*) _tmp90_);
				_tmp92_ = param;
				_tmp93_ = vala_symbol_get_name ((ValaSymbol*) _tmp92_);
				_tmp94_ = _tmp93_;
				_tmp95_ = param;
				_tmp96_ = vala_gir_writer_get_parameter_comment (self, _tmp95_);
				_tmp97_ = _tmp96_;
				_tmp98_ = param;
				_tmp99_ = vala_parameter_get_direction (_tmp98_);
				_tmp100_ = _tmp99_;
				vala_gir_writer_write_param_or_return (self, _tmp89_, TRUE, &index, _tmp91_, _tmp94_, _tmp97_, _tmp100_, FALSE, FALSE);
				_g_free0 (_tmp97_);
				_tmp101_ = param;
				_tmp102_ = vala_variable_get_variable_type ((ValaVariable*) _tmp101_);
				_tmp103_ = _tmp102_;
				_tmp104_ = param;
				_tmp105_ = vala_ccode_base_module_get_ccode_array_length ((ValaCodeNode*) _tmp104_);
				_tmp106_ = param;
				_tmp107_ = vala_symbol_get_name ((ValaSymbol*) _tmp106_);
				_tmp108_ = _tmp107_;
				_tmp109_ = param;
				_tmp110_ = vala_parameter_get_direction (_tmp109_);
				_tmp111_ = _tmp110_;
				vala_gir_writer_write_implicit_params (self, _tmp103_, &index, _tmp105_, _tmp108_, _tmp111_);
				_vala_code_node_unref0 (param);
			}
			_vala_iterable_unref0 (_param_list);
		}
		_tmp112_ = ret_is_struct;
		if (_tmp112_) {
			ValaDataType* _tmp113_;
			const gchar* _tmp114_;
			gboolean _tmp115_;
			_tmp113_ = return_type;
			_tmp114_ = return_comment;
			_tmp115_ = constructor;
			vala_gir_writer_write_param_or_return (self, _tmp113_, TRUE, &index, FALSE, "result", _tmp114_, VALA_PARAMETER_DIRECTION_OUT, _tmp115_, TRUE);
		} else {
			ValaDataType* _tmp116_;
			gboolean _tmp117_;
			_tmp116_ = return_type;
			_tmp117_ = return_array_length;
			vala_gir_writer_write_implicit_params (self, _tmp116_, &index, _tmp117_, "result", VALA_PARAMETER_DIRECTION_OUT);
		}
		_tmp118_ = user_data;
		if (_tmp118_) {
			GString* _tmp119_;
			gint _tmp120_;
			gint _tmp121_;
			GString* _tmp122_;
			gint _tmp123_;
			GString* _tmp124_;
			vala_gir_writer_write_indent (self);
			_tmp119_ = self->priv->buffer;
			_tmp120_ = index;
			g_string_append_printf (_tmp119_, "<parameter name=\"user_data\" transfer-ownership=\"none\" closure=\"%d" \
"\">\n", _tmp120_);
			_tmp121_ = self->priv->indent;
			self->priv->indent = _tmp121_ + 1;
			vala_gir_writer_write_indent (self);
			_tmp122_ = self->priv->buffer;
			g_string_append_printf (_tmp122_, "<type name=\"gpointer\" c:type=\"void*\"/>\n");
			_tmp123_ = self->priv->indent;
			self->priv->indent = _tmp123_ - 1;
			vala_gir_writer_write_indent (self);
			_tmp124_ = self->priv->buffer;
			g_string_append_printf (_tmp124_, "</parameter>\n");
		}
		_tmp125_ = self->priv->indent;
		self->priv->indent = _tmp125_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp126_ = self->priv->buffer;
		g_string_append_printf (_tmp126_, "</parameters>\n");
	}
}


static void vala_gir_writer_real_visit_delegate (ValaCodeVisitor* base, ValaDelegate* cb) {
	ValaGIRWriter * self;
	ValaDelegate* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaDelegate* _tmp3_;
	gboolean _tmp4_;
	GString* _tmp5_;
	ValaDelegate* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GString* _tmp9_;
	ValaDelegate* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	ValaDelegate* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	ValaDelegate* _tmp17_;
	GString* _tmp18_;
	gint _tmp19_;
	ValaDelegate* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	ValaDelegate* _tmp23_;
	ValaDelegate* _tmp24_;
	ValaList* _tmp25_;
	ValaList* _tmp26_;
	ValaDelegate* _tmp27_;
	ValaDataType* _tmp28_;
	ValaDataType* _tmp29_;
	ValaDelegate* _tmp30_;
	gboolean _tmp31_;
	ValaDelegate* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	ValaDelegate* _tmp35_;
	gboolean _tmp36_;
	gboolean _tmp37_;
	gint _tmp38_;
	GString* _tmp39_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (cb != NULL);
	_tmp0_ = cb;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = cb;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	vala_gir_writer_write_indent (self);
	_tmp5_ = self->priv->buffer;
	_tmp6_ = cb;
	_tmp7_ = vala_symbol_get_name ((ValaSymbol*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_string_append_printf (_tmp5_, "<callback name=\"%s\"", _tmp8_);
	_tmp9_ = self->priv->buffer;
	_tmp10_ = cb;
	_tmp11_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp10_);
	_tmp12_ = _tmp11_;
	g_string_append_printf (_tmp9_, " c:type=\"%s\"", _tmp12_);
	_g_free0 (_tmp12_);
	_tmp13_ = cb;
	_tmp14_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp13_);
	_tmp15_ = _tmp14_;
	if (_tmp15_) {
		GString* _tmp16_;
		_tmp16_ = self->priv->buffer;
		g_string_append_printf (_tmp16_, " throws=\"1\"");
	}
	_tmp17_ = cb;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp17_);
	_tmp18_ = self->priv->buffer;
	g_string_append_printf (_tmp18_, ">\n");
	_tmp19_ = self->priv->indent;
	self->priv->indent = _tmp19_ + 1;
	_tmp20_ = cb;
	_tmp21_ = vala_gir_writer_get_delegate_comment (self, _tmp20_);
	_tmp22_ = _tmp21_;
	vala_gir_writer_write_doc (self, _tmp22_);
	_g_free0 (_tmp22_);
	_tmp23_ = cb;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp23_);
	_tmp24_ = cb;
	_tmp25_ = vala_callable_get_parameters ((ValaCallable*) _tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = cb;
	_tmp28_ = vala_callable_get_return_type ((ValaCallable*) _tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = cb;
	_tmp31_ = vala_ccode_base_module_get_ccode_array_length ((ValaCodeNode*) _tmp30_);
	_tmp32_ = cb;
	_tmp33_ = vala_gir_writer_get_delegate_return_comment (self, _tmp32_);
	_tmp34_ = _tmp33_;
	_tmp35_ = cb;
	_tmp36_ = vala_delegate_get_has_target (_tmp35_);
	_tmp37_ = _tmp36_;
	vala_gir_writer_write_params_and_return (self, _tmp26_, _tmp29_, _tmp31_, _tmp34_, FALSE, NULL, _tmp37_);
	_g_free0 (_tmp34_);
	_vala_iterable_unref0 (_tmp26_);
	_tmp38_ = self->priv->indent;
	self->priv->indent = _tmp38_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp39_ = self->priv->buffer;
	g_string_append_printf (_tmp39_, "</callback>\n");
}


static void vala_gir_writer_real_visit_method (ValaCodeVisitor* base, ValaMethod* m) {
	ValaGIRWriter * self;
	ValaMethod* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	ValaMethod* _tmp5_;
	gboolean _tmp6_;
	ValaMethod* _tmp21_;
	gboolean _tmp22_;
	gchar* tag_name = NULL;
	gchar* _tmp23_;
	ValaSymbol* parent = NULL;
	ValaArrayList* _tmp24_;
	gpointer _tmp25_;
	ValaSymbol* _tmp26_;
	gboolean _tmp29_ = FALSE;
	gboolean _tmp30_ = FALSE;
	ValaSymbol* _tmp31_;
	ValaMethod* _tmp40_;
	const gchar* _tmp41_;
	gboolean _tmp42_ = FALSE;
	ValaMethod* _tmp43_;
	gboolean _tmp44_;
	gboolean _tmp45_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (m != NULL);
	_tmp0_ = m;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp5_ = m;
	_tmp6_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp5_);
	if (!_tmp6_) {
		_tmp4_ = TRUE;
	} else {
		ValaMethod* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = m;
		_tmp8_ = vala_method_get_overrides (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp4_ = _tmp9_;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		gboolean _tmp10_ = FALSE;
		gboolean _tmp11_ = FALSE;
		ValaMethod* _tmp12_;
		ValaMethod* _tmp13_;
		ValaMethod* _tmp14_;
		_tmp12_ = m;
		_tmp13_ = vala_method_get_base_interface_method (_tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp14_ != NULL) {
			ValaMethod* _tmp15_;
			gboolean _tmp16_;
			gboolean _tmp17_;
			_tmp15_ = m;
			_tmp16_ = vala_method_get_is_abstract (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp11_ = !_tmp17_;
		} else {
			_tmp11_ = FALSE;
		}
		if (_tmp11_) {
			ValaMethod* _tmp18_;
			gboolean _tmp19_;
			gboolean _tmp20_;
			_tmp18_ = m;
			_tmp19_ = vala_method_get_is_virtual (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp10_ = !_tmp20_;
		} else {
			_tmp10_ = FALSE;
		}
		_tmp3_ = _tmp10_;
	}
	if (_tmp3_) {
		return;
	}
	_tmp21_ = m;
	_tmp22_ = vala_gir_writer_check_signature (self, _tmp21_);
	if (!_tmp22_) {
		return;
	}
	_tmp23_ = g_strdup ("method");
	tag_name = _tmp23_;
	_tmp24_ = self->priv->hierarchy;
	_tmp25_ = vala_list_get ((ValaList*) _tmp24_, 0);
	parent = (ValaSymbol*) _tmp25_;
	_tmp26_ = parent;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp26_, VALA_TYPE_ENUM)) {
		ValaArrayList* _tmp27_;
		ValaMethod* _tmp28_;
		_tmp27_ = self->priv->deferred;
		_tmp28_ = m;
		vala_collection_add ((ValaCollection*) _tmp27_, (ValaCodeNode*) _tmp28_);
		_vala_code_node_unref0 (parent);
		_g_free0 (tag_name);
		return;
	}
	_tmp31_ = parent;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp31_, VALA_TYPE_NAMESPACE)) {
		_tmp30_ = TRUE;
	} else {
		ValaMethod* _tmp32_;
		ValaMemberBinding _tmp33_;
		ValaMemberBinding _tmp34_;
		_tmp32_ = m;
		_tmp33_ = vala_method_get_binding (_tmp32_);
		_tmp34_ = _tmp33_;
		_tmp30_ = _tmp34_ == VALA_MEMBER_BINDING_STATIC;
	}
	if (_tmp30_) {
		_tmp29_ = TRUE;
	} else {
		ValaSymbol* _tmp35_;
		ValaMethod* _tmp36_;
		ValaSymbol* _tmp37_;
		ValaSymbol* _tmp38_;
		_tmp35_ = parent;
		_tmp36_ = m;
		_tmp37_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp36_);
		_tmp38_ = _tmp37_;
		_tmp29_ = _tmp35_ != _tmp38_;
	}
	if (_tmp29_) {
		gchar* _tmp39_;
		_tmp39_ = g_strdup ("function");
		_g_free0 (tag_name);
		tag_name = _tmp39_;
	}
	_tmp40_ = m;
	_tmp41_ = tag_name;
	vala_gir_writer_write_signature (self, _tmp40_, _tmp41_, TRUE, FALSE);
	_tmp43_ = m;
	_tmp44_ = vala_method_get_is_abstract (_tmp43_);
	_tmp45_ = _tmp44_;
	if (_tmp45_) {
		_tmp42_ = TRUE;
	} else {
		ValaMethod* _tmp46_;
		gboolean _tmp47_;
		gboolean _tmp48_;
		_tmp46_ = m;
		_tmp47_ = vala_method_get_is_virtual (_tmp46_);
		_tmp48_ = _tmp47_;
		_tmp42_ = _tmp48_;
	}
	if (_tmp42_) {
		ValaMethod* _tmp49_;
		_tmp49_ = m;
		vala_gir_writer_write_signature (self, _tmp49_, "virtual-method", TRUE, FALSE);
	}
	_vala_code_node_unref0 (parent);
	_g_free0 (tag_name);
}


static gboolean vala_gir_writer_check_type (ValaGIRWriter* self, ValaDataType* type) {
	gboolean result = FALSE;
	ValaDataType* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (type != NULL, FALSE);
	_tmp0_ = type;
	_tmp1_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strcmp0 (_tmp2_, "va_list") == 0;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}


static gboolean vala_gir_writer_check_signature (ValaGIRWriter* self, ValaMethod* m) {
	gboolean result = FALSE;
	ValaMethod* _tmp0_;
	ValaDataType* _tmp1_;
	ValaDataType* _tmp2_;
	gboolean _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (m != NULL, FALSE);
	_tmp0_ = m;
	_tmp1_ = vala_callable_get_return_type ((ValaCallable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = vala_gir_writer_check_type (self, _tmp2_);
	if (!_tmp3_) {
		result = FALSE;
		return result;
	}
	{
		ValaList* _param_list = NULL;
		ValaMethod* _tmp4_;
		ValaList* _tmp5_;
		gint _param_size = 0;
		ValaList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _param_index = 0;
		_tmp4_ = m;
		_tmp5_ = vala_callable_get_parameters ((ValaCallable*) _tmp4_);
		_param_list = _tmp5_;
		_tmp6_ = _param_list;
		_tmp7_ = vala_collection_get_size ((ValaCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_param_size = _tmp8_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			ValaParameter* param = NULL;
			ValaList* _tmp12_;
			gint _tmp13_;
			gpointer _tmp14_;
			gboolean _tmp15_ = FALSE;
			ValaParameter* _tmp16_;
			ValaDataType* _tmp17_;
			ValaDataType* _tmp18_;
			_tmp9_ = _param_index;
			_param_index = _tmp9_ + 1;
			_tmp10_ = _param_index;
			_tmp11_ = _param_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _param_list;
			_tmp13_ = _param_index;
			_tmp14_ = vala_list_get (_tmp12_, _tmp13_);
			param = (ValaParameter*) _tmp14_;
			_tmp16_ = param;
			_tmp17_ = vala_variable_get_variable_type ((ValaVariable*) _tmp16_);
			_tmp18_ = _tmp17_;
			if (_tmp18_ == NULL) {
				_tmp15_ = TRUE;
			} else {
				ValaParameter* _tmp19_;
				ValaDataType* _tmp20_;
				ValaDataType* _tmp21_;
				gboolean _tmp22_;
				_tmp19_ = param;
				_tmp20_ = vala_variable_get_variable_type ((ValaVariable*) _tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = vala_gir_writer_check_type (self, _tmp21_);
				_tmp15_ = !_tmp22_;
			}
			if (_tmp15_) {
				result = FALSE;
				_vala_code_node_unref0 (param);
				_vala_iterable_unref0 (_param_list);
				return result;
			}
			_vala_code_node_unref0 (param);
		}
		_vala_iterable_unref0 (_param_list);
	}
	result = TRUE;
	return result;
}


static void vala_gir_writer_write_signature (ValaGIRWriter* self, ValaMethod* m, const gchar* tag_name, gboolean write_doc, gboolean instance) {
	ValaSymbol* parent = NULL;
	ValaArrayList* _tmp0_;
	gpointer _tmp1_;
	gchar* name = NULL;
	ValaMethod* _tmp2_;
	ValaSymbol* _tmp3_;
	ValaSymbol* _tmp4_;
	ValaSymbol* _tmp5_;
	ValaMethod* _tmp22_;
	gboolean _tmp23_;
	gboolean _tmp24_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (m != NULL);
	g_return_if_fail (tag_name != NULL);
	_tmp0_ = self->priv->hierarchy;
	_tmp1_ = vala_list_get ((ValaList*) _tmp0_, 0);
	parent = (ValaSymbol*) _tmp1_;
	_tmp2_ = m;
	_tmp3_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = parent;
	if (_tmp4_ != _tmp5_) {
		ValaMethod* _tmp6_;
		gchar* _tmp7_;
		gchar* parent_prefix = NULL;
		ValaSymbol* _tmp8_;
		gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gboolean _tmp12_;
		instance = FALSE;
		_tmp6_ = m;
		_tmp7_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp6_);
		_g_free0 (name);
		name = _tmp7_;
		_tmp8_ = parent;
		_tmp9_ = vala_ccode_base_module_get_ccode_lower_case_prefix (_tmp8_);
		parent_prefix = _tmp9_;
		_tmp10_ = name;
		_tmp11_ = parent_prefix;
		_tmp12_ = g_str_has_prefix (_tmp10_, _tmp11_);
		if (_tmp12_) {
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			gint _tmp15_;
			gint _tmp16_;
			gchar* _tmp17_;
			_tmp13_ = name;
			_tmp14_ = parent_prefix;
			_tmp15_ = strlen (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = string_substring (_tmp13_, (glong) _tmp16_, (glong) -1);
			_g_free0 (name);
			name = _tmp17_;
		}
		_g_free0 (parent_prefix);
	} else {
		ValaMethod* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		_tmp18_ = m;
		_tmp19_ = vala_symbol_get_name ((ValaSymbol*) _tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = g_strdup (_tmp20_);
		_g_free0 (name);
		name = _tmp21_;
	}
	_tmp22_ = m;
	_tmp23_ = vala_method_get_coroutine (_tmp22_);
	_tmp24_ = _tmp23_;
	if (_tmp24_) {
		gchar* finish_name = NULL;
		const gchar* _tmp25_;
		gchar* _tmp26_;
		const gchar* _tmp27_;
		gboolean _tmp28_;
		const gchar* _tmp36_;
		gchar* _tmp37_;
		ValaMethod* _tmp38_;
		const gchar* _tmp39_;
		gboolean _tmp40_;
		const gchar* _tmp41_;
		ValaMethod* _tmp42_;
		gchar* _tmp43_;
		gchar* _tmp44_;
		ValaMethod* _tmp45_;
		ValaList* _tmp46_;
		ValaList* _tmp47_;
		ValaVoidType* _tmp48_;
		ValaVoidType* _tmp49_;
		ValaMethod* _tmp50_;
		const gchar* _tmp51_;
		gboolean _tmp52_;
		const gchar* _tmp53_;
		ValaMethod* _tmp54_;
		gchar* _tmp55_;
		gchar* _tmp56_;
		ValaMethod* _tmp57_;
		ValaList* _tmp58_;
		ValaList* _tmp59_;
		ValaMethod* _tmp60_;
		ValaDataType* _tmp61_;
		ValaDataType* _tmp62_;
		ValaMethod* _tmp63_;
		gboolean _tmp64_;
		gboolean _tmp65_;
		_tmp25_ = name;
		_tmp26_ = g_strdup (_tmp25_);
		finish_name = _tmp26_;
		_tmp27_ = finish_name;
		_tmp28_ = g_str_has_suffix (_tmp27_, "_async");
		if (_tmp28_) {
			const gchar* _tmp29_;
			const gchar* _tmp30_;
			gint _tmp31_;
			gint _tmp32_;
			gint _tmp33_;
			gint _tmp34_;
			gchar* _tmp35_;
			_tmp29_ = finish_name;
			_tmp30_ = finish_name;
			_tmp31_ = strlen (_tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = strlen ("_async");
			_tmp34_ = _tmp33_;
			_tmp35_ = string_substring (_tmp29_, (glong) 0, (glong) (_tmp32_ - _tmp34_));
			_g_free0 (finish_name);
			finish_name = _tmp35_;
		}
		_tmp36_ = finish_name;
		_tmp37_ = g_strconcat (_tmp36_, "_finish", NULL);
		_g_free0 (finish_name);
		finish_name = _tmp37_;
		_tmp38_ = m;
		_tmp39_ = tag_name;
		_tmp40_ = instance;
		_tmp41_ = name;
		_tmp42_ = m;
		_tmp43_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp42_);
		_tmp44_ = _tmp43_;
		_tmp45_ = m;
		_tmp46_ = vala_method_get_async_begin_parameters (_tmp45_);
		_tmp47_ = _tmp46_;
		_tmp48_ = vala_void_type_new (NULL);
		_tmp49_ = _tmp48_;
		vala_gir_writer_do_write_signature (self, _tmp38_, _tmp39_, _tmp40_, _tmp41_, _tmp44_, _tmp47_, (ValaDataType*) _tmp49_, FALSE, TRUE);
		_vala_code_node_unref0 (_tmp49_);
		_vala_iterable_unref0 (_tmp47_);
		_g_free0 (_tmp44_);
		_tmp50_ = m;
		_tmp51_ = tag_name;
		_tmp52_ = instance;
		_tmp53_ = finish_name;
		_tmp54_ = m;
		_tmp55_ = vala_ccode_base_module_get_ccode_finish_name (_tmp54_);
		_tmp56_ = _tmp55_;
		_tmp57_ = m;
		_tmp58_ = vala_method_get_async_end_parameters (_tmp57_);
		_tmp59_ = _tmp58_;
		_tmp60_ = m;
		_tmp61_ = vala_callable_get_return_type ((ValaCallable*) _tmp60_);
		_tmp62_ = _tmp61_;
		_tmp63_ = m;
		_tmp64_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp63_);
		_tmp65_ = _tmp64_;
		vala_gir_writer_do_write_signature (self, _tmp50_, _tmp51_, _tmp52_, _tmp53_, _tmp56_, _tmp59_, _tmp62_, _tmp65_, FALSE);
		_vala_iterable_unref0 (_tmp59_);
		_g_free0 (_tmp56_);
		_g_free0 (finish_name);
	} else {
		ValaMethod* _tmp66_;
		const gchar* _tmp67_;
		gboolean _tmp68_;
		const gchar* _tmp69_;
		ValaMethod* _tmp70_;
		gchar* _tmp71_;
		gchar* _tmp72_;
		ValaMethod* _tmp73_;
		ValaList* _tmp74_;
		ValaList* _tmp75_;
		ValaMethod* _tmp76_;
		ValaDataType* _tmp77_;
		ValaDataType* _tmp78_;
		ValaMethod* _tmp79_;
		gboolean _tmp80_;
		gboolean _tmp81_;
		_tmp66_ = m;
		_tmp67_ = tag_name;
		_tmp68_ = instance;
		_tmp69_ = name;
		_tmp70_ = m;
		_tmp71_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp70_);
		_tmp72_ = _tmp71_;
		_tmp73_ = m;
		_tmp74_ = vala_callable_get_parameters ((ValaCallable*) _tmp73_);
		_tmp75_ = _tmp74_;
		_tmp76_ = m;
		_tmp77_ = vala_callable_get_return_type ((ValaCallable*) _tmp76_);
		_tmp78_ = _tmp77_;
		_tmp79_ = m;
		_tmp80_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp79_);
		_tmp81_ = _tmp80_;
		vala_gir_writer_do_write_signature (self, _tmp66_, _tmp67_, _tmp68_, _tmp69_, _tmp72_, _tmp75_, _tmp78_, _tmp81_, TRUE);
		_vala_iterable_unref0 (_tmp75_);
		_g_free0 (_tmp72_);
	}
	_g_free0 (name);
	_vala_code_node_unref0 (parent);
}


static void vala_gir_writer_do_write_signature (ValaGIRWriter* self, ValaMethod* m, const gchar* tag_name, gboolean instance, const gchar* name, const gchar* cname, ValaList* params, ValaDataType* return_type, gboolean can_fail, gboolean write_comment) {
	GString* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp11_;
	ValaMethod* _tmp13_;
	GString* _tmp14_;
	gint _tmp15_;
	gchar* return_comment = NULL;
	gboolean _tmp16_;
	ValaMethod* _tmp22_;
	ValaDataType* instance_type = NULL;
	gboolean _tmp23_;
	ValaList* _tmp28_;
	ValaDataType* _tmp29_;
	ValaMethod* _tmp30_;
	gboolean _tmp31_;
	const gchar* _tmp32_;
	ValaDataType* _tmp33_;
	gint _tmp34_;
	GString* _tmp35_;
	const gchar* _tmp36_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (m != NULL);
	g_return_if_fail (tag_name != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (cname != NULL);
	g_return_if_fail (params != NULL);
	g_return_if_fail (return_type != NULL);
	vala_gir_writer_write_indent (self);
	_tmp0_ = self->priv->buffer;
	_tmp1_ = tag_name;
	_tmp2_ = name;
	g_string_append_printf (_tmp0_, "<%s name=\"%s\"", _tmp1_, _tmp2_);
	_tmp3_ = tag_name;
	if (g_strcmp0 (_tmp3_, "virtual-method") == 0) {
		GString* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = self->priv->buffer;
		_tmp5_ = name;
		g_string_append_printf (_tmp4_, " invoker=\"%s\"", _tmp5_);
	} else {
		const gchar* _tmp6_;
		_tmp6_ = tag_name;
		if (g_strcmp0 (_tmp6_, "callback") == 0) {
			GString* _tmp7_;
			const gchar* _tmp8_;
			_tmp7_ = self->priv->buffer;
			_tmp8_ = name;
			g_string_append_printf (_tmp7_, " c:type=\"%s\"", _tmp8_);
		} else {
			GString* _tmp9_;
			const gchar* _tmp10_;
			_tmp9_ = self->priv->buffer;
			_tmp10_ = cname;
			g_string_append_printf (_tmp9_, " c:identifier=\"%s\"", _tmp10_);
		}
	}
	_tmp11_ = can_fail;
	if (_tmp11_) {
		GString* _tmp12_;
		_tmp12_ = self->priv->buffer;
		g_string_append_printf (_tmp12_, " throws=\"1\"");
	}
	_tmp13_ = m;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp13_);
	_tmp14_ = self->priv->buffer;
	g_string_append_printf (_tmp14_, ">\n");
	_tmp15_ = self->priv->indent;
	self->priv->indent = _tmp15_ + 1;
	return_comment = NULL;
	_tmp16_ = write_comment;
	if (_tmp16_) {
		ValaMethod* _tmp17_;
		gchar* _tmp18_;
		ValaMethod* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		_tmp17_ = m;
		_tmp18_ = vala_gir_writer_get_method_return_comment (self, _tmp17_);
		_g_free0 (return_comment);
		return_comment = _tmp18_;
		_tmp19_ = m;
		_tmp20_ = vala_gir_writer_get_method_comment (self, _tmp19_);
		_tmp21_ = _tmp20_;
		vala_gir_writer_write_doc (self, _tmp21_);
		_g_free0 (_tmp21_);
	}
	_tmp22_ = m;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp22_);
	instance_type = NULL;
	_tmp23_ = instance;
	if (_tmp23_) {
		ValaMethod* _tmp24_;
		ValaSymbol* _tmp25_;
		ValaSymbol* _tmp26_;
		ValaDataType* _tmp27_;
		_tmp24_ = m;
		_tmp25_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = vala_ccode_base_module_get_data_type_for_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol));
		_vala_code_node_unref0 (instance_type);
		instance_type = _tmp27_;
	}
	_tmp28_ = params;
	_tmp29_ = return_type;
	_tmp30_ = m;
	_tmp31_ = vala_ccode_base_module_get_ccode_array_length ((ValaCodeNode*) _tmp30_);
	_tmp32_ = return_comment;
	_tmp33_ = instance_type;
	vala_gir_writer_write_params_and_return (self, _tmp28_, _tmp29_, _tmp31_, _tmp32_, FALSE, _tmp33_, FALSE);
	_tmp34_ = self->priv->indent;
	self->priv->indent = _tmp34_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp35_ = self->priv->buffer;
	_tmp36_ = tag_name;
	g_string_append_printf (_tmp35_, "</%s>\n", _tmp36_);
	_vala_code_node_unref0 (instance_type);
	_g_free0 (return_comment);
}


static void vala_gir_writer_real_visit_creation_method (ValaCodeVisitor* base, ValaCreationMethod* m) {
	ValaGIRWriter * self;
	ValaCreationMethod* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ValaCreationMethod* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_ = FALSE;
	ValaCreationMethod* _tmp6_;
	ValaSymbol* _tmp7_;
	ValaSymbol* _tmp8_;
	gboolean is_struct = FALSE;
	ValaCreationMethod* _tmp14_;
	ValaSymbol* _tmp15_;
	ValaSymbol* _tmp16_;
	const gchar* _tmp17_ = NULL;
	gboolean _tmp18_;
	gchar* tag_name = NULL;
	gchar* _tmp19_;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	ValaCreationMethod* _tmp22_;
	ValaSymbol* _tmp23_;
	ValaSymbol* _tmp24_;
	ValaCreationMethod* _tmp58_;
	gboolean _tmp59_;
	gboolean _tmp60_;
	GString* _tmp62_;
	gint _tmp63_;
	ValaCreationMethod* _tmp64_;
	gchar* _tmp65_;
	gchar* _tmp66_;
	ValaCreationMethod* _tmp67_;
	ValaDataType* datatype = NULL;
	ValaCreationMethod* _tmp68_;
	ValaSymbol* _tmp69_;
	ValaSymbol* _tmp70_;
	ValaDataType* _tmp71_;
	ValaCreationMethod* _tmp72_;
	ValaList* _tmp73_;
	ValaList* _tmp74_;
	ValaDataType* _tmp75_;
	ValaCreationMethod* _tmp76_;
	gchar* _tmp77_;
	gchar* _tmp78_;
	gint _tmp79_;
	GString* _tmp80_;
	const gchar* _tmp81_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (m != NULL);
	_tmp0_ = m;
	_tmp1_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		return;
	}
	_tmp3_ = m;
	_tmp4_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp3_);
	if (!_tmp4_) {
		return;
	}
	_tmp6_ = m;
	_tmp7_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp6_);
	_tmp8_ = _tmp7_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, VALA_TYPE_CLASS)) {
		ValaCreationMethod* _tmp9_;
		ValaSymbol* _tmp10_;
		ValaSymbol* _tmp11_;
		gboolean _tmp12_;
		gboolean _tmp13_;
		_tmp9_ = m;
		_tmp10_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = vala_class_get_is_abstract (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, VALA_TYPE_CLASS, ValaClass));
		_tmp13_ = _tmp12_;
		_tmp5_ = _tmp13_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		return;
	}
	vala_gir_writer_write_indent (self);
	_tmp14_ = m;
	_tmp15_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp14_);
	_tmp16_ = _tmp15_;
	is_struct = G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, VALA_TYPE_STRUCT);
	_tmp18_ = is_struct;
	if (_tmp18_) {
		_tmp17_ = "function";
	} else {
		_tmp17_ = "constructor";
	}
	_tmp19_ = g_strdup (_tmp17_);
	tag_name = _tmp19_;
	_tmp22_ = m;
	_tmp23_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp22_);
	_tmp24_ = _tmp23_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, VALA_TYPE_CLASS)) {
		ValaCreationMethod* _tmp25_;
		ValaCreationMethod* _tmp26_;
		ValaSymbol* _tmp27_;
		ValaSymbol* _tmp28_;
		ValaCreationMethod* _tmp29_;
		ValaCreationMethod* _tmp30_;
		_tmp25_ = m;
		_tmp26_ = m;
		_tmp27_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = vala_class_get_default_construction_method (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, VALA_TYPE_CLASS, ValaClass));
		_tmp30_ = _tmp29_;
		_tmp21_ = _tmp25_ == _tmp30_;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		_tmp20_ = TRUE;
	} else {
		gboolean _tmp31_ = FALSE;
		ValaCreationMethod* _tmp32_;
		ValaSymbol* _tmp33_;
		ValaSymbol* _tmp34_;
		_tmp32_ = m;
		_tmp33_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp32_);
		_tmp34_ = _tmp33_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp34_, VALA_TYPE_STRUCT)) {
			ValaCreationMethod* _tmp35_;
			ValaCreationMethod* _tmp36_;
			ValaSymbol* _tmp37_;
			ValaSymbol* _tmp38_;
			ValaMethod* _tmp39_;
			ValaMethod* _tmp40_;
			_tmp35_ = m;
			_tmp36_ = m;
			_tmp37_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp36_);
			_tmp38_ = _tmp37_;
			_tmp39_ = vala_struct_get_default_construction_method (G_TYPE_CHECK_INSTANCE_CAST (_tmp38_, VALA_TYPE_STRUCT, ValaStruct));
			_tmp40_ = _tmp39_;
			_tmp31_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, VALA_TYPE_METHOD, ValaMethod) == _tmp40_;
		} else {
			_tmp31_ = FALSE;
		}
		_tmp20_ = _tmp31_;
	}
	if (_tmp20_) {
		const gchar* _tmp41_ = NULL;
		gboolean _tmp42_;
		gchar* m_name = NULL;
		gchar* _tmp43_;
		GString* _tmp44_;
		const gchar* _tmp45_;
		const gchar* _tmp46_;
		ValaCreationMethod* _tmp47_;
		gchar* _tmp48_;
		gchar* _tmp49_;
		_tmp42_ = is_struct;
		if (_tmp42_) {
			_tmp41_ = "init";
		} else {
			_tmp41_ = "new";
		}
		_tmp43_ = g_strdup (_tmp41_);
		m_name = _tmp43_;
		_tmp44_ = self->priv->buffer;
		_tmp45_ = tag_name;
		_tmp46_ = m_name;
		_tmp47_ = m;
		_tmp48_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp47_);
		_tmp49_ = _tmp48_;
		g_string_append_printf (_tmp44_, "<%s name=\"%s\" c:identifier=\"%s\"", _tmp45_, _tmp46_, _tmp49_);
		_g_free0 (_tmp49_);
		_g_free0 (m_name);
	} else {
		GString* _tmp50_;
		const gchar* _tmp51_;
		ValaCreationMethod* _tmp52_;
		const gchar* _tmp53_;
		const gchar* _tmp54_;
		ValaCreationMethod* _tmp55_;
		gchar* _tmp56_;
		gchar* _tmp57_;
		_tmp50_ = self->priv->buffer;
		_tmp51_ = tag_name;
		_tmp52_ = m;
		_tmp53_ = vala_symbol_get_name ((ValaSymbol*) _tmp52_);
		_tmp54_ = _tmp53_;
		_tmp55_ = m;
		_tmp56_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp55_);
		_tmp57_ = _tmp56_;
		g_string_append_printf (_tmp50_, "<%s name=\"%s\" c:identifier=\"%s\"", _tmp51_, _tmp54_, _tmp57_);
		_g_free0 (_tmp57_);
	}
	_tmp58_ = m;
	_tmp59_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp58_);
	_tmp60_ = _tmp59_;
	if (_tmp60_) {
		GString* _tmp61_;
		_tmp61_ = self->priv->buffer;
		g_string_append_printf (_tmp61_, " throws=\"1\"");
	}
	_tmp62_ = self->priv->buffer;
	g_string_append_printf (_tmp62_, ">\n");
	_tmp63_ = self->priv->indent;
	self->priv->indent = _tmp63_ + 1;
	_tmp64_ = m;
	_tmp65_ = vala_gir_writer_get_method_comment (self, (ValaMethod*) _tmp64_);
	_tmp66_ = _tmp65_;
	vala_gir_writer_write_doc (self, _tmp66_);
	_g_free0 (_tmp66_);
	_tmp67_ = m;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp67_);
	_tmp68_ = m;
	_tmp69_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp68_);
	_tmp70_ = _tmp69_;
	_tmp71_ = vala_ccode_base_module_get_data_type_for_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp70_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol));
	datatype = _tmp71_;
	_tmp72_ = m;
	_tmp73_ = vala_callable_get_parameters ((ValaCallable*) _tmp72_);
	_tmp74_ = _tmp73_;
	_tmp75_ = datatype;
	_tmp76_ = m;
	_tmp77_ = vala_gir_writer_get_method_return_comment (self, (ValaMethod*) _tmp76_);
	_tmp78_ = _tmp77_;
	vala_gir_writer_write_params_and_return (self, _tmp74_, _tmp75_, FALSE, _tmp78_, TRUE, NULL, FALSE);
	_g_free0 (_tmp78_);
	_vala_iterable_unref0 (_tmp74_);
	_tmp79_ = self->priv->indent;
	self->priv->indent = _tmp79_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp80_ = self->priv->buffer;
	_tmp81_ = tag_name;
	g_string_append_printf (_tmp80_, "</%s>\n", _tmp81_);
	_vala_code_node_unref0 (datatype);
	_g_free0 (tag_name);
}


static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
	gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = old;
		_tmp1_ = (*((gchar*) _tmp2_)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = old;
		_tmp4_ = replacement;
		_tmp0_ = g_strcmp0 (_tmp3_, _tmp4_) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup (self);
		result = _tmp5_;
		return result;
	}
	{
		GRegex* regex = NULL;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		GRegex* _tmp9_;
		GRegex* _tmp10_;
		gchar* _tmp11_ = NULL;
		GRegex* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		_tmp6_ = old;
		_tmp7_ = g_regex_escape_string (_tmp6_, -1);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_regex_new (_tmp8_, 0, 0, &_inner_error_);
		_tmp10_ = _tmp9_;
		_g_free0 (_tmp8_);
		regex = _tmp10_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch6_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp12_ = regex;
		_tmp13_ = replacement;
		_tmp14_ = g_regex_replace_literal (_tmp12_, self, (gssize) -1, 0, _tmp13_, 0, &_inner_error_);
		_tmp11_ = _tmp14_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch6_g_regex_error;
			}
			_g_regex_unref0 (regex);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp15_ = _tmp11_;
		_tmp11_ = NULL;
		result = _tmp15_;
		_g_free0 (_tmp11_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally6;
	__catch6_g_regex_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally6:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
}


static void vala_gir_writer_real_visit_property (ValaCodeVisitor* base, ValaProperty* prop) {
	ValaGIRWriter * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ValaProperty* _tmp2_;
	gboolean _tmp3_;
	GString* _tmp18_;
	ValaProperty* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	ValaProperty* _tmp24_;
	ValaPropertyAccessor* _tmp25_;
	ValaPropertyAccessor* _tmp26_;
	ValaProperty* _tmp28_;
	ValaPropertyAccessor* _tmp29_;
	ValaPropertyAccessor* _tmp30_;
	ValaProperty* _tmp44_;
	GString* _tmp45_;
	gint _tmp46_;
	ValaProperty* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	ValaProperty* _tmp50_;
	ValaProperty* _tmp51_;
	ValaDataType* _tmp52_;
	ValaDataType* _tmp53_;
	gint _tmp54_;
	GString* _tmp55_;
	ValaProperty* _tmp56_;
	ValaPropertyAccessor* _tmp57_;
	ValaPropertyAccessor* _tmp58_;
	ValaProperty* _tmp65_;
	ValaPropertyAccessor* _tmp66_;
	ValaPropertyAccessor* _tmp67_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (prop != NULL);
	_tmp2_ = prop;
	_tmp3_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp2_);
	if (!_tmp3_) {
		_tmp1_ = TRUE;
	} else {
		ValaProperty* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = prop;
		_tmp5_ = vala_property_get_overrides (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp1_ = _tmp6_;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		ValaProperty* _tmp9_;
		ValaProperty* _tmp10_;
		ValaProperty* _tmp11_;
		_tmp9_ = prop;
		_tmp10_ = vala_property_get_base_interface_property (_tmp9_);
		_tmp11_ = _tmp10_;
		if (_tmp11_ != NULL) {
			ValaProperty* _tmp12_;
			gboolean _tmp13_;
			gboolean _tmp14_;
			_tmp12_ = prop;
			_tmp13_ = vala_property_get_is_abstract (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp8_ = !_tmp14_;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			ValaProperty* _tmp15_;
			gboolean _tmp16_;
			gboolean _tmp17_;
			_tmp15_ = prop;
			_tmp16_ = vala_property_get_is_virtual (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp7_ = !_tmp17_;
		} else {
			_tmp7_ = FALSE;
		}
		_tmp0_ = _tmp7_;
	}
	if (_tmp0_) {
		return;
	}
	vala_gir_writer_write_indent (self);
	_tmp18_ = self->priv->buffer;
	_tmp19_ = prop;
	_tmp20_ = vala_symbol_get_name ((ValaSymbol*) _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = string_replace (_tmp21_, "_", "-");
	_tmp23_ = _tmp22_;
	g_string_append_printf (_tmp18_, "<property name=\"%s\"", _tmp23_);
	_g_free0 (_tmp23_);
	_tmp24_ = prop;
	_tmp25_ = vala_property_get_get_accessor (_tmp24_);
	_tmp26_ = _tmp25_;
	if (_tmp26_ == NULL) {
		GString* _tmp27_;
		_tmp27_ = self->priv->buffer;
		g_string_append_printf (_tmp27_, " readable=\"0\"");
	}
	_tmp28_ = prop;
	_tmp29_ = vala_property_get_set_accessor (_tmp28_);
	_tmp30_ = _tmp29_;
	if (_tmp30_ != NULL) {
		GString* _tmp31_;
		ValaProperty* _tmp32_;
		ValaPropertyAccessor* _tmp33_;
		ValaPropertyAccessor* _tmp34_;
		gboolean _tmp35_;
		gboolean _tmp36_;
		_tmp31_ = self->priv->buffer;
		g_string_append_printf (_tmp31_, " writable=\"1\"");
		_tmp32_ = prop;
		_tmp33_ = vala_property_get_set_accessor (_tmp32_);
		_tmp34_ = _tmp33_;
		_tmp35_ = vala_property_accessor_get_construction (_tmp34_);
		_tmp36_ = _tmp35_;
		if (_tmp36_) {
			ValaProperty* _tmp37_;
			ValaPropertyAccessor* _tmp38_;
			ValaPropertyAccessor* _tmp39_;
			gboolean _tmp40_;
			gboolean _tmp41_;
			_tmp37_ = prop;
			_tmp38_ = vala_property_get_set_accessor (_tmp37_);
			_tmp39_ = _tmp38_;
			_tmp40_ = vala_property_accessor_get_writable (_tmp39_);
			_tmp41_ = _tmp40_;
			if (!_tmp41_) {
				GString* _tmp42_;
				_tmp42_ = self->priv->buffer;
				g_string_append_printf (_tmp42_, " construct-only=\"1\"");
			} else {
				GString* _tmp43_;
				_tmp43_ = self->priv->buffer;
				g_string_append_printf (_tmp43_, " construct=\"1\"");
			}
		}
	}
	_tmp44_ = prop;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp44_);
	_tmp45_ = self->priv->buffer;
	g_string_append_printf (_tmp45_, ">\n");
	_tmp46_ = self->priv->indent;
	self->priv->indent = _tmp46_ + 1;
	_tmp47_ = prop;
	_tmp48_ = vala_gir_writer_get_property_comment (self, _tmp47_);
	_tmp49_ = _tmp48_;
	vala_gir_writer_write_doc (self, _tmp49_);
	_g_free0 (_tmp49_);
	_tmp50_ = prop;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp50_);
	_tmp51_ = prop;
	_tmp52_ = vala_property_get_property_type (_tmp51_);
	_tmp53_ = _tmp52_;
	vala_gir_writer_write_type (self, _tmp53_, -1, VALA_PARAMETER_DIRECTION_IN);
	_tmp54_ = self->priv->indent;
	self->priv->indent = _tmp54_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp55_ = self->priv->buffer;
	g_string_append_printf (_tmp55_, "</property>\n");
	_tmp56_ = prop;
	_tmp57_ = vala_property_get_get_accessor (_tmp56_);
	_tmp58_ = _tmp57_;
	if (_tmp58_ != NULL) {
		ValaMethod* m = NULL;
		ValaProperty* _tmp59_;
		ValaPropertyAccessor* _tmp60_;
		ValaPropertyAccessor* _tmp61_;
		ValaMethod* _tmp62_;
		ValaMethod* _tmp63_;
		_tmp59_ = prop;
		_tmp60_ = vala_property_get_get_accessor (_tmp59_);
		_tmp61_ = _tmp60_;
		_tmp62_ = vala_property_accessor_get_method (_tmp61_);
		m = _tmp62_;
		_tmp63_ = m;
		if (_tmp63_ != NULL) {
			ValaMethod* _tmp64_;
			_tmp64_ = m;
			vala_code_visitor_visit_method ((ValaCodeVisitor*) self, _tmp64_);
		}
		_vala_code_node_unref0 (m);
	}
	_tmp65_ = prop;
	_tmp66_ = vala_property_get_set_accessor (_tmp65_);
	_tmp67_ = _tmp66_;
	if (_tmp67_ != NULL) {
		ValaMethod* m = NULL;
		ValaProperty* _tmp68_;
		ValaPropertyAccessor* _tmp69_;
		ValaPropertyAccessor* _tmp70_;
		ValaMethod* _tmp71_;
		ValaMethod* _tmp72_;
		_tmp68_ = prop;
		_tmp69_ = vala_property_get_set_accessor (_tmp68_);
		_tmp70_ = _tmp69_;
		_tmp71_ = vala_property_accessor_get_method (_tmp70_);
		m = _tmp71_;
		_tmp72_ = m;
		if (_tmp72_ != NULL) {
			ValaMethod* _tmp73_;
			_tmp73_ = m;
			vala_code_visitor_visit_method ((ValaCodeVisitor*) self, _tmp73_);
		}
		_vala_code_node_unref0 (m);
	}
}


static void vala_gir_writer_real_visit_signal (ValaCodeVisitor* base, ValaSignal* sig) {
	ValaGIRWriter * self;
	ValaSignal* _tmp0_;
	gboolean _tmp1_;
	ValaSignal* _tmp2_;
	ValaMethod* _tmp3_;
	ValaMethod* _tmp4_;
	GString* _tmp8_;
	ValaSignal* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	ValaSignal* _tmp12_;
	GString* _tmp13_;
	gint _tmp14_;
	ValaSignal* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	ValaSignal* _tmp18_;
	ValaSignal* _tmp19_;
	ValaList* _tmp20_;
	ValaList* _tmp21_;
	ValaSignal* _tmp22_;
	ValaDataType* _tmp23_;
	ValaDataType* _tmp24_;
	ValaSignal* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gint _tmp28_;
	GString* _tmp29_;
	self = (ValaGIRWriter*) base;
	g_return_if_fail (sig != NULL);
	_tmp0_ = sig;
	_tmp1_ = vala_gir_writer_check_accessibility (self, (ValaSymbol*) _tmp0_);
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = sig;
	_tmp3_ = vala_signal_get_emitter (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != NULL) {
		ValaSignal* _tmp5_;
		ValaMethod* _tmp6_;
		ValaMethod* _tmp7_;
		_tmp5_ = sig;
		_tmp6_ = vala_signal_get_emitter (_tmp5_);
		_tmp7_ = _tmp6_;
		vala_code_node_accept ((ValaCodeNode*) _tmp7_, (ValaCodeVisitor*) self);
	}
	vala_gir_writer_write_indent (self);
	_tmp8_ = self->priv->buffer;
	_tmp9_ = sig;
	_tmp10_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp9_);
	_tmp11_ = _tmp10_;
	g_string_append_printf (_tmp8_, "<glib:signal name=\"%s\"", _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = sig;
	vala_gir_writer_write_symbol_attributes (self, (ValaSymbol*) _tmp12_);
	_tmp13_ = self->priv->buffer;
	g_string_append_printf (_tmp13_, ">\n");
	_tmp14_ = self->priv->indent;
	self->priv->indent = _tmp14_ + 1;
	_tmp15_ = sig;
	_tmp16_ = vala_gir_writer_get_signal_comment (self, _tmp15_);
	_tmp17_ = _tmp16_;
	vala_gir_writer_write_doc (self, _tmp17_);
	_g_free0 (_tmp17_);
	_tmp18_ = sig;
	vala_gir_writer_write_annotations (self, (ValaCodeNode*) _tmp18_);
	_tmp19_ = sig;
	_tmp20_ = vala_callable_get_parameters ((ValaCallable*) _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = sig;
	_tmp23_ = vala_callable_get_return_type ((ValaCallable*) _tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = sig;
	_tmp26_ = vala_gir_writer_get_signal_return_comment (self, _tmp25_);
	_tmp27_ = _tmp26_;
	vala_gir_writer_write_params_and_return (self, _tmp21_, _tmp24_, FALSE, _tmp27_, FALSE, NULL, FALSE);
	_g_free0 (_tmp27_);
	_vala_iterable_unref0 (_tmp21_);
	_tmp28_ = self->priv->indent;
	self->priv->indent = _tmp28_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp29_ = self->priv->buffer;
	g_string_append_printf (_tmp29_, "</glib:signal>\n");
}


static void vala_gir_writer_write_indent (ValaGIRWriter* self) {
	gint i = 0;
	g_return_if_fail (self != NULL);
	{
		gboolean _tmp0_ = FALSE;
		i = 0;
		_tmp0_ = TRUE;
		while (TRUE) {
			gint _tmp2_;
			gint _tmp3_;
			GString* _tmp4_;
			if (!_tmp0_) {
				gint _tmp1_;
				_tmp1_ = i;
				i = _tmp1_ + 1;
			}
			_tmp0_ = FALSE;
			_tmp2_ = i;
			_tmp3_ = self->priv->indent;
			if (!(_tmp2_ < _tmp3_)) {
				break;
			}
			_tmp4_ = self->priv->buffer;
			g_string_append_c (_tmp4_, '\t');
		}
	}
}


static void vala_gir_writer_write_indent_stream (ValaGIRWriter* self) {
	gint i = 0;
	g_return_if_fail (self != NULL);
	{
		gboolean _tmp0_ = FALSE;
		i = 0;
		_tmp0_ = TRUE;
		while (TRUE) {
			gint _tmp2_;
			gint _tmp3_;
			FILE* _tmp4_;
			if (!_tmp0_) {
				gint _tmp1_;
				_tmp1_ = i;
				i = _tmp1_ + 1;
			}
			_tmp0_ = FALSE;
			_tmp2_ = i;
			_tmp3_ = self->priv->indent;
			if (!(_tmp2_ < _tmp3_)) {
				break;
			}
			_tmp4_ = self->priv->stream;
			fputc ('\t', _tmp4_);
		}
	}
}


static void vala_gir_writer_write_param_or_return (ValaGIRWriter* self, ValaDataType* type, gboolean is_parameter, gint* index, gboolean has_array_length, const gchar* name, const gchar* comment, ValaParameterDirection direction, gboolean constructor, gboolean caller_allocates) {
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_;
	gchar* tag = NULL;
	gchar* _tmp2_;
	GString* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	ValaParameterDirection _tmp8_;
	ValaDelegateType* delegate_type = NULL;
	ValaDataType* _tmp12_;
	ValaDelegateType* _tmp13_;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_ = FALSE;
	ValaDataType* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp49_;
	ValaDataType* _tmp51_;
	gboolean _tmp52_;
	gboolean _tmp53_;
	gboolean _tmp55_ = FALSE;
	ValaDelegateType* _tmp56_;
	GString* _tmp85_;
	gint _tmp86_;
	const gchar* _tmp87_;
	gint length_param_index = 0;
	gboolean _tmp88_;
	ValaDataType* _tmp93_;
	gint _tmp94_;
	ValaParameterDirection _tmp95_;
	gint _tmp96_;
	GString* _tmp97_;
	const gchar* _tmp98_;
	gint _tmp99_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (type != NULL);
	vala_gir_writer_write_indent (self);
	_tmp1_ = is_parameter;
	if (_tmp1_) {
		_tmp0_ = "parameter";
	} else {
		_tmp0_ = "return-value";
	}
	_tmp2_ = g_strdup (_tmp0_);
	tag = _tmp2_;
	_tmp3_ = self->priv->buffer;
	_tmp4_ = tag;
	g_string_append_printf (_tmp3_, "<%s", _tmp4_);
	_tmp5_ = name;
	if (_tmp5_ != NULL) {
		GString* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = self->priv->buffer;
		_tmp7_ = name;
		g_string_append_printf (_tmp6_, " name=\"%s\"", _tmp7_);
	}
	_tmp8_ = direction;
	if (_tmp8_ == VALA_PARAMETER_DIRECTION_REF) {
		GString* _tmp9_;
		_tmp9_ = self->priv->buffer;
		g_string_append_printf (_tmp9_, " direction=\"inout\"");
	} else {
		ValaParameterDirection _tmp10_;
		_tmp10_ = direction;
		if (_tmp10_ == VALA_PARAMETER_DIRECTION_OUT) {
			GString* _tmp11_;
			_tmp11_ = self->priv->buffer;
			g_string_append_printf (_tmp11_, " direction=\"out\"");
		}
	}
	_tmp12_ = type;
	_tmp13_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, VALA_TYPE_DELEGATE_TYPE) ? ((ValaDelegateType*) _tmp12_) : NULL);
	delegate_type = _tmp13_;
	_tmp16_ = type;
	_tmp17_ = vala_data_type_get_value_owned (_tmp16_);
	_tmp18_ = _tmp17_;
	if (_tmp18_) {
		ValaDelegateType* _tmp19_;
		_tmp19_ = delegate_type;
		_tmp15_ = _tmp19_ == NULL;
	} else {
		_tmp15_ = FALSE;
	}
	if (_tmp15_) {
		_tmp14_ = TRUE;
	} else {
		gboolean _tmp20_ = FALSE;
		gboolean _tmp21_;
		_tmp21_ = constructor;
		if (_tmp21_) {
			ValaDataType* _tmp22_;
			ValaTypeSymbol* _tmp23_;
			ValaTypeSymbol* _tmp24_;
			ValaTypeSymbol* _tmp25_;
			gboolean _tmp26_;
			_tmp22_ = type;
			_tmp23_ = vala_data_type_get_data_type (_tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = self->priv->ginitiallyunowned_type;
			_tmp26_ = vala_typesymbol_is_subtype_of (_tmp24_, _tmp25_);
			_tmp20_ = !_tmp26_;
		} else {
			_tmp20_ = FALSE;
		}
		_tmp14_ = _tmp20_;
	}
	if (_tmp14_) {
		gboolean any_owned = FALSE;
		gboolean _tmp42_ = FALSE;
		ValaDataType* _tmp43_;
		gboolean _tmp44_;
		any_owned = FALSE;
		{
			ValaList* _generic_arg_list = NULL;
			ValaDataType* _tmp27_;
			ValaList* _tmp28_;
			gint _generic_arg_size = 0;
			ValaList* _tmp29_;
			gint _tmp30_;
			gint _tmp31_;
			gint _generic_arg_index = 0;
			_tmp27_ = type;
			_tmp28_ = vala_data_type_get_type_arguments (_tmp27_);
			_generic_arg_list = _tmp28_;
			_tmp29_ = _generic_arg_list;
			_tmp30_ = vala_collection_get_size ((ValaCollection*) _tmp29_);
			_tmp31_ = _tmp30_;
			_generic_arg_size = _tmp31_;
			_generic_arg_index = -1;
			while (TRUE) {
				gint _tmp32_;
				gint _tmp33_;
				gint _tmp34_;
				ValaDataType* generic_arg = NULL;
				ValaList* _tmp35_;
				gint _tmp36_;
				gpointer _tmp37_;
				gboolean _tmp38_;
				ValaDataType* _tmp39_;
				gboolean _tmp40_;
				gboolean _tmp41_;
				_tmp32_ = _generic_arg_index;
				_generic_arg_index = _tmp32_ + 1;
				_tmp33_ = _generic_arg_index;
				_tmp34_ = _generic_arg_size;
				if (!(_tmp33_ < _tmp34_)) {
					break;
				}
				_tmp35_ = _generic_arg_list;
				_tmp36_ = _generic_arg_index;
				_tmp37_ = vala_list_get (_tmp35_, _tmp36_);
				generic_arg = (ValaDataType*) _tmp37_;
				_tmp38_ = any_owned;
				_tmp39_ = generic_arg;
				_tmp40_ = vala_data_type_get_value_owned (_tmp39_);
				_tmp41_ = _tmp40_;
				any_owned = _tmp38_ | _tmp41_;
				_vala_code_node_unref0 (generic_arg);
			}
			_vala_iterable_unref0 (_generic_arg_list);
		}
		_tmp43_ = type;
		_tmp44_ = vala_data_type_has_type_arguments (_tmp43_);
		if (_tmp44_) {
			gboolean _tmp45_;
			_tmp45_ = any_owned;
			_tmp42_ = !_tmp45_;
		} else {
			_tmp42_ = FALSE;
		}
		if (_tmp42_) {
			GString* _tmp46_;
			_tmp46_ = self->priv->buffer;
			g_string_append_printf (_tmp46_, " transfer-ownership=\"container\"");
		} else {
			GString* _tmp47_;
			_tmp47_ = self->priv->buffer;
			g_string_append_printf (_tmp47_, " transfer-ownership=\"full\"");
		}
	} else {
		GString* _tmp48_;
		_tmp48_ = self->priv->buffer;
		g_string_append_printf (_tmp48_, " transfer-ownership=\"none\"");
	}
	_tmp49_ = caller_allocates;
	if (_tmp49_) {
		GString* _tmp50_;
		_tmp50_ = self->priv->buffer;
		g_string_append_printf (_tmp50_, " caller-allocates=\"1\"");
	}
	_tmp51_ = type;
	_tmp52_ = vala_data_type_get_nullable (_tmp51_);
	_tmp53_ = _tmp52_;
	if (_tmp53_) {
		GString* _tmp54_;
		_tmp54_ = self->priv->buffer;
		g_string_append_printf (_tmp54_, " allow-none=\"1\"");
	}
	_tmp56_ = delegate_type;
	if (_tmp56_ != NULL) {
		ValaDelegateType* _tmp57_;
		ValaDelegate* _tmp58_;
		ValaDelegate* _tmp59_;
		gboolean _tmp60_;
		gboolean _tmp61_;
		_tmp57_ = delegate_type;
		_tmp58_ = vala_delegate_type_get_delegate_symbol (_tmp57_);
		_tmp59_ = _tmp58_;
		_tmp60_ = vala_delegate_get_has_target (_tmp59_);
		_tmp61_ = _tmp60_;
		_tmp55_ = _tmp61_;
	} else {
		_tmp55_ = FALSE;
	}
	if (_tmp55_) {
		gint _tmp62_ = 0;
		gboolean _tmp63_;
		gint closure_index = 0;
		GString* _tmp71_;
		gint _tmp72_;
		ValaDelegateType* _tmp73_;
		gboolean _tmp74_;
		gboolean _tmp75_;
		_tmp63_ = is_parameter;
		if (_tmp63_) {
			gint _tmp64_;
			_tmp64_ = *index;
			_tmp62_ = _tmp64_ + 1;
		} else {
			gint _tmp65_ = 0;
			ValaDataType* _tmp66_;
			gboolean _tmp67_;
			gboolean _tmp68_;
			_tmp66_ = type;
			_tmp67_ = vala_data_type_get_value_owned (_tmp66_);
			_tmp68_ = _tmp67_;
			if (_tmp68_) {
				gint _tmp69_;
				_tmp69_ = *index;
				_tmp65_ = _tmp69_ - 1;
			} else {
				gint _tmp70_;
				_tmp70_ = *index;
				_tmp65_ = _tmp70_;
			}
			_tmp62_ = _tmp65_;
		}
		closure_index = _tmp62_;
		_tmp71_ = self->priv->buffer;
		_tmp72_ = closure_index;
		g_string_append_printf (_tmp71_, " closure=\"%i\"", _tmp72_);
		_tmp73_ = delegate_type;
		_tmp74_ = vala_delegate_type_get_is_called_once (_tmp73_);
		_tmp75_ = _tmp74_;
		if (_tmp75_) {
			GString* _tmp76_;
			_tmp76_ = self->priv->buffer;
			g_string_append (_tmp76_, " scope=\"async\"");
		} else {
			ValaDataType* _tmp77_;
			gboolean _tmp78_;
			gboolean _tmp79_;
			_tmp77_ = type;
			_tmp78_ = vala_data_type_get_value_owned (_tmp77_);
			_tmp79_ = _tmp78_;
			if (_tmp79_) {
				GString* _tmp80_;
				gint _tmp81_;
				_tmp80_ = self->priv->buffer;
				_tmp81_ = closure_index;
				g_string_append_printf (_tmp80_, " scope=\"notified\" destroy=\"%i\"", _tmp81_ + 1);
			} else {
				GString* _tmp82_;
				_tmp82_ = self->priv->buffer;
				g_string_append (_tmp82_, " scope=\"call\"");
			}
		}
	} else {
		ValaDelegateType* _tmp83_;
		_tmp83_ = delegate_type;
		if (_tmp83_ != NULL) {
			GString* _tmp84_;
			_tmp84_ = self->priv->buffer;
			g_string_append (_tmp84_, " scope=\"call\"");
		}
	}
	_tmp85_ = self->priv->buffer;
	g_string_append_printf (_tmp85_, ">\n");
	_tmp86_ = self->priv->indent;
	self->priv->indent = _tmp86_ + 1;
	_tmp87_ = comment;
	vala_gir_writer_write_doc (self, _tmp87_);
	length_param_index = -1;
	_tmp88_ = has_array_length;
	if (_tmp88_) {
		gint _tmp89_ = 0;
		gboolean _tmp90_;
		_tmp90_ = is_parameter;
		if (_tmp90_) {
			gint _tmp91_;
			_tmp91_ = *index;
			_tmp89_ = _tmp91_ + 1;
		} else {
			gint _tmp92_;
			_tmp92_ = *index;
			_tmp89_ = _tmp92_;
		}
		length_param_index = _tmp89_;
	}
	_tmp93_ = type;
	_tmp94_ = length_param_index;
	_tmp95_ = direction;
	vala_gir_writer_write_type (self, _tmp93_, _tmp94_, _tmp95_);
	_tmp96_ = self->priv->indent;
	self->priv->indent = _tmp96_ - 1;
	vala_gir_writer_write_indent (self);
	_tmp97_ = self->priv->buffer;
	_tmp98_ = tag;
	g_string_append_printf (_tmp97_, "</%s>\n", _tmp98_);
	_tmp99_ = *index;
	*index = _tmp99_ + 1;
	_vala_code_node_unref0 (delegate_type);
	_g_free0 (tag);
}


static void vala_gir_writer_write_ctype_attributes (ValaGIRWriter* self, ValaTypeSymbol* symbol, const gchar* suffix) {
	GString* _tmp0_;
	ValaTypeSymbol* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	g_return_if_fail (suffix != NULL);
	_tmp0_ = self->priv->buffer;
	_tmp1_ = symbol;
	_tmp2_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = suffix;
	g_string_append_printf (_tmp0_, " c:type=\"%s%s\"", _tmp3_, _tmp4_);
	_g_free0 (_tmp3_);
}


static void vala_gir_writer_write_gtype_attributes (ValaGIRWriter* self, ValaTypeSymbol* symbol) {
	ValaTypeSymbol* _tmp0_;
	GString* _tmp1_;
	ValaTypeSymbol* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GString* _tmp5_;
	ValaTypeSymbol* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	_tmp0_ = symbol;
	vala_gir_writer_write_ctype_attributes (self, _tmp0_, "");
	_tmp1_ = self->priv->buffer;
	_tmp2_ = symbol;
	_tmp3_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp2_);
	_tmp4_ = _tmp3_;
	g_string_append_printf (_tmp1_, " glib:type-name=\"%s\"", _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = self->priv->buffer;
	_tmp6_ = symbol;
	_tmp7_ = vala_ccode_base_module_get_ccode_lower_case_prefix ((ValaSymbol*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_string_append_printf (_tmp5_, " glib:get-type=\"%sget_type\"", _tmp8_);
	_g_free0 (_tmp8_);
}


static void vala_gir_writer_write_type (ValaGIRWriter* self, ValaDataType* type, gint index, ValaParameterDirection direction) {
	ValaDataType* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (type != NULL);
	_tmp0_ = type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_ARRAY_TYPE)) {
		ValaArrayType* array_type = NULL;
		ValaDataType* _tmp1_;
		ValaArrayType* _tmp2_;
		GString* _tmp3_;
		gboolean _tmp4_ = FALSE;
		ValaArrayType* _tmp5_;
		gboolean _tmp6_;
		gboolean _tmp7_;
		GString* _tmp23_;
		gint _tmp24_;
		ValaArrayType* _tmp25_;
		ValaDataType* _tmp26_;
		ValaDataType* _tmp27_;
		gint _tmp28_;
		GString* _tmp29_;
		_tmp1_ = type;
		_tmp2_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
		array_type = _tmp2_;
		vala_gir_writer_write_indent (self);
		_tmp3_ = self->priv->buffer;
		g_string_append_printf (_tmp3_, "<array");
		_tmp5_ = array_type;
		_tmp6_ = vala_array_type_get_fixed_length (_tmp5_);
		_tmp7_ = _tmp6_;
		if (_tmp7_) {
			ValaArrayType* _tmp8_;
			ValaExpression* _tmp9_;
			ValaExpression* _tmp10_;
			_tmp8_ = array_type;
			_tmp9_ = vala_array_type_get_length (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp4_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_INTEGER_LITERAL);
		} else {
			_tmp4_ = FALSE;
		}
		if (_tmp4_) {
			ValaIntegerLiteral* lit = NULL;
			ValaArrayType* _tmp11_;
			ValaExpression* _tmp12_;
			ValaExpression* _tmp13_;
			ValaIntegerLiteral* _tmp14_;
			GString* _tmp15_;
			ValaIntegerLiteral* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			gint _tmp19_;
			_tmp11_ = array_type;
			_tmp12_ = vala_array_type_get_length (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, VALA_TYPE_INTEGER_LITERAL, ValaIntegerLiteral));
			lit = _tmp14_;
			_tmp15_ = self->priv->buffer;
			_tmp16_ = lit;
			_tmp17_ = vala_integer_literal_get_value (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = atoi (_tmp18_);
			g_string_append_printf (_tmp15_, " fixed-size=\"%i\"", _tmp19_);
			_vala_code_node_unref0 (lit);
		} else {
			gint _tmp20_;
			_tmp20_ = index;
			if (_tmp20_ != -1) {
				GString* _tmp21_;
				gint _tmp22_;
				_tmp21_ = self->priv->buffer;
				_tmp22_ = index;
				g_string_append_printf (_tmp21_, " length=\"%i\"", _tmp22_);
			}
		}
		_tmp23_ = self->priv->buffer;
		g_string_append_printf (_tmp23_, ">\n");
		_tmp24_ = self->priv->indent;
		self->priv->indent = _tmp24_ + 1;
		_tmp25_ = array_type;
		_tmp26_ = vala_array_type_get_element_type (_tmp25_);
		_tmp27_ = _tmp26_;
		vala_gir_writer_write_type (self, _tmp27_, -1, VALA_PARAMETER_DIRECTION_IN);
		_tmp28_ = self->priv->indent;
		self->priv->indent = _tmp28_ - 1;
		vala_gir_writer_write_indent (self);
		_tmp29_ = self->priv->buffer;
		g_string_append_printf (_tmp29_, "</array>\n");
		_vala_code_node_unref0 (array_type);
	} else {
		ValaDataType* _tmp30_;
		_tmp30_ = type;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp30_, VALA_TYPE_VOID_TYPE)) {
			GString* _tmp31_;
			vala_gir_writer_write_indent (self);
			_tmp31_ = self->priv->buffer;
			g_string_append_printf (_tmp31_, "<type name=\"none\"/>\n");
		} else {
			ValaDataType* _tmp32_;
			_tmp32_ = type;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp32_, VALA_TYPE_POINTER_TYPE)) {
				GString* _tmp33_;
				ValaDataType* _tmp34_;
				gchar* _tmp35_;
				gchar* _tmp36_;
				vala_gir_writer_write_indent (self);
				_tmp33_ = self->priv->buffer;
				_tmp34_ = type;
				_tmp35_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp34_);
				_tmp36_ = _tmp35_;
				g_string_append_printf (_tmp33_, "<type name=\"gpointer\" c:type=\"%s\"/>\n", _tmp36_);
				_g_free0 (_tmp36_);
			} else {
				ValaDataType* _tmp37_;
				ValaTypeSymbol* _tmp38_;
				ValaTypeSymbol* _tmp39_;
				_tmp37_ = type;
				_tmp38_ = vala_data_type_get_data_type (_tmp37_);
				_tmp39_ = _tmp38_;
				if (_tmp39_ != NULL) {
					gchar* type_name = NULL;
					ValaDataType* _tmp40_;
					ValaTypeSymbol* _tmp41_;
					ValaTypeSymbol* _tmp42_;
					gchar* _tmp43_;
					gboolean is_array = FALSE;
					gboolean _tmp44_ = FALSE;
					const gchar* _tmp45_;
					const gchar* _tmp47_ = NULL;
					gboolean _tmp48_;
					const gchar* _tmp49_ = NULL;
					ValaParameterDirection _tmp50_;
					GString* _tmp51_;
					ValaDataType* _tmp52_;
					ValaTypeSymbol* _tmp53_;
					ValaTypeSymbol* _tmp54_;
					gchar* _tmp55_;
					gchar* _tmp56_;
					ValaDataType* _tmp57_;
					gchar* _tmp58_;
					gchar* _tmp59_;
					ValaList* type_arguments = NULL;
					ValaDataType* _tmp60_;
					ValaList* _tmp61_;
					ValaList* _tmp62_;
					gint _tmp63_;
					gint _tmp64_;
					vala_gir_writer_write_indent (self);
					_tmp40_ = type;
					_tmp41_ = vala_data_type_get_data_type (_tmp40_);
					_tmp42_ = _tmp41_;
					_tmp43_ = vala_gir_writer_gi_type_name (self, _tmp42_);
					type_name = _tmp43_;
					is_array = FALSE;
					_tmp45_ = type_name;
					if (g_strcmp0 (_tmp45_, "GLib.Array") == 0) {
						_tmp44_ = TRUE;
					} else {
						const gchar* _tmp46_;
						_tmp46_ = type_name;
						_tmp44_ = g_strcmp0 (_tmp46_, "GLib.PtrArray") == 0;
					}
					if (_tmp44_) {
						is_array = TRUE;
					}
					_tmp48_ = is_array;
					if (_tmp48_) {
						_tmp47_ = "array";
					} else {
						_tmp47_ = "type";
					}
					_tmp50_ = direction;
					if (_tmp50_ == VALA_PARAMETER_DIRECTION_IN) {
						_tmp49_ = "";
					} else {
						_tmp49_ = "*";
					}
					_tmp51_ = self->priv->buffer;
					_tmp52_ = type;
					_tmp53_ = vala_data_type_get_data_type (_tmp52_);
					_tmp54_ = _tmp53_;
					_tmp55_ = vala_gir_writer_gi_type_name (self, _tmp54_);
					_tmp56_ = _tmp55_;
					_tmp57_ = type;
					_tmp58_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp57_);
					_tmp59_ = _tmp58_;
					g_string_append_printf (_tmp51_, "<%s name=\"%s\" c:type=\"%s%s\"", _tmp47_, _tmp56_, _tmp59_, _tmp49_);
					_g_free0 (_tmp59_);
					_g_free0 (_tmp56_);
					_tmp60_ = type;
					_tmp61_ = vala_data_type_get_type_arguments (_tmp60_);
					type_arguments = _tmp61_;
					_tmp62_ = type_arguments;
					_tmp63_ = vala_collection_get_size ((ValaCollection*) _tmp62_);
					_tmp64_ = _tmp63_;
					if (_tmp64_ == 0) {
						GString* _tmp65_;
						_tmp65_ = self->priv->buffer;
						g_string_append_printf (_tmp65_, "/>\n");
					} else {
						GString* _tmp66_;
						gint _tmp67_;
						gint _tmp80_;
						const gchar* _tmp81_ = NULL;
						gboolean _tmp82_;
						GString* _tmp83_;
						_tmp66_ = self->priv->buffer;
						g_string_append_printf (_tmp66_, ">\n");
						_tmp67_ = self->priv->indent;
						self->priv->indent = _tmp67_ + 1;
						{
							ValaList* _type_argument_list = NULL;
							ValaList* _tmp68_;
							ValaList* _tmp69_;
							gint _type_argument_size = 0;
							ValaList* _tmp70_;
							gint _tmp71_;
							gint _tmp72_;
							gint _type_argument_index = 0;
							_tmp68_ = type_arguments;
							_tmp69_ = _vala_iterable_ref0 (_tmp68_);
							_type_argument_list = _tmp69_;
							_tmp70_ = _type_argument_list;
							_tmp71_ = vala_collection_get_size ((ValaCollection*) _tmp70_);
							_tmp72_ = _tmp71_;
							_type_argument_size = _tmp72_;
							_type_argument_index = -1;
							while (TRUE) {
								gint _tmp73_;
								gint _tmp74_;
								gint _tmp75_;
								ValaDataType* type_argument = NULL;
								ValaList* _tmp76_;
								gint _tmp77_;
								gpointer _tmp78_;
								ValaDataType* _tmp79_;
								_tmp73_ = _type_argument_index;
								_type_argument_index = _tmp73_ + 1;
								_tmp74_ = _type_argument_index;
								_tmp75_ = _type_argument_size;
								if (!(_tmp74_ < _tmp75_)) {
									break;
								}
								_tmp76_ = _type_argument_list;
								_tmp77_ = _type_argument_index;
								_tmp78_ = vala_list_get (_tmp76_, _tmp77_);
								type_argument = (ValaDataType*) _tmp78_;
								_tmp79_ = type_argument;
								vala_gir_writer_write_type (self, _tmp79_, -1, VALA_PARAMETER_DIRECTION_IN);
								_vala_code_node_unref0 (type_argument);
							}
							_vala_iterable_unref0 (_type_argument_list);
						}
						_tmp80_ = self->priv->indent;
						self->priv->indent = _tmp80_ - 1;
						vala_gir_writer_write_indent (self);
						_tmp82_ = is_array;
						if (_tmp82_) {
							_tmp81_ = "array";
						} else {
							_tmp81_ = "type";
						}
						_tmp83_ = self->priv->buffer;
						g_string_append_printf (_tmp83_, "</%s>\n", _tmp81_);
					}
					_vala_iterable_unref0 (type_arguments);
					_g_free0 (type_name);
				} else {
					ValaDataType* _tmp84_;
					_tmp84_ = type;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp84_, VALA_TYPE_DELEGATE_TYPE)) {
						ValaDelegateType* deleg_type = NULL;
						ValaDataType* _tmp85_;
						ValaDelegateType* _tmp86_;
						GString* _tmp87_;
						ValaDelegateType* _tmp88_;
						ValaDelegate* _tmp89_;
						ValaDelegate* _tmp90_;
						gchar* _tmp91_;
						gchar* _tmp92_;
						ValaDataType* _tmp93_;
						gchar* _tmp94_;
						gchar* _tmp95_;
						_tmp85_ = type;
						_tmp86_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp85_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
						deleg_type = _tmp86_;
						vala_gir_writer_write_indent (self);
						_tmp87_ = self->priv->buffer;
						_tmp88_ = deleg_type;
						_tmp89_ = vala_delegate_type_get_delegate_symbol (_tmp88_);
						_tmp90_ = _tmp89_;
						_tmp91_ = vala_gir_writer_gi_type_name (self, (ValaTypeSymbol*) _tmp90_);
						_tmp92_ = _tmp91_;
						_tmp93_ = type;
						_tmp94_ = vala_ccode_base_module_get_ccode_name ((ValaCodeNode*) _tmp93_);
						_tmp95_ = _tmp94_;
						g_string_append_printf (_tmp87_, "<type name=\"%s\" c:type=\"%s\"/>\n", _tmp92_, _tmp95_);
						_g_free0 (_tmp95_);
						_g_free0 (_tmp92_);
						_vala_code_node_unref0 (deleg_type);
					} else {
						ValaDataType* _tmp96_;
						_tmp96_ = type;
						if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp96_, VALA_TYPE_GENERIC_TYPE)) {
							GString* _tmp97_;
							vala_gir_writer_write_indent (self);
							_tmp97_ = self->priv->buffer;
							g_string_append (_tmp97_, "<type name=\"gpointer\" c:type=\"gpointer\"/>\n");
						} else {
							GString* _tmp98_;
							ValaDataType* _tmp99_;
							gchar* _tmp100_;
							gchar* _tmp101_;
							vala_gir_writer_write_indent (self);
							_tmp98_ = self->priv->buffer;
							_tmp99_ = type;
							_tmp100_ = vala_code_node_to_string ((ValaCodeNode*) _tmp99_);
							_tmp101_ = _tmp100_;
							g_string_append_printf (_tmp98_, "<type name=\"%s\"/>\n", _tmp101_);
							_g_free0 (_tmp101_);
						}
					}
				}
			}
		}
	}
}


static void vala_gir_writer_write_annotations (ValaGIRWriter* self, ValaCodeNode* node) {
	ValaCodeNode* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	_tmp1_ = _tmp0_->attributes;
	{
		GList* attr_collection = NULL;
		GList* attr_it = NULL;
		attr_collection = _tmp1_;
		for (attr_it = attr_collection; attr_it != NULL; attr_it = attr_it->next) {
			ValaAttribute* _tmp2_;
			ValaAttribute* attr = NULL;
			_tmp2_ = _vala_code_node_ref0 ((ValaAttribute*) attr_it->data);
			attr = _tmp2_;
			{
				gchar* name = NULL;
				ValaAttribute* _tmp3_;
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				gchar* _tmp6_;
				_tmp3_ = attr;
				_tmp4_ = vala_attribute_get_name (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = vala_gir_writer_camel_case_to_canonical (self, _tmp5_);
				name = _tmp6_;
				{
					ValaIterator* _arg_name_it = NULL;
					ValaAttribute* _tmp7_;
					ValaMap* _tmp8_;
					ValaSet* _tmp9_;
					ValaSet* _tmp10_;
					ValaIterator* _tmp11_;
					ValaIterator* _tmp12_;
					_tmp7_ = attr;
					_tmp8_ = _tmp7_->args;
					_tmp9_ = vala_map_get_keys (_tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = vala_iterable_iterator ((ValaIterable*) _tmp10_);
					_tmp12_ = _tmp11_;
					_vala_iterable_unref0 (_tmp10_);
					_arg_name_it = _tmp12_;
					while (TRUE) {
						ValaIterator* _tmp13_;
						gboolean _tmp14_;
						gchar* arg_name = NULL;
						ValaIterator* _tmp15_;
						gpointer _tmp16_;
						gchar* value = NULL;
						ValaAttribute* _tmp17_;
						ValaMap* _tmp18_;
						const gchar* _tmp19_;
						gpointer _tmp20_;
						const gchar* _tmp21_;
						gboolean _tmp22_;
						GString* _tmp26_;
						const gchar* _tmp27_;
						const gchar* _tmp28_;
						gchar* _tmp29_;
						gchar* _tmp30_;
						const gchar* _tmp31_;
						_tmp13_ = _arg_name_it;
						_tmp14_ = vala_iterator_next (_tmp13_);
						if (!_tmp14_) {
							break;
						}
						_tmp15_ = _arg_name_it;
						_tmp16_ = vala_iterator_get (_tmp15_);
						arg_name = (gchar*) _tmp16_;
						_tmp17_ = attr;
						_tmp18_ = _tmp17_->args;
						_tmp19_ = arg_name;
						_tmp20_ = vala_map_get (_tmp18_, _tmp19_);
						value = (gchar*) _tmp20_;
						_tmp21_ = value;
						_tmp22_ = g_str_has_prefix (_tmp21_, "\"");
						if (_tmp22_) {
							ValaAttribute* _tmp23_;
							const gchar* _tmp24_;
							gchar* _tmp25_;
							_tmp23_ = attr;
							_tmp24_ = arg_name;
							_tmp25_ = vala_attribute_get_string (_tmp23_, _tmp24_, NULL);
							_g_free0 (value);
							value = _tmp25_;
						}
						vala_gir_writer_write_indent (self);
						_tmp26_ = self->priv->buffer;
						_tmp27_ = name;
						_tmp28_ = arg_name;
						_tmp29_ = vala_gir_writer_camel_case_to_canonical (self, _tmp28_);
						_tmp30_ = _tmp29_;
						_tmp31_ = value;
						g_string_append_printf (_tmp26_, "<attribute name=\"%s.%s\" value=\"%s\"/>\n", _tmp27_, _tmp30_, _tmp31_);
						_g_free0 (_tmp30_);
						_g_free0 (value);
						_g_free0 (arg_name);
					}
					_vala_iterator_unref0 (_arg_name_it);
				}
				_g_free0 (name);
				_vala_code_node_unref0 (attr);
			}
		}
	}
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = needle;
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
	result = _tmp1_ != NULL;
	return result;
}


static gchar* vala_gir_writer_get_full_gir_name (ValaGIRWriter* self, ValaSymbol* sym) {
	gchar* result = NULL;
	gchar* gir_fullname = NULL;
	ValaSymbol* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* gir_name = NULL;
	ValaSymbol* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	const gchar* _tmp10_;
	ValaSymbol* _tmp15_;
	ValaSymbol* _tmp16_;
	ValaSymbol* _tmp17_;
	ValaSymbol* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* parent_gir_name = NULL;
	ValaSymbol* _tmp25_;
	ValaSymbol* _tmp26_;
	ValaSymbol* _tmp27_;
	gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_ = NULL;
	const gchar* _tmp31_;
	gboolean _tmp32_;
	gchar* self_gir_name = NULL;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	gboolean _tmp39_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (sym != NULL, NULL);
	_tmp0_ = sym;
	_tmp1_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp0_, "GIR", "fullname", NULL);
	gir_fullname = _tmp1_;
	_tmp2_ = gir_fullname;
	if (_tmp2_ != NULL) {
		result = gir_fullname;
		return result;
	}
	_tmp3_ = sym;
	_tmp4_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp3_, "GIR", "name", NULL);
	gir_name = _tmp4_;
	_tmp6_ = gir_name;
	if (_tmp6_ == NULL) {
		ValaSymbol* _tmp7_;
		_tmp7_ = sym;
		_tmp5_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_NAMESPACE);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		ValaSymbol* _tmp8_;
		gchar* _tmp9_;
		_tmp8_ = sym;
		_tmp9_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp8_, "CCode", "gir_namespace", NULL);
		_g_free0 (gir_name);
		gir_name = _tmp9_;
	}
	_tmp10_ = gir_name;
	if (_tmp10_ == NULL) {
		ValaSymbol* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		_tmp11_ = sym;
		_tmp12_ = vala_symbol_get_name (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_strdup (_tmp13_);
		_g_free0 (gir_name);
		gir_name = _tmp14_;
	}
	_tmp15_ = sym;
	_tmp16_ = vala_symbol_get_parent_symbol (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ == NULL) {
		result = gir_name;
		_g_free0 (gir_fullname);
		return result;
	}
	_tmp18_ = sym;
	_tmp19_ = vala_symbol_get_name (_tmp18_);
	_tmp20_ = _tmp19_;
	if (_tmp20_ == NULL) {
		ValaSymbol* _tmp21_;
		ValaSymbol* _tmp22_;
		ValaSymbol* _tmp23_;
		gchar* _tmp24_;
		_tmp21_ = sym;
		_tmp22_ = vala_symbol_get_parent_symbol (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = vala_gir_writer_get_full_gir_name (self, _tmp23_);
		result = _tmp24_;
		_g_free0 (gir_name);
		_g_free0 (gir_fullname);
		return result;
	}
	_tmp25_ = sym;
	_tmp26_ = vala_symbol_get_parent_symbol (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = vala_gir_writer_get_full_gir_name (self, _tmp27_);
	parent_gir_name = _tmp28_;
	_tmp29_ = parent_gir_name;
	if (_tmp29_ == NULL) {
		result = gir_name;
		_g_free0 (parent_gir_name);
		_g_free0 (gir_fullname);
		return result;
	}
	_tmp31_ = gir_name;
	_tmp32_ = g_str_has_prefix (_tmp31_, ".");
	if (_tmp32_) {
		const gchar* _tmp33_;
		gchar* _tmp34_;
		_tmp33_ = gir_name;
		_tmp34_ = string_substring (_tmp33_, (glong) 1, (glong) -1);
		_g_free0 (_tmp30_);
		_tmp30_ = _tmp34_;
	} else {
		const gchar* _tmp35_;
		gchar* _tmp36_;
		_tmp35_ = gir_name;
		_tmp36_ = g_strdup (_tmp35_);
		_g_free0 (_tmp30_);
		_tmp30_ = _tmp36_;
	}
	_tmp37_ = g_strdup (_tmp30_);
	self_gir_name = _tmp37_;
	_tmp38_ = parent_gir_name;
	_tmp39_ = string_contains (_tmp38_, ".");
	if (_tmp39_) {
		const gchar* _tmp40_;
		const gchar* _tmp41_;
		gchar* _tmp42_;
		_tmp40_ = parent_gir_name;
		_tmp41_ = self_gir_name;
		_tmp42_ = g_strdup_printf ("%s%s", _tmp40_, _tmp41_);
		result = _tmp42_;
		_g_free0 (self_gir_name);
		_g_free0 (_tmp30_);
		_g_free0 (parent_gir_name);
		_g_free0 (gir_name);
		_g_free0 (gir_fullname);
		return result;
	} else {
		const gchar* _tmp43_;
		const gchar* _tmp44_;
		gchar* _tmp45_;
		_tmp43_ = parent_gir_name;
		_tmp44_ = self_gir_name;
		_tmp45_ = g_strdup_printf ("%s.%s", _tmp43_, _tmp44_);
		result = _tmp45_;
		_g_free0 (self_gir_name);
		_g_free0 (_tmp30_);
		_g_free0 (parent_gir_name);
		_g_free0 (gir_name);
		_g_free0 (gir_fullname);
		return result;
	}
	_g_free0 (self_gir_name);
	_g_free0 (_tmp30_);
	_g_free0 (parent_gir_name);
	_g_free0 (gir_name);
	_g_free0 (gir_fullname);
}


static gchar* vala_gir_writer_gi_type_name (ValaGIRWriter* self, ValaTypeSymbol* type_symbol) {
	gchar* result = NULL;
	ValaSymbol* parent = NULL;
	ValaTypeSymbol* _tmp0_;
	ValaSymbol* _tmp1_;
	ValaSymbol* _tmp2_;
	ValaSymbol* _tmp3_;
	ValaSymbol* _tmp4_;
	ValaTypeSymbol* _tmp64_;
	gchar* _tmp65_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (type_symbol != NULL, NULL);
	_tmp0_ = type_symbol;
	_tmp1_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _vala_code_node_ref0 (_tmp2_);
	parent = _tmp3_;
	_tmp4_ = parent;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_NAMESPACE)) {
		ValaNamespace* ns = NULL;
		ValaSymbol* _tmp5_;
		ValaNamespace* _tmp6_;
		gchar* _tmp7_ = NULL;
		ValaNamespace* _tmp8_;
		gchar* _tmp9_;
		gchar* ns_gir_name = NULL;
		gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp5_ = parent;
		_tmp6_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, VALA_TYPE_NAMESPACE) ? ((ValaNamespace*) _tmp5_) : NULL);
		ns = _tmp6_;
		_tmp8_ = ns;
		_tmp9_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp8_, "GIR", "name", NULL);
		_tmp7_ = _tmp9_;
		if (_tmp7_ == NULL) {
			ValaNamespace* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			gchar* _tmp13_;
			_tmp10_ = ns;
			_tmp11_ = vala_symbol_get_name ((ValaSymbol*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_strdup (_tmp12_);
			_g_free0 (_tmp7_);
			_tmp7_ = _tmp13_;
		}
		_tmp14_ = _tmp7_;
		_tmp7_ = NULL;
		ns_gir_name = _tmp14_;
		_tmp15_ = ns_gir_name;
		if (_tmp15_ != NULL) {
			ValaTypeSymbol* _tmp16_;
			ValaSourceReference* _tmp17_;
			ValaSourceReference* _tmp18_;
			ValaSourceFile* _tmp19_;
			ValaSourceFile* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			_tmp16_ = type_symbol;
			_tmp17_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = vala_source_reference_get_file (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = vala_source_file_get_gir_namespace (_tmp20_);
			_tmp22_ = _tmp21_;
			if (_tmp22_ != NULL) {
				ValaGIRWriterGIRNamespace external = {0};
				ValaTypeSymbol* _tmp23_;
				ValaSourceReference* _tmp24_;
				ValaSourceReference* _tmp25_;
				ValaSourceFile* _tmp26_;
				ValaSourceFile* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				ValaTypeSymbol* _tmp30_;
				ValaSourceReference* _tmp31_;
				ValaSourceReference* _tmp32_;
				ValaSourceFile* _tmp33_;
				ValaSourceFile* _tmp34_;
				const gchar* _tmp35_;
				const gchar* _tmp36_;
				ValaArrayList* _tmp37_;
				ValaGIRWriterGIRNamespace _tmp38_;
				gboolean _tmp39_;
				gchar* gir_fullname = NULL;
				ValaTypeSymbol* _tmp42_;
				gchar* _tmp43_;
				const gchar* _tmp44_;
				gchar* _tmp45_ = NULL;
				ValaTypeSymbol* _tmp46_;
				gchar* _tmp47_;
				gchar* type_name = NULL;
				gchar* _tmp52_;
				ValaTypeSymbol* _tmp53_;
				ValaSourceReference* _tmp54_;
				ValaSourceReference* _tmp55_;
				ValaSourceFile* _tmp56_;
				ValaSourceFile* _tmp57_;
				const gchar* _tmp58_;
				const gchar* _tmp59_;
				const gchar* _tmp60_;
				gchar* _tmp61_;
				_tmp23_ = type_symbol;
				_tmp24_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = vala_source_reference_get_file (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = vala_source_file_get_gir_namespace (_tmp27_);
				_tmp29_ = _tmp28_;
				_tmp30_ = type_symbol;
				_tmp31_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = vala_source_reference_get_file (_tmp32_);
				_tmp34_ = _tmp33_;
				_tmp35_ = vala_source_file_get_gir_version (_tmp34_);
				_tmp36_ = _tmp35_;
				vala_gir_writer_gir_namespace_init (&external, _tmp29_, _tmp36_);
				_tmp37_ = self->priv->externals;
				_tmp38_ = external;
				_tmp39_ = vala_collection_contains ((ValaCollection*) _tmp37_, &_tmp38_);
				if (!_tmp39_) {
					ValaArrayList* _tmp40_;
					ValaGIRWriterGIRNamespace _tmp41_;
					_tmp40_ = self->priv->externals;
					_tmp41_ = external;
					vala_collection_add ((ValaCollection*) _tmp40_, &_tmp41_);
				}
				_tmp42_ = type_symbol;
				_tmp43_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp42_, "GIR", "fullname", NULL);
				gir_fullname = _tmp43_;
				_tmp44_ = gir_fullname;
				if (_tmp44_ != NULL) {
					result = gir_fullname;
					vala_gir_writer_gir_namespace_destroy (&external);
					_g_free0 (ns_gir_name);
					_g_free0 (_tmp7_);
					_vala_code_node_unref0 (ns);
					_vala_code_node_unref0 (parent);
					return result;
				}
				_tmp46_ = type_symbol;
				_tmp47_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp46_, "GIR", "name", NULL);
				_tmp45_ = _tmp47_;
				if (_tmp45_ == NULL) {
					ValaTypeSymbol* _tmp48_;
					const gchar* _tmp49_;
					const gchar* _tmp50_;
					gchar* _tmp51_;
					_tmp48_ = type_symbol;
					_tmp49_ = vala_symbol_get_name ((ValaSymbol*) _tmp48_);
					_tmp50_ = _tmp49_;
					_tmp51_ = g_strdup (_tmp50_);
					_g_free0 (_tmp45_);
					_tmp45_ = _tmp51_;
				}
				_tmp52_ = _tmp45_;
				_tmp45_ = NULL;
				type_name = _tmp52_;
				_tmp53_ = type_symbol;
				_tmp54_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp53_);
				_tmp55_ = _tmp54_;
				_tmp56_ = vala_source_reference_get_file (_tmp55_);
				_tmp57_ = _tmp56_;
				_tmp58_ = vala_source_file_get_gir_namespace (_tmp57_);
				_tmp59_ = _tmp58_;
				_tmp60_ = type_name;
				_tmp61_ = g_strdup_printf ("%s.%s", _tmp59_, _tmp60_);
				result = _tmp61_;
				_g_free0 (type_name);
				_g_free0 (_tmp45_);
				_g_free0 (gir_fullname);
				vala_gir_writer_gir_namespace_destroy (&external);
				_g_free0 (ns_gir_name);
				_g_free0 (_tmp7_);
				_vala_code_node_unref0 (ns);
				_vala_code_node_unref0 (parent);
				return result;
			} else {
				ValaHashSet* _tmp62_;
				ValaNamespace* _tmp63_;
				_tmp62_ = self->priv->unannotated_namespaces;
				_tmp63_ = ns;
				vala_collection_add ((ValaCollection*) _tmp62_, _tmp63_);
			}
		}
		_g_free0 (ns_gir_name);
		_g_free0 (_tmp7_);
		_vala_code_node_unref0 (ns);
	}
	_tmp64_ = type_symbol;
	_tmp65_ = vala_gir_writer_get_full_gir_name (self, (ValaSymbol*) _tmp64_);
	result = _tmp65_;
	_vala_code_node_unref0 (parent);
	return result;
}


static gchar* vala_gir_writer_literal_expression_to_value_string (ValaGIRWriter* self, ValaExpression* literal) {
	gchar* result = NULL;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (literal != NULL, NULL);
	_tmp0_ = literal;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_STRING_LITERAL)) {
		ValaStringLiteral* lit = NULL;
		ValaExpression* _tmp1_;
		ValaStringLiteral* _tmp2_;
		ValaStringLiteral* _tmp3_;
		_tmp1_ = literal;
		_tmp2_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_STRING_LITERAL) ? ((ValaStringLiteral*) _tmp1_) : NULL);
		lit = _tmp2_;
		_tmp3_ = lit;
		if (_tmp3_ != NULL) {
			ValaStringLiteral* _tmp4_;
			gchar* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp4_ = lit;
			_tmp5_ = vala_string_literal_eval (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = g_markup_escape_text (_tmp6_, (gssize) -1);
			_tmp8_ = _tmp7_;
			_g_free0 (_tmp6_);
			result = _tmp8_;
			_vala_code_node_unref0 (lit);
			return result;
		}
		_vala_code_node_unref0 (lit);
	} else {
		ValaExpression* _tmp9_;
		_tmp9_ = literal;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, VALA_TYPE_CHARACTER_LITERAL)) {
			ValaExpression* _tmp10_;
			gunichar _tmp11_;
			gchar* _tmp12_;
			_tmp10_ = literal;
			_tmp11_ = vala_character_literal_get_char (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, VALA_TYPE_CHARACTER_LITERAL, ValaCharacterLiteral));
			_tmp12_ = g_strdup_printf ("%c", (gint) ((gchar) _tmp11_));
			result = _tmp12_;
			return result;
		} else {
			ValaExpression* _tmp13_;
			_tmp13_ = literal;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, VALA_TYPE_BOOLEAN_LITERAL)) {
				const gchar* _tmp14_ = NULL;
				ValaExpression* _tmp15_;
				gboolean _tmp16_;
				gboolean _tmp17_;
				gchar* _tmp18_;
				_tmp15_ = literal;
				_tmp16_ = vala_boolean_literal_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, VALA_TYPE_BOOLEAN_LITERAL, ValaBooleanLiteral));
				_tmp17_ = _tmp16_;
				if (_tmp17_) {
					_tmp14_ = "true";
				} else {
					_tmp14_ = "false";
				}
				_tmp18_ = g_strdup (_tmp14_);
				result = _tmp18_;
				return result;
			} else {
				ValaExpression* _tmp19_;
				_tmp19_ = literal;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp19_, VALA_TYPE_REAL_LITERAL)) {
					ValaExpression* _tmp20_;
					const gchar* _tmp21_;
					const gchar* _tmp22_;
					gchar* _tmp23_;
					_tmp20_ = literal;
					_tmp21_ = vala_real_literal_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, VALA_TYPE_REAL_LITERAL, ValaRealLiteral));
					_tmp22_ = _tmp21_;
					_tmp23_ = g_strdup (_tmp22_);
					result = _tmp23_;
					return result;
				} else {
					ValaExpression* _tmp24_;
					_tmp24_ = literal;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, VALA_TYPE_INTEGER_LITERAL)) {
						ValaExpression* _tmp25_;
						const gchar* _tmp26_;
						const gchar* _tmp27_;
						gchar* _tmp28_;
						_tmp25_ = literal;
						_tmp26_ = vala_integer_literal_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, VALA_TYPE_INTEGER_LITERAL, ValaIntegerLiteral));
						_tmp27_ = _tmp26_;
						_tmp28_ = g_strdup (_tmp27_);
						result = _tmp28_;
						return result;
					} else {
						ValaExpression* _tmp29_;
						_tmp29_ = literal;
						if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, VALA_TYPE_UNARY_EXPRESSION)) {
							ValaUnaryExpression* unary = NULL;
							ValaExpression* _tmp30_;
							ValaUnaryExpression* _tmp31_;
							ValaUnaryExpression* _tmp32_;
							ValaUnaryOperator _tmp33_;
							ValaUnaryOperator _tmp34_;
							_tmp30_ = literal;
							_tmp31_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, VALA_TYPE_UNARY_EXPRESSION, ValaUnaryExpression));
							unary = _tmp31_;
							_tmp32_ = unary;
							_tmp33_ = vala_unary_expression_get_operator (_tmp32_);
							_tmp34_ = _tmp33_;
							if (_tmp34_ == VALA_UNARY_OPERATOR_MINUS) {
								ValaUnaryExpression* _tmp35_;
								ValaExpression* _tmp36_;
								ValaExpression* _tmp37_;
								_tmp35_ = unary;
								_tmp36_ = vala_unary_expression_get_inner (_tmp35_);
								_tmp37_ = _tmp36_;
								if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp37_, VALA_TYPE_REAL_LITERAL)) {
									ValaUnaryExpression* _tmp38_;
									ValaExpression* _tmp39_;
									ValaExpression* _tmp40_;
									const gchar* _tmp41_;
									const gchar* _tmp42_;
									gchar* _tmp43_;
									_tmp38_ = unary;
									_tmp39_ = vala_unary_expression_get_inner (_tmp38_);
									_tmp40_ = _tmp39_;
									_tmp41_ = vala_real_literal_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp40_, VALA_TYPE_REAL_LITERAL, ValaRealLiteral));
									_tmp42_ = _tmp41_;
									_tmp43_ = g_strconcat ("-", _tmp42_, NULL);
									result = _tmp43_;
									_vala_code_node_unref0 (unary);
									return result;
								} else {
									ValaUnaryExpression* _tmp44_;
									ValaExpression* _tmp45_;
									ValaExpression* _tmp46_;
									_tmp44_ = unary;
									_tmp45_ = vala_unary_expression_get_inner (_tmp44_);
									_tmp46_ = _tmp45_;
									if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp46_, VALA_TYPE_INTEGER_LITERAL)) {
										ValaUnaryExpression* _tmp47_;
										ValaExpression* _tmp48_;
										ValaExpression* _tmp49_;
										const gchar* _tmp50_;
										const gchar* _tmp51_;
										gchar* _tmp52_;
										_tmp47_ = unary;
										_tmp48_ = vala_unary_expression_get_inner (_tmp47_);
										_tmp49_ = _tmp48_;
										_tmp50_ = vala_integer_literal_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp49_, VALA_TYPE_INTEGER_LITERAL, ValaIntegerLiteral));
										_tmp51_ = _tmp50_;
										_tmp52_ = g_strconcat ("-", _tmp51_, NULL);
										result = _tmp52_;
										_vala_code_node_unref0 (unary);
										return result;
									}
								}
							}
							_vala_code_node_unref0 (unary);
						}
					}
				}
			}
		}
	}
	result = NULL;
	return result;
}


static gchar* _vala_g_strjoinv (const gchar* separator, gchar** str_array, int str_array_length1) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gchar** _tmp3_;
	gint _tmp3__length1;
	_tmp0_ = separator;
	if (_tmp0_ == NULL) {
		separator = "";
	}
	_tmp3_ = str_array;
	_tmp3__length1 = str_array_length1;
	if (_tmp3_ != NULL) {
		_tmp2_ = TRUE;
	} else {
		gchar** _tmp4_;
		gint _tmp4__length1;
		_tmp4_ = str_array;
		_tmp4__length1 = str_array_length1;
		_tmp2_ = _tmp4__length1 > 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp5_ = FALSE;
		gchar** _tmp6_;
		gint _tmp6__length1;
		_tmp6_ = str_array;
		_tmp6__length1 = str_array_length1;
		if (_tmp6__length1 == -1) {
			gchar** _tmp7_;
			gint _tmp7__length1;
			const gchar* _tmp8_;
			_tmp7_ = str_array;
			_tmp7__length1 = str_array_length1;
			_tmp8_ = _tmp7_[0];
			_tmp5_ = _tmp8_ != NULL;
		} else {
			_tmp5_ = FALSE;
		}
		_tmp1_ = _tmp5_;
	}
	if (_tmp1_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp31_;
		gint _tmp33_;
		gint _tmp34_;
		gsize _tmp35_;
		const gchar* _tmp36_;
		gint _tmp37_;
		gint _tmp38_;
		gint _tmp39_;
		const gchar* res = NULL;
		gsize _tmp40_;
		void* _tmp41_;
		void* ptr = NULL;
		const gchar* _tmp42_;
		gchar** _tmp43_;
		gint _tmp43__length1;
		const gchar* _tmp44_;
		void* _tmp45_;
		const gchar* _tmp62_;
		len = (gsize) 1;
		{
			gboolean _tmp9_ = FALSE;
			i = 0;
			_tmp9_ = TRUE;
			while (TRUE) {
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				gchar** _tmp13_;
				gint _tmp13__length1;
				gint _tmp21_ = 0;
				gchar** _tmp22_;
				gint _tmp22__length1;
				gint _tmp23_;
				const gchar* _tmp24_;
				gsize _tmp30_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp13_ = str_array;
				_tmp13__length1 = str_array_length1;
				if (_tmp13__length1 != -1) {
					gint _tmp14_;
					gchar** _tmp15_;
					gint _tmp15__length1;
					_tmp14_ = i;
					_tmp15_ = str_array;
					_tmp15__length1 = str_array_length1;
					_tmp12_ = _tmp14_ < _tmp15__length1;
				} else {
					_tmp12_ = FALSE;
				}
				if (_tmp12_) {
					_tmp11_ = TRUE;
				} else {
					gboolean _tmp16_ = FALSE;
					gchar** _tmp17_;
					gint _tmp17__length1;
					_tmp17_ = str_array;
					_tmp17__length1 = str_array_length1;
					if (_tmp17__length1 == -1) {
						gchar** _tmp18_;
						gint _tmp18__length1;
						gint _tmp19_;
						const gchar* _tmp20_;
						_tmp18_ = str_array;
						_tmp18__length1 = str_array_length1;
						_tmp19_ = i;
						_tmp20_ = _tmp18_[_tmp19_];
						_tmp16_ = _tmp20_ != NULL;
					} else {
						_tmp16_ = FALSE;
					}
					_tmp11_ = _tmp16_;
				}
				if (!_tmp11_) {
					break;
				}
				_tmp22_ = str_array;
				_tmp22__length1 = str_array_length1;
				_tmp23_ = i;
				_tmp24_ = _tmp22_[_tmp23_];
				if (_tmp24_ != NULL) {
					gchar** _tmp25_;
					gint _tmp25__length1;
					gint _tmp26_;
					const gchar* _tmp27_;
					gint _tmp28_;
					gint _tmp29_;
					_tmp25_ = str_array;
					_tmp25__length1 = str_array_length1;
					_tmp26_ = i;
					_tmp27_ = _tmp25_[_tmp26_];
					_tmp28_ = strlen ((const gchar*) _tmp27_);
					_tmp29_ = _tmp28_;
					_tmp21_ = _tmp29_;
				} else {
					_tmp21_ = 0;
				}
				_tmp30_ = len;
				len = _tmp30_ + _tmp21_;
			}
		}
		_tmp31_ = i;
		if (_tmp31_ == 0) {
			gchar* _tmp32_;
			_tmp32_ = g_strdup ("");
			result = _tmp32_;
			return result;
		}
		_tmp33_ = i;
		str_array_length1 = _tmp33_;
		_tmp34_ = str_array_length1;
		_tmp35_ = len;
		_tmp36_ = separator;
		_tmp37_ = strlen ((const gchar*) _tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = i;
		len = _tmp35_ + (_tmp38_ * (_tmp39_ - 1));
		_tmp40_ = len;
		_tmp41_ = g_malloc (_tmp40_);
		res = _tmp41_;
		_tmp42_ = res;
		_tmp43_ = str_array;
		_tmp43__length1 = str_array_length1;
		_tmp44_ = _tmp43_[0];
		_tmp45_ = g_stpcpy ((void*) _tmp42_, (const gchar*) _tmp44_);
		ptr = _tmp45_;
		{
			gboolean _tmp46_ = FALSE;
			i = 1;
			_tmp46_ = TRUE;
			while (TRUE) {
				gint _tmp48_;
				gchar** _tmp49_;
				gint _tmp49__length1;
				void* _tmp50_;
				const gchar* _tmp51_;
				void* _tmp52_;
				const gchar* _tmp53_ = NULL;
				gchar** _tmp54_;
				gint _tmp54__length1;
				gint _tmp55_;
				const gchar* _tmp56_;
				void* _tmp60_;
				void* _tmp61_;
				if (!_tmp46_) {
					gint _tmp47_;
					_tmp47_ = i;
					i = _tmp47_ + 1;
				}
				_tmp46_ = FALSE;
				_tmp48_ = i;
				_tmp49_ = str_array;
				_tmp49__length1 = str_array_length1;
				if (!(_tmp48_ < _tmp49__length1)) {
					break;
				}
				_tmp50_ = ptr;
				_tmp51_ = separator;
				_tmp52_ = g_stpcpy (_tmp50_, (const gchar*) _tmp51_);
				ptr = _tmp52_;
				_tmp54_ = str_array;
				_tmp54__length1 = str_array_length1;
				_tmp55_ = i;
				_tmp56_ = _tmp54_[_tmp55_];
				if (_tmp56_ != NULL) {
					gchar** _tmp57_;
					gint _tmp57__length1;
					gint _tmp58_;
					const gchar* _tmp59_;
					_tmp57_ = str_array;
					_tmp57__length1 = str_array_length1;
					_tmp58_ = i;
					_tmp59_ = _tmp57_[_tmp58_];
					_tmp53_ = (const gchar*) _tmp59_;
				} else {
					_tmp53_ = "";
				}
				_tmp60_ = ptr;
				_tmp61_ = g_stpcpy (_tmp60_, _tmp53_);
				ptr = _tmp61_;
			}
		}
		_tmp62_ = res;
		res = NULL;
		result = (gchar*) _tmp62_;
		return result;
	} else {
		gchar* _tmp63_;
		_tmp63_ = g_strdup ("");
		result = _tmp63_;
		return result;
	}
}


static gchar* vala_gir_writer_camel_case_to_canonical (ValaGIRWriter* self, const gchar* name) {
	gchar* result = NULL;
	gchar** parts = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gint parts_length1;
	gint _parts_size_;
	gchar* _tmp6_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = name;
	_tmp1_ = vala_symbol_camel_case_to_lower_case (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp4_ = _tmp3_ = g_strsplit (_tmp2_, "_", 0);
	_tmp5_ = _tmp4_;
	_tmp5__length1 = _vala_array_length (_tmp3_);
	_g_free0 (_tmp2_);
	parts = _tmp5_;
	parts_length1 = _tmp5__length1;
	_parts_size_ = parts_length1;
	_tmp6_ = _vala_g_strjoinv ("-", parts, parts_length1);
	result = _tmp6_;
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


static gboolean vala_gir_writer_check_accessibility (ValaGIRWriter* self, ValaSymbol* sym) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	ValaSymbol* _tmp1_;
	ValaSymbolAccessibility _tmp2_;
	ValaSymbolAccessibility _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (sym != NULL, FALSE);
	_tmp1_ = sym;
	_tmp2_ = vala_symbol_get_access (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == VALA_SYMBOL_ACCESSIBILITY_PUBLIC) {
		_tmp0_ = TRUE;
	} else {
		ValaSymbol* _tmp4_;
		ValaSymbolAccessibility _tmp5_;
		ValaSymbolAccessibility _tmp6_;
		_tmp4_ = sym;
		_tmp5_ = vala_symbol_get_access (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ == VALA_SYMBOL_ACCESSIBILITY_PROTECTED;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


ValaGIRWriter* vala_gir_writer_construct (GType object_type) {
	ValaGIRWriter* self = NULL;
	self = (ValaGIRWriter*) vala_code_visitor_construct (object_type);
	return self;
}


ValaGIRWriter* vala_gir_writer_new (void) {
	return vala_gir_writer_construct (VALA_TYPE_GIR_WRITER);
}


static void vala_gir_writer_gir_namespace_init (ValaGIRWriterGIRNamespace *self, const gchar* ns, const gchar* version) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (ns != NULL);
	g_return_if_fail (version != NULL);
	memset (self, 0, sizeof (ValaGIRWriterGIRNamespace));
	_tmp0_ = ns;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*self).ns);
	(*self).ns = _tmp1_;
	_tmp2_ = version;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*self).version);
	(*self).version = _tmp3_;
}


static gboolean vala_gir_writer_gir_namespace_equal (ValaGIRWriterGIRNamespace *self, ValaGIRWriterGIRNamespace* g) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	ValaGIRWriterGIRNamespace _tmp2_;
	const gchar* _tmp3_;
	g_return_val_if_fail (g != NULL, FALSE);
	_tmp1_ = (*self).ns;
	_tmp2_ = *g;
	_tmp3_ = _tmp2_.ns;
	if (g_strcmp0 (_tmp1_, _tmp3_) == 0) {
		const gchar* _tmp4_;
		ValaGIRWriterGIRNamespace _tmp5_;
		const gchar* _tmp6_;
		_tmp4_ = (*self).version;
		_tmp5_ = *g;
		_tmp6_ = _tmp5_.version;
		_tmp0_ = g_strcmp0 (_tmp4_, _tmp6_) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}


static void vala_gir_writer_gir_namespace_copy (const ValaGIRWriterGIRNamespace* self, ValaGIRWriterGIRNamespace* dest) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = (*self).ns;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).ns);
	(*dest).ns = _tmp1_;
	_tmp2_ = (*self).version;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).version);
	(*dest).version = _tmp3_;
}


static void vala_gir_writer_gir_namespace_destroy (ValaGIRWriterGIRNamespace* self) {
	_g_free0 ((*self).ns);
	_g_free0 ((*self).version);
}


static ValaGIRWriterGIRNamespace* vala_gir_writer_gir_namespace_dup (const ValaGIRWriterGIRNamespace* self) {
	ValaGIRWriterGIRNamespace* dup;
	dup = g_new0 (ValaGIRWriterGIRNamespace, 1);
	vala_gir_writer_gir_namespace_copy (self, dup);
	return dup;
}


static void vala_gir_writer_gir_namespace_free (ValaGIRWriterGIRNamespace* self) {
	vala_gir_writer_gir_namespace_destroy (self);
	g_free (self);
}


static GType vala_gir_writer_gir_namespace_get_type (void) {
	static volatile gsize vala_gir_writer_gir_namespace_type_id__volatile = 0;
	if (g_once_init_enter (&vala_gir_writer_gir_namespace_type_id__volatile)) {
		GType vala_gir_writer_gir_namespace_type_id;
		vala_gir_writer_gir_namespace_type_id = g_boxed_type_register_static ("ValaGIRWriterGIRNamespace", (GBoxedCopyFunc) vala_gir_writer_gir_namespace_dup, (GBoxedFreeFunc) vala_gir_writer_gir_namespace_free);
		g_once_init_leave (&vala_gir_writer_gir_namespace_type_id__volatile, vala_gir_writer_gir_namespace_type_id);
	}
	return vala_gir_writer_gir_namespace_type_id__volatile;
}


static void vala_gir_writer_class_init (ValaGIRWriterClass * klass) {
	vala_gir_writer_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->finalize = vala_gir_writer_finalize;
	g_type_class_add_private (klass, sizeof (ValaGIRWriterPrivate));
	((ValaGIRWriterClass *) klass)->get_interface_comment = (gchar* (*) (ValaGIRWriter *, ValaInterface*)) vala_gir_writer_real_get_interface_comment;
	((ValaGIRWriterClass *) klass)->get_struct_comment = (gchar* (*) (ValaGIRWriter *, ValaStruct*)) vala_gir_writer_real_get_struct_comment;
	((ValaGIRWriterClass *) klass)->get_enum_comment = (gchar* (*) (ValaGIRWriter *, ValaEnum*)) vala_gir_writer_real_get_enum_comment;
	((ValaGIRWriterClass *) klass)->get_class_comment = (gchar* (*) (ValaGIRWriter *, ValaClass*)) vala_gir_writer_real_get_class_comment;
	((ValaGIRWriterClass *) klass)->get_error_code_comment = (gchar* (*) (ValaGIRWriter *, ValaErrorCode*)) vala_gir_writer_real_get_error_code_comment;
	((ValaGIRWriterClass *) klass)->get_enum_value_comment = (gchar* (*) (ValaGIRWriter *, ValaEnumValue*)) vala_gir_writer_real_get_enum_value_comment;
	((ValaGIRWriterClass *) klass)->get_constant_comment = (gchar* (*) (ValaGIRWriter *, ValaConstant*)) vala_gir_writer_real_get_constant_comment;
	((ValaGIRWriterClass *) klass)->get_error_domain_comment = (gchar* (*) (ValaGIRWriter *, ValaErrorDomain*)) vala_gir_writer_real_get_error_domain_comment;
	((ValaGIRWriterClass *) klass)->get_field_comment = (gchar* (*) (ValaGIRWriter *, ValaField*)) vala_gir_writer_real_get_field_comment;
	((ValaGIRWriterClass *) klass)->get_delegate_comment = (gchar* (*) (ValaGIRWriter *, ValaDelegate*)) vala_gir_writer_real_get_delegate_comment;
	((ValaGIRWriterClass *) klass)->get_method_comment = (gchar* (*) (ValaGIRWriter *, ValaMethod*)) vala_gir_writer_real_get_method_comment;
	((ValaGIRWriterClass *) klass)->get_property_comment = (gchar* (*) (ValaGIRWriter *, ValaProperty*)) vala_gir_writer_real_get_property_comment;
	((ValaGIRWriterClass *) klass)->get_delegate_return_comment = (gchar* (*) (ValaGIRWriter *, ValaDelegate*)) vala_gir_writer_real_get_delegate_return_comment;
	((ValaGIRWriterClass *) klass)->get_signal_return_comment = (gchar* (*) (ValaGIRWriter *, ValaSignal*)) vala_gir_writer_real_get_signal_return_comment;
	((ValaGIRWriterClass *) klass)->get_method_return_comment = (gchar* (*) (ValaGIRWriter *, ValaMethod*)) vala_gir_writer_real_get_method_return_comment;
	((ValaGIRWriterClass *) klass)->get_signal_comment = (gchar* (*) (ValaGIRWriter *, ValaSignal*)) vala_gir_writer_real_get_signal_comment;
	((ValaGIRWriterClass *) klass)->get_parameter_comment = (gchar* (*) (ValaGIRWriter *, ValaParameter*)) vala_gir_writer_real_get_parameter_comment;
	((ValaCodeVisitorClass *) klass)->visit_namespace = (void (*) (ValaCodeVisitor *, ValaNamespace*)) vala_gir_writer_real_visit_namespace;
	((ValaCodeVisitorClass *) klass)->visit_class = (void (*) (ValaCodeVisitor *, ValaClass*)) vala_gir_writer_real_visit_class;
	((ValaCodeVisitorClass *) klass)->visit_struct = (void (*) (ValaCodeVisitor *, ValaStruct*)) vala_gir_writer_real_visit_struct;
	((ValaCodeVisitorClass *) klass)->visit_interface = (void (*) (ValaCodeVisitor *, ValaInterface*)) vala_gir_writer_real_visit_interface;
	((ValaCodeVisitorClass *) klass)->visit_enum = (void (*) (ValaCodeVisitor *, ValaEnum*)) vala_gir_writer_real_visit_enum;
	((ValaCodeVisitorClass *) klass)->visit_enum_value = (void (*) (ValaCodeVisitor *, ValaEnumValue*)) vala_gir_writer_real_visit_enum_value;
	((ValaCodeVisitorClass *) klass)->visit_error_domain = (void (*) (ValaCodeVisitor *, ValaErrorDomain*)) vala_gir_writer_real_visit_error_domain;
	((ValaCodeVisitorClass *) klass)->visit_error_code = (void (*) (ValaCodeVisitor *, ValaErrorCode*)) vala_gir_writer_real_visit_error_code;
	((ValaCodeVisitorClass *) klass)->visit_constant = (void (*) (ValaCodeVisitor *, ValaConstant*)) vala_gir_writer_real_visit_constant;
	((ValaCodeVisitorClass *) klass)->visit_field = (void (*) (ValaCodeVisitor *, ValaField*)) vala_gir_writer_real_visit_field;
	((ValaCodeVisitorClass *) klass)->visit_delegate = (void (*) (ValaCodeVisitor *, ValaDelegate*)) vala_gir_writer_real_visit_delegate;
	((ValaCodeVisitorClass *) klass)->visit_method = (void (*) (ValaCodeVisitor *, ValaMethod*)) vala_gir_writer_real_visit_method;
	((ValaCodeVisitorClass *) klass)->visit_creation_method = (void (*) (ValaCodeVisitor *, ValaCreationMethod*)) vala_gir_writer_real_visit_creation_method;
	((ValaCodeVisitorClass *) klass)->visit_property = (void (*) (ValaCodeVisitor *, ValaProperty*)) vala_gir_writer_real_visit_property;
	((ValaCodeVisitorClass *) klass)->visit_signal = (void (*) (ValaCodeVisitor *, ValaSignal*)) vala_gir_writer_real_visit_signal;
}


static void vala_gir_writer_instance_init (ValaGIRWriter * self) {
	GString* _tmp0_;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	ValaHashSet* _tmp3_;
	GHashFunc _tmp4_;
	GEqualFunc _tmp5_;
	ValaHashSet* _tmp6_;
	GEqualFunc _tmp7_;
	ValaArrayList* _tmp8_;
	GEqualFunc _tmp9_;
	ValaArrayList* _tmp10_;
	ValaArrayList* _tmp11_;
	self->priv = VALA_GIR_WRITER_GET_PRIVATE (self);
	_tmp0_ = g_string_new ("");
	self->priv->buffer = _tmp0_;
	_tmp1_ = g_direct_hash;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_hash_set_new (VALA_TYPE_NAMESPACE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp1_, _tmp2_);
	self->priv->unannotated_namespaces = _tmp3_;
	_tmp4_ = g_direct_hash;
	_tmp5_ = g_direct_equal;
	_tmp6_ = vala_hash_set_new (VALA_TYPE_NAMESPACE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp4_, _tmp5_);
	self->priv->our_namespaces = _tmp6_;
	_tmp7_ = g_direct_equal;
	_tmp8_ = vala_array_list_new (VALA_TYPE_SYMBOL, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp7_);
	self->priv->hierarchy = _tmp8_;
	_tmp9_ = g_direct_equal;
	_tmp10_ = vala_array_list_new (VALA_TYPE_CODE_NODE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp9_);
	self->priv->deferred = _tmp10_;
	_tmp11_ = vala_array_list_new (VALA_GIR_WRITER_TYPE_GIR_NAMESPACE, (GBoxedCopyFunc) vala_gir_writer_gir_namespace_dup, (GDestroyNotify) vala_gir_writer_gir_namespace_free, (GEqualFunc) vala_gir_writer_gir_namespace_equal);
	self->priv->externals = _tmp11_;
}


static void vala_gir_writer_finalize (ValaCodeVisitor * obj) {
	ValaGIRWriter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_GIR_WRITER, ValaGIRWriter);
	_vala_code_context_unref0 (self->priv->context);
	_g_free0 (self->priv->directory);
	_g_free0 (self->priv->gir_namespace);
	_g_free0 (self->priv->gir_version);
	_g_free0 (self->priv->gir_shared_library);
	_g_string_free0 (self->priv->buffer);
	_fclose0 (self->priv->stream);
	_vala_iterable_unref0 (self->priv->unannotated_namespaces);
	_vala_iterable_unref0 (self->priv->our_namespaces);
	_vala_iterable_unref0 (self->priv->hierarchy);
	_vala_iterable_unref0 (self->priv->deferred);
	_vala_code_node_unref0 (self->priv->gobject_type);
	_vala_code_node_unref0 (self->priv->ginitiallyunowned_type);
	_vala_iterable_unref0 (self->priv->externals);
	VALA_CODE_VISITOR_CLASS (vala_gir_writer_parent_class)->finalize (obj);
}


/**
 * Code visitor generating .gir file for the public interface.
 */
GType vala_gir_writer_get_type (void) {
	static volatile gsize vala_gir_writer_type_id__volatile = 0;
	if (g_once_init_enter (&vala_gir_writer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaGIRWriterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_gir_writer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaGIRWriter), 0, (GInstanceInitFunc) vala_gir_writer_instance_init, NULL };
		GType vala_gir_writer_type_id;
		vala_gir_writer_type_id = g_type_register_static (VALA_TYPE_CODE_VISITOR, "ValaGIRWriter", &g_define_type_info, 0);
		g_once_init_leave (&vala_gir_writer_type_id__volatile, vala_gir_writer_type_id);
	}
	return vala_gir_writer_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



