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

/* Copyleft 2014 -- williballenthin */

#include <vala.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <valagee.h>
#include <valacodegen.h>
#include <gobject/gvaluecollector.h>
#include <stdio.h>
#include <glib/gstdio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_VALABIND_WRITER (valabind_writer_get_type ())
#define VALABIND_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VALABIND_WRITER, ValabindWriter))
#define VALABIND_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VALABIND_WRITER, ValabindWriterClass))
#define IS_VALABIND_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VALABIND_WRITER))
#define IS_VALABIND_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VALABIND_WRITER))
#define VALABIND_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VALABIND_WRITER, ValabindWriterClass))

typedef struct _ValabindWriter ValabindWriter;
typedef struct _ValabindWriterClass ValabindWriterClass;
typedef struct _ValabindWriterPrivate ValabindWriterPrivate;

#define TYPE_GENERIC_CLASS_FINDER (generic_class_finder_get_type ())
#define GENERIC_CLASS_FINDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GENERIC_CLASS_FINDER, GenericClassFinder))
#define GENERIC_CLASS_FINDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GENERIC_CLASS_FINDER, GenericClassFinderClass))
#define IS_GENERIC_CLASS_FINDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GENERIC_CLASS_FINDER))
#define IS_GENERIC_CLASS_FINDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GENERIC_CLASS_FINDER))
#define GENERIC_CLASS_FINDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GENERIC_CLASS_FINDER, GenericClassFinderClass))

typedef struct _GenericClassFinder GenericClassFinder;
typedef struct _GenericClassFinderClass GenericClassFinderClass;
typedef struct _GenericClassFinderPrivate GenericClassFinderPrivate;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

#define TYPE_GO_NAMER (go_namer_get_type ())
#define GO_NAMER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GO_NAMER, GoNamer))
#define GO_NAMER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GO_NAMER, GoNamerClass))
#define IS_GO_NAMER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GO_NAMER))
#define IS_GO_NAMER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GO_NAMER))
#define GO_NAMER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GO_NAMER, GoNamerClass))

typedef struct _GoNamer GoNamer;
typedef struct _GoNamerClass GoNamerClass;
typedef struct _GoNamerPrivate GoNamerPrivate;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _ParamSpecGoNamer ParamSpecGoNamer;

#define TYPE_GO_SRC_WRITER (go_src_writer_get_type ())
#define GO_SRC_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GO_SRC_WRITER, GoSrcWriter))
#define GO_SRC_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GO_SRC_WRITER, GoSrcWriterClass))
#define IS_GO_SRC_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GO_SRC_WRITER))
#define IS_GO_SRC_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GO_SRC_WRITER))
#define GO_SRC_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GO_SRC_WRITER, GoSrcWriterClass))

typedef struct _GoSrcWriter GoSrcWriter;
typedef struct _GoSrcWriterClass GoSrcWriterClass;
typedef struct _GoSrcWriterPrivate GoSrcWriterPrivate;
#define _go_namer_unref0(var) ((var == NULL) ? NULL : (var = (go_namer_unref (var), NULL)))
#define _vala_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_reference_unref (var), NULL)))
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))

#define TYPE_GO_WRITER (go_writer_get_type ())
#define GO_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GO_WRITER, GoWriter))
#define GO_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GO_WRITER, GoWriterClass))
#define IS_GO_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GO_WRITER))
#define IS_GO_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GO_WRITER))
#define GO_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GO_WRITER, GoWriterClass))

typedef struct _GoWriter GoWriter;
typedef struct _GoWriterClass GoWriterClass;
typedef struct _GoWriterPrivate GoWriterPrivate;
#define _vala_code_visitor_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_visitor_unref (var), NULL)))

struct _ValabindWriter {
	ValaCodeVisitor parent_instance;
	ValabindWriterPrivate * priv;
	gchar* modulename;
	gchar* library;
	gboolean pkgmode;
	gboolean camelgetters;
	gchar* pkgname;
	gchar** include_dirs;
	gchar** namespaces;
	ValaCodeContext* context;
	gchar* vapidir;
	GList* source_files;
	GList* packages;
	GList* defines;
	gboolean glibmode;
	GList* includefiles;
};

struct _ValabindWriterClass {
	ValaCodeVisitorClass parent_class;
	void (*write) (ValabindWriter* self, const gchar* file);
	gchar* (*get_filename) (ValabindWriter* self, const gchar* base_name);
};

struct _GenericClassFinder {
	ValabindWriter parent_instance;
	GenericClassFinderPrivate * priv;
};

struct _GenericClassFinderClass {
	ValabindWriterClass parent_class;
};

struct _GenericClassFinderPrivate {
	GHashTable* generic_classes;
};

struct _GoNamer {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GoNamerPrivate * priv;
	gboolean needs_unsafe;
};

struct _GoNamerClass {
	GTypeClass parent_class;
	void (*finalize) (GoNamer *self);
};

struct _GoNamerPrivate {
	gchar* pfx;
	GHashTable* specializations;
	GList* ordered_specializations;
};

struct _ParamSpecGoNamer {
	GParamSpec parent_instance;
};

struct _GoSrcWriter {
	ValabindWriter parent_instance;
	GoSrcWriterPrivate * priv;
};

struct _GoSrcWriterClass {
	ValabindWriterClass parent_class;
};

struct _GoSrcWriterPrivate {
	GHashTable* defined_classes;
	GHashTable* generic_classes;
	gchar* classname;
	gchar* classcname;
	gchar* defs;
	gchar* statics;
	gchar* extends;
	gchar* enums;
	gchar* nspace;
	gboolean needs_unsafe;
	gboolean needs_runtime;
	gchar* _indent;
};

struct _GoWriter {
	ValabindWriter parent_instance;
	GoWriterPrivate * priv;
};

struct _GoWriterClass {
	ValabindWriterClass parent_class;
};

static gint GenericClassFinder_private_offset;
static gpointer generic_class_finder_parent_class = NULL;
static gint GoNamer_private_offset;
static gpointer go_namer_parent_class = NULL;
static gint GoSrcWriter_private_offset;
static gpointer go_src_writer_parent_class = NULL;
static gpointer go_writer_parent_class = NULL;

VALA_EXTERN GType valabind_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ValabindWriter, vala_code_visitor_unref)
VALA_EXTERN GType generic_class_finder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GenericClassFinder, vala_code_visitor_unref)
VALA_EXTERN void valabind_writer_write (ValabindWriter* self,
                            const gchar* file);
static void _g_free0_ (gpointer var);
static void _g_hash_table_unref0_ (gpointer var);
static inline gboolean generic_class_finder_is_generic (GenericClassFinder* self,
                                          ValaDataType* d);
static inline gboolean generic_class_finder_is_glib (GenericClassFinder* self,
                                       ValaDataType* d);
static inline gchar* generic_class_finder_get_class_name (GenericClassFinder* self,
                                            ValaDataType* d);
static inline gchar* generic_class_finder_strip_namespace (GenericClassFinder* self,
                                             const gchar* s);
static void generic_class_finder_real_visit_data_type (ValaCodeVisitor* base,
                                                ValaDataType* d);
static void _vala_code_node_unref0_ (gpointer var);
static inline void _g_list_free__vala_code_node_unref0_ (GList* self);
static void __g_list_free__vala_code_node_unref0_0_ (gpointer var);
static void generic_class_finder_real_visit_method (ValaCodeVisitor* base,
                                             ValaMethod* m);
static void generic_class_finder_real_visit_field (ValaCodeVisitor* base,
                                            ValaField* f);
static void generic_class_finder_real_visit_source_file (ValaCodeVisitor* base,
                                                  ValaSourceFile* source);
static void generic_class_finder_real_visit_namespace (ValaCodeVisitor* base,
                                                ValaNamespace* ns);
static void generic_class_finder_real_visit_class (ValaCodeVisitor* base,
                                            ValaClass* c);
static void generic_class_finder_real_write (ValabindWriter* base,
                                      const gchar* file);
VALA_EXTERN GHashTable* generic_class_finder_get_generic_class_instances (GenericClassFinder* self);
VALA_EXTERN GenericClassFinder* generic_class_finder_new (void);
VALA_EXTERN GenericClassFinder* generic_class_finder_construct (GType object_type);
VALA_EXTERN ValabindWriter* valabind_writer_new (void);
VALA_EXTERN ValabindWriter* valabind_writer_construct (GType object_type);
static void generic_class_finder_finalize (ValaCodeVisitor * obj);
static GType generic_class_finder_get_type_once (void);
VALA_EXTERN gpointer go_namer_ref (gpointer instance);
VALA_EXTERN void go_namer_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_go_namer (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_go_namer (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_go_namer (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_go_namer (const GValue* value);
VALA_EXTERN GType go_namer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GoNamer, go_namer_unref)
VALA_EXTERN GoNamer* go_namer_new (const gchar* pfx);
VALA_EXTERN GoNamer* go_namer_construct (GType object_type,
                             const gchar* pfx);
VALA_EXTERN void go_namer_add_specialization (GoNamer* self,
                                  ValaTypeParameter* t,
                                  ValaDataType* d);
static gchar* go_namer_cleanup_underscores (const gchar* name);
static gchar* go_namer_camelcase (const gchar* name);
VALA_EXTERN gchar* go_namer_get_field_name (GoNamer* self,
                                ValaField* f);
VALA_EXTERN gchar* go_namer_get_field_cname (GoNamer* self,
                                 ValaField* f);
VALA_EXTERN gchar* go_namer_get_method_name (GoNamer* self,
                                 ValaMethod* m);
VALA_EXTERN gchar* go_namer_get_method_cname (GoNamer* self,
                                  ValaMethod* m);
VALA_EXTERN gchar* go_namer_get_parameter_name (GoNamer* self,
                                    ValaParameter* p);
VALA_EXTERN gchar* go_namer_get_enum_name (GoNamer* self,
                               ValaEnum* e);
VALA_EXTERN gchar* go_namer_get_enum_value_name (GoNamer* self,
                                     ValaEnumValue* v);
VALA_EXTERN gchar* go_namer_get_enum_value_cname (GoNamer* self,
                                      ValaEnumValue* v);
VALA_EXTERN gchar* go_namer_get_constructor_name (GoNamer* self,
                                      ValaClass* c,
                                      ValaMethod* m);
VALA_EXTERN gchar* go_namer_get_class_name (GoNamer* self,
                                ValaClass* c);
static gchar* go_namer_mangle_datatype (GoNamer* self,
                                 ValaDataType* d);
VALA_EXTERN gchar* go_namer_get_specialized_type_declaration (GoNamer* self,
                                                  ValaDataType* d);
VALA_EXTERN gchar* go_namer_get_class_cname (GoNamer* self,
                                 ValaClass* c);
VALA_EXTERN gchar* go_namer_get_struct_name (GoNamer* self,
                                 ValaStruct* s);
VALA_EXTERN gchar* go_namer_get_struct_cname (GoNamer* self,
                                  ValaStruct* s);
VALA_EXTERN gchar* go_namer_get_namespace_name (GoNamer* self,
                                    ValaNamespace* ns);
static inline gboolean go_namer_is_generic (GoNamer* self,
                              const gchar* type);
static gchar* go_namer_get_ctype (GoNamer* self,
                           const gchar* _type);
VALA_EXTERN void error (const gchar* msg);
static gchar* go_namer_get_cgo_cast_type (GoNamer* self,
                                   const gchar* _type);
static gchar* go_namer_extract_basic_type_name (GoNamer* self,
                                         const gchar* type_str);
static inline gchar* go_namer_strip_non_class_name (GoNamer* self,
                                      const gchar* s);
static inline gchar* go_namer_strip_namespace (GoNamer* self,
                                 const gchar* s);
static gchar* go_namer_get_type_declaration (GoNamer* self,
                                      ValaDataType* type);
VALA_EXTERN gchar* go_namer_get_field_type_declaration (GoNamer* self,
                                            ValaField* f);
VALA_EXTERN gchar* go_namer_get_parameter_type_declaration (GoNamer* self,
                                                ValaParameter* p);
VALA_EXTERN gchar* go_namer_get_method_return_type_declaration (GoNamer* self,
                                                    ValaMethod* m);
VALA_EXTERN gchar* go_namer_get_param_c_expr (GoNamer* self,
                                  const gchar* go_expr,
                                  ValaParameter* p);
VALA_EXTERN gchar* go_namer_wrap_return_to_go (GoNamer* self,
                                   const gchar* c_expr,
                                   ValaMethod* m);
VALA_EXTERN gchar* go_namer_get_field_cgo_cast (GoNamer* self,
                                    ValaField* f);
static void go_namer_finalize (GoNamer * obj);
static GType go_namer_get_type_once (void);
VALA_EXTERN GType go_src_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GoSrcWriter, vala_code_visitor_unref)
VALA_EXTERN GoSrcWriter* go_src_writer_new (void);
VALA_EXTERN GoSrcWriter* go_src_writer_construct (GType object_type);
static void go_src_writer_debug (GoSrcWriter* self,
                          const gchar* s);
VALA_EXTERN void notice (const gchar* msg);
static void go_src_writer_indent (GoSrcWriter* self);
static void go_src_writer_dedent (GoSrcWriter* self);
VALA_EXTERN void go_src_writer_set_generic_class_instances (GoSrcWriter* self,
                                                GHashTable* generic_classes);
static gboolean go_src_writer_is_target_file (GoSrcWriter* self,
                                       const gchar* path);
static void go_src_writer_real_visit_source_file (ValaCodeVisitor* base,
                                           ValaSourceFile* source);
static void go_src_writer_process_includes (GoSrcWriter* self,
                                     ValaSymbol* s);
static gboolean go_src_writer_is_string (GoSrcWriter* self,
                                  ValaCodeNode* t);
VALA_EXTERN void warning (const gchar* msg);
static gchar* go_src_writer_walk_field (GoSrcWriter* self,
                                 GoNamer* namer,
                                 const gchar* owner_name,
                                 ValaField* f);
static gchar* go_src_writer_walk_class_field (GoSrcWriter* self,
                                       GoNamer* namer,
                                       ValaClass* c,
                                       ValaField* f);
static gchar* go_src_writer_walk_struct_field (GoSrcWriter* self,
                                        GoNamer* namer,
                                        ValaStruct* s,
                                        ValaField* f);
static gchar* go_src_writer_walk_namespace_field (GoSrcWriter* self,
                                           GoNamer* namer,
                                           ValaNamespace* ns,
                                           ValaField* f);
static gchar* go_src_writer_walk_struct (GoSrcWriter* self,
                                  GoNamer* namer,
                                  ValaStruct* s);
static gchar* go_src_writer_walk_enum (GoSrcWriter* self,
                                GoNamer* namer,
                                ValaEnum* e);
static gchar* go_src_writer_get_parameter_pointer_symbol (GoSrcWriter* self,
                                                   ValaParameter* p);
static gchar* go_src_writer_get_function_declaration_parameters (GoSrcWriter* self,
                                                          GoNamer* namer,
                                                          ValaMethod* f);
static gchar* go_src_writer_get_function_call_parameters (GoSrcWriter* self,
                                                   GoNamer* namer,
                                                   ValaMethod* f,
                                                   gchar** preamble);
static gboolean go_src_writer_is_void_function (GoSrcWriter* self,
                                         ValaMethod* f);
static gchar* go_src_writer_walk_function (GoSrcWriter* self,
                                    GoNamer* namer,
                                    ValaNamespace* ns,
                                    ValaMethod* f);
static gchar* go_src_writer_walk_method (GoSrcWriter* self,
                                  GoNamer* namer,
                                  ValaClass* c,
                                  ValaMethod* m);
static gchar* go_src_writer_walk_constructor (GoSrcWriter* self,
                                       GoNamer* namer,
                                       ValaClass* c,
                                       ValaMethod* m,
                                       const gchar* free_function);
static gchar* go_src_writer_get_class_src (GoSrcWriter* self,
                                    GoNamer* namer,
                                    ValaClass* c);
static gchar* go_src_writer_walk_class (GoSrcWriter* self,
                                 ValaClass* c);
static void go_src_writer_real_visit_namespace (ValaCodeVisitor* base,
                                         ValaNamespace* ns);
static void go_src_writer_real_write (ValabindWriter* base,
                               const gchar* file);
static void go_src_writer_finalize (ValaCodeVisitor * obj);
static GType go_src_writer_get_type_once (void);
VALA_EXTERN GType go_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GoWriter, vala_code_visitor_unref)
VALA_EXTERN gchar* valabind_writer_get_filename (ValabindWriter* self,
                                     const gchar* base_name);
VALA_EXTERN GoWriter* go_writer_new (void);
VALA_EXTERN GoWriter* go_writer_construct (GType object_type);
static gchar* go_writer_real_get_filename (ValabindWriter* base,
                                    const gchar* base_name);
static void go_writer_clone_writer_config (GoWriter* self,
                                    ValabindWriter* w);
static gchar** _vala_array_dup3 (gchar** self,
                          gssize length);
static gchar** _vala_array_dup4 (gchar** self,
                          gssize length);
VALA_EXTERN void valabind_writer_init (ValabindWriter* self,
                           const gchar* vapidir,
                           gboolean glibmode);
VALA_EXTERN gboolean valabind_writer_add_external_package (ValabindWriter* self,
                                               const gchar* pkg);
VALA_EXTERN void valabind_writer_add_define (ValabindWriter* self,
                                 const gchar* define);
VALA_EXTERN gboolean valabind_writer_add_source_file (ValabindWriter* self,
                                          const gchar* path);
static void go_writer_real_write (ValabindWriter* base,
                           const gchar* file);
VALA_EXTERN void valabind_writer_parse (ValabindWriter* self);
static GType go_writer_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
generic_class_finder_get_instance_private (GenericClassFinder* self)
{
	return G_STRUCT_MEMBER_P (self, GenericClassFinder_private_offset);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_g_hash_table_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
}

static inline gboolean
generic_class_finder_is_generic (GenericClassFinder* self,
                                 ValaDataType* d)
{
	ValaList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (d != NULL, FALSE);
	_tmp0_ = vala_data_type_get_type_arguments (d);
	_tmp1_ = vala_collection_get_size ((ValaCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ > 0;
	return result;
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static inline gboolean
generic_class_finder_is_glib (GenericClassFinder* self,
                              ValaDataType* d)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (d != NULL, FALSE);
	_tmp0_ = vala_code_node_to_string ((ValaCodeNode*) d);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_index_of (_tmp1_, "GLib.", 0) != -1;
	_g_free0 (_tmp1_);
	result = _tmp2_;
	return result;
}

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

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gint
string_index_of_char (const gchar* self,
                      gunichar c,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_strchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static inline gchar*
generic_class_finder_get_class_name (GenericClassFinder* self,
                                     ValaDataType* d)
{
	gchar* s = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (d != NULL, NULL);
	_tmp0_ = vala_code_node_to_string ((ValaCodeNode*) d);
	s = _tmp0_;
	_tmp1_ = string_substring (s, (glong) 0, (glong) string_index_of_char (s, (gunichar) '<', 0));
	result = _tmp1_;
	_g_free0 (s);
	return result;
}

static gint
string_last_index_of_char (const gchar* self,
                           gunichar c,
                           gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_strrchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static inline gchar*
generic_class_finder_strip_namespace (GenericClassFinder* self,
                                      const gchar* s)
{
	gint i1 = 0;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	i1 = string_last_index_of_char (s, (gunichar) '.', 0) + 1;
	_tmp0_ = string_substring (s, (glong) i1, (glong) -1);
	result = _tmp0_;
	return result;
}

static void
_vala_code_node_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL));
}

static inline void
_g_list_free__vala_code_node_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _vala_code_node_unref0_);
}

static void
__g_list_free__vala_code_node_unref0_0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_g_list_free__vala_code_node_unref0_ (var), NULL));
}

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

static void
generic_class_finder_real_visit_data_type (ValaCodeVisitor* base,
                                           ValaDataType* d)
{
	GenericClassFinder * self;
	gboolean _tmp0_ = FALSE;
	self = (GenericClassFinder*) base;
	g_return_if_fail (d != NULL);
	if (generic_class_finder_is_generic (self, d)) {
		_tmp0_ = !generic_class_finder_is_glib (self, d);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* c = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GHashTable* inner_set = NULL;
		GHashTable* _tmp5_;
		const gchar* _tmp6_;
		gconstpointer _tmp7_;
		GHashTable* _tmp8_;
		GList* args = NULL;
		GHashTable* _tmp26_;
		gchar* _tmp27_;
		GList* _tmp28_;
		_tmp1_ = generic_class_finder_get_class_name (self, d);
		_tmp2_ = _tmp1_;
		_tmp3_ = generic_class_finder_strip_namespace (self, _tmp2_);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		c = _tmp4_;
		_tmp5_ = self->priv->generic_classes;
		_tmp6_ = c;
		_tmp7_ = g_hash_table_lookup (_tmp5_, _tmp6_);
		inner_set = (GHashTable*) _tmp7_;
		_tmp8_ = inner_set;
		if (_tmp8_ == NULL) {
			GHashTable* v = NULL;
			GHashFunc _tmp9_;
			GEqualFunc _tmp10_;
			GHashTable* _tmp11_;
			GHashTable* _tmp12_;
			GHashTable* _tmp13_;
			gchar* _tmp14_;
			GHashTable* _tmp15_;
			_tmp9_ = g_str_hash;
			_tmp10_ = g_str_equal;
			_tmp11_ = g_hash_table_new_full (_tmp9_, _tmp10_, _g_free0_, __g_list_free__vala_code_node_unref0_0_);
			v = _tmp11_;
			_tmp12_ = v;
			inner_set = _tmp12_;
			_tmp13_ = self->priv->generic_classes;
			_tmp14_ = c;
			c = NULL;
			_tmp15_ = v;
			v = NULL;
			g_hash_table_insert (_tmp13_, _tmp14_, _tmp15_);
			_g_hash_table_unref0 (v);
		}
		args = NULL;
		{
			ValaList* _t_list = NULL;
			ValaList* _tmp16_;
			gint _t_size = 0;
			ValaList* _tmp17_;
			gint _tmp18_;
			gint _tmp19_;
			gint _t_index = 0;
			_tmp16_ = vala_data_type_get_type_arguments (d);
			_t_list = _tmp16_;
			_tmp17_ = _t_list;
			_tmp18_ = vala_collection_get_size ((ValaCollection*) _tmp17_);
			_tmp19_ = _tmp18_;
			_t_size = _tmp19_;
			_t_index = -1;
			while (TRUE) {
				gint _tmp20_;
				gint _tmp21_;
				ValaDataType* t = NULL;
				ValaList* _tmp22_;
				gpointer _tmp23_;
				ValaDataType* _tmp24_;
				ValaDataType* _tmp25_;
				_t_index = _t_index + 1;
				_tmp20_ = _t_index;
				_tmp21_ = _t_size;
				if (!(_tmp20_ < _tmp21_)) {
					break;
				}
				_tmp22_ = _t_list;
				_tmp23_ = vala_list_get (_tmp22_, _t_index);
				t = (ValaDataType*) _tmp23_;
				_tmp24_ = t;
				_tmp25_ = _vala_code_node_ref0 (_tmp24_);
				args = g_list_append (args, _tmp25_);
				_vala_code_node_unref0 (t);
			}
		}
		_tmp26_ = inner_set;
		_tmp27_ = vala_code_node_to_string ((ValaCodeNode*) d);
		_tmp28_ = args;
		args = NULL;
		g_hash_table_replace (_tmp26_, _tmp27_, _tmp28_);
		(args == NULL) ? NULL : (args = (_g_list_free__vala_code_node_unref0_ (args), NULL));
		_g_free0 (c);
	}
}

static void
generic_class_finder_real_visit_method (ValaCodeVisitor* base,
                                        ValaMethod* m)
{
	GenericClassFinder * self;
	self = (GenericClassFinder*) base;
	g_return_if_fail (m != NULL);
	vala_code_node_accept_children ((ValaCodeNode*) m, (ValaCodeVisitor*) self);
}

static void
generic_class_finder_real_visit_field (ValaCodeVisitor* base,
                                       ValaField* f)
{
	GenericClassFinder * self;
	self = (GenericClassFinder*) base;
	g_return_if_fail (f != NULL);
	vala_code_node_accept_children ((ValaCodeNode*) f, (ValaCodeVisitor*) self);
}

static void
generic_class_finder_real_visit_source_file (ValaCodeVisitor* base,
                                             ValaSourceFile* source)
{
	GenericClassFinder * self;
	self = (GenericClassFinder*) base;
	g_return_if_fail (source != NULL);
	vala_source_file_accept_children (source, (ValaCodeVisitor*) self);
}

static void
generic_class_finder_real_visit_namespace (ValaCodeVisitor* base,
                                           ValaNamespace* ns)
{
	GenericClassFinder * self;
	self = (GenericClassFinder*) base;
	g_return_if_fail (ns != NULL);
	vala_code_node_accept_children ((ValaCodeNode*) ns, (ValaCodeVisitor*) self);
}

static void
generic_class_finder_real_visit_class (ValaCodeVisitor* base,
                                       ValaClass* c)
{
	GenericClassFinder * self;
	self = (GenericClassFinder*) base;
	g_return_if_fail (c != NULL);
	vala_code_node_accept_children ((ValaCodeNode*) c, (ValaCodeVisitor*) self);
}

static void
generic_class_finder_real_write (ValabindWriter* base,
                                 const gchar* file)
{
	GenericClassFinder * self;
	ValaCodeContext* _tmp0_;
	self = (GenericClassFinder*) base;
	g_return_if_fail (file != NULL);
	_tmp0_ = ((ValabindWriter*) self)->context;
	vala_code_context_accept (_tmp0_, (ValaCodeVisitor*) self);
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

GHashTable*
generic_class_finder_get_generic_class_instances (GenericClassFinder* self)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	GHashTable* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->generic_classes;
	_tmp1_ = _g_hash_table_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

GenericClassFinder*
generic_class_finder_construct (GType object_type)
{
	GenericClassFinder* self = NULL;
	self = (GenericClassFinder*) valabind_writer_construct (object_type);
	return self;
}

GenericClassFinder*
generic_class_finder_new (void)
{
	return generic_class_finder_construct (TYPE_GENERIC_CLASS_FINDER);
}

static void
generic_class_finder_class_init (GenericClassFinderClass * klass,
                                 gpointer klass_data)
{
	generic_class_finder_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->finalize = generic_class_finder_finalize;
	g_type_class_adjust_private_offset (klass, &GenericClassFinder_private_offset);
	((ValaCodeVisitorClass *) klass)->visit_data_type = (void (*) (ValaCodeVisitor*, ValaDataType*)) generic_class_finder_real_visit_data_type;
	((ValaCodeVisitorClass *) klass)->visit_method = (void (*) (ValaCodeVisitor*, ValaMethod*)) generic_class_finder_real_visit_method;
	((ValaCodeVisitorClass *) klass)->visit_field = (void (*) (ValaCodeVisitor*, ValaField*)) generic_class_finder_real_visit_field;
	((ValaCodeVisitorClass *) klass)->visit_source_file = (void (*) (ValaCodeVisitor*, ValaSourceFile*)) generic_class_finder_real_visit_source_file;
	((ValaCodeVisitorClass *) klass)->visit_namespace = (void (*) (ValaCodeVisitor*, ValaNamespace*)) generic_class_finder_real_visit_namespace;
	((ValaCodeVisitorClass *) klass)->visit_class = (void (*) (ValaCodeVisitor*, ValaClass*)) generic_class_finder_real_visit_class;
	((ValabindWriterClass *) klass)->write = (void (*) (ValabindWriter*, const gchar*)) generic_class_finder_real_write;
}

static void
generic_class_finder_instance_init (GenericClassFinder * self,
                                    gpointer klass)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	self->priv = generic_class_finder_get_instance_private (self);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_hash_table_unref0_);
	self->priv->generic_classes = _tmp2_;
}

static void
generic_class_finder_finalize (ValaCodeVisitor * obj)
{
	GenericClassFinder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GENERIC_CLASS_FINDER, GenericClassFinder);
	_g_hash_table_unref0 (self->priv->generic_classes);
	VALA_CODE_VISITOR_CLASS (generic_class_finder_parent_class)->finalize (obj);
}

static GType
generic_class_finder_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GenericClassFinderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) generic_class_finder_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GenericClassFinder), 0, (GInstanceInitFunc) generic_class_finder_instance_init, NULL };
	GType generic_class_finder_type_id;
	generic_class_finder_type_id = g_type_register_static (TYPE_VALABIND_WRITER, "GenericClassFinder", &g_define_type_info, 0);
	GenericClassFinder_private_offset = g_type_add_instance_private (generic_class_finder_type_id, sizeof (GenericClassFinderPrivate));
	return generic_class_finder_type_id;
}

GType
generic_class_finder_get_type (void)
{
	static volatile gsize generic_class_finder_type_id__once = 0;
	if (g_once_init_enter (&generic_class_finder_type_id__once)) {
		GType generic_class_finder_type_id;
		generic_class_finder_type_id = generic_class_finder_get_type_once ();
		g_once_init_leave (&generic_class_finder_type_id__once, generic_class_finder_type_id);
	}
	return generic_class_finder_type_id__once;
}

static inline gpointer
go_namer_get_instance_private (GoNamer* self)
{
	return G_STRUCT_MEMBER_P (self, GoNamer_private_offset);
}

GoNamer*
go_namer_construct (GType object_type,
                    const gchar* pfx)
{
	GoNamer* self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (pfx != NULL, NULL);
	self = (GoNamer*) g_type_create_instance (object_type);
	_tmp0_ = g_strdup (pfx);
	_g_free0 (self->priv->pfx);
	self->priv->pfx = _tmp0_;
	return self;
}

GoNamer*
go_namer_new (const gchar* pfx)
{
	return go_namer_construct (TYPE_GO_NAMER, pfx);
}

void
go_namer_add_specialization (GoNamer* self,
                             ValaTypeParameter* t,
                             ValaDataType* d)
{
	GHashTable* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	ValaDataType* _tmp4_;
	ValaDataType* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (t != NULL);
	g_return_if_fail (d != NULL);
	_tmp0_ = self->priv->specializations;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) t);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = _vala_code_node_ref0 (d);
	g_hash_table_insert (_tmp0_, _tmp3_, _tmp4_);
	_tmp5_ = _vala_code_node_ref0 (d);
	self->priv->ordered_specializations = g_list_append (self->priv->ordered_specializations, _tmp5_);
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static gchar*
go_namer_cleanup_underscores (const gchar* name)
{
	gint _tmp0_;
	gint _tmp1_;
	gchar* result;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = strlen (name);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == 0) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("");
		result = _tmp2_;
		return result;
	} else {
		gint _tmp3_;
		gint _tmp4_;
		_tmp3_ = strlen (name);
		_tmp4_ = _tmp3_;
		if (_tmp4_ == 1) {
			gchar* _tmp5_;
			_tmp5_ = g_strdup (name);
			result = _tmp5_;
			return result;
		} else {
			if (string_index_of (name, "_", 0) == -1) {
				gchar* _tmp6_;
				_tmp6_ = g_strdup (name);
				result = _tmp6_;
				return result;
			} else {
				gint i = 0;
				gint _tmp7_;
				gint _tmp8_;
				gchar* before = NULL;
				gchar* _tmp10_;
				gchar* next = NULL;
				gint j = 0;
				gint _tmp20_;
				gint _tmp21_;
				i = string_index_of (name, "_", 0);
				_tmp7_ = strlen (name);
				_tmp8_ = _tmp7_;
				if (i == (_tmp8_ - 1)) {
					gchar* _tmp9_;
					_tmp9_ = g_strdup (name);
					result = _tmp9_;
					return result;
				}
				_tmp10_ = g_strdup ("");
				before = _tmp10_;
				if (i != 0) {
					gchar* _tmp11_;
					_tmp11_ = string_substring (name, (glong) 0, (glong) i);
					_g_free0 (before);
					before = _tmp11_;
				}
				j = i + 1;
				while (TRUE) {
					gchar* _tmp12_;
					gint _tmp16_;
					gint _tmp17_;
					gint _tmp18_;
					_tmp12_ = string_substring (name, (glong) 0, (glong) i);
					_g_free0 (before);
					before = _tmp12_;
					if (string_get (name, (glong) j) != '_') {
						gchar* _tmp13_;
						gchar* _tmp14_;
						gchar* _tmp15_;
						_tmp13_ = string_substring (name, (glong) j, (glong) 1);
						_tmp14_ = _tmp13_;
						_tmp15_ = g_utf8_strup (_tmp14_, (gssize) -1);
						_g_free0 (next);
						next = _tmp15_;
						_g_free0 (_tmp14_);
						break;
					}
					_tmp16_ = j;
					j = _tmp16_ + 1;
					_tmp17_ = strlen (name);
					_tmp18_ = _tmp17_;
					if (j == _tmp18_) {
						gchar* _tmp19_;
						_tmp19_ = string_substring (name, (glong) i, (glong) (j - i));
						_g_free0 (next);
						next = _tmp19_;
						break;
					}
				}
				_tmp20_ = strlen (name);
				_tmp21_ = _tmp20_;
				if (j >= (_tmp21_ - 1)) {
					const gchar* _tmp22_;
					const gchar* _tmp23_;
					gchar* _tmp24_;
					_tmp22_ = before;
					_tmp23_ = next;
					_tmp24_ = g_strconcat (_tmp22_, _tmp23_, NULL);
					result = _tmp24_;
					_g_free0 (next);
					_g_free0 (before);
					return result;
				} else {
					const gchar* _tmp25_;
					const gchar* _tmp26_;
					gchar* _tmp27_;
					gchar* _tmp28_;
					gchar* _tmp29_;
					gchar* _tmp30_;
					gchar* _tmp31_;
					gchar* _tmp32_;
					gchar* _tmp33_;
					gchar* _tmp34_;
					_tmp25_ = before;
					_tmp26_ = next;
					_tmp27_ = g_strconcat (_tmp25_, _tmp26_, NULL);
					_tmp28_ = _tmp27_;
					_tmp29_ = string_substring (name, (glong) (j + 1), (glong) -1);
					_tmp30_ = _tmp29_;
					_tmp31_ = go_namer_cleanup_underscores (_tmp30_);
					_tmp32_ = _tmp31_;
					_tmp33_ = g_strconcat (_tmp28_, _tmp32_, NULL);
					_tmp34_ = _tmp33_;
					_g_free0 (_tmp32_);
					_g_free0 (_tmp30_);
					_g_free0 (_tmp28_);
					result = _tmp34_;
					_g_free0 (next);
					_g_free0 (before);
					return result;
				}
				_g_free0 (next);
				_g_free0 (before);
			}
		}
	}
}

static gchar*
go_namer_camelcase (const gchar* name)
{
	gint _tmp0_;
	gint _tmp1_;
	gchar* result;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = strlen (name);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == 0) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("");
		result = _tmp2_;
		return result;
	} else {
		gint _tmp3_;
		gint _tmp4_;
		_tmp3_ = strlen (name);
		_tmp4_ = _tmp3_;
		if (_tmp4_ == 1) {
			gchar* _tmp5_;
			_tmp5_ = g_utf8_strup (name, (gssize) -1);
			result = _tmp5_;
			return result;
		} else {
			gchar* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			gchar* _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			_tmp6_ = string_substring (name, (glong) 0, (glong) 1);
			_tmp7_ = _tmp6_;
			_tmp8_ = g_utf8_strup (_tmp7_, (gssize) -1);
			_tmp9_ = _tmp8_;
			_tmp10_ = strlen (name);
			_tmp11_ = _tmp10_;
			_tmp12_ = string_substring (name, (glong) 1, (glong) (_tmp11_ - 1));
			_tmp13_ = _tmp12_;
			_tmp14_ = go_namer_cleanup_underscores (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = g_strconcat (_tmp9_, _tmp15_, NULL);
			_tmp17_ = _tmp16_;
			_g_free0 (_tmp15_);
			_g_free0 (_tmp13_);
			_g_free0 (_tmp9_);
			_g_free0 (_tmp7_);
			result = _tmp17_;
			return result;
		}
	}
}

gchar*
go_namer_get_field_name (GoNamer* self,
                         ValaField* f)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) f);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_namer_camelcase (_tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_field_cname (GoNamer* self,
                          ValaField* f)
{
	gchar* n = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) f);
	n = _tmp0_;
	_tmp1_ = n;
	if (g_strcmp0 (_tmp1_, "type") == 0) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("_type");
		result = _tmp2_;
		_g_free0 (n);
		return result;
	} else {
		result = n;
		return result;
	}
}

gchar*
go_namer_get_method_name (GoNamer* self,
                          ValaMethod* m)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) m);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_namer_camelcase (_tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_method_cname (GoNamer* self,
                           ValaMethod* m)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) m);
	result = _tmp0_;
	return result;
}

gchar*
go_namer_get_parameter_name (GoNamer* self,
                             ValaParameter* p)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (p != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) p);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_namer_camelcase (_tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_enum_name (GoNamer* self,
                        ValaEnum* e)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (e != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) e);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_enum_value_name (GoNamer* self,
                              ValaEnumValue* v)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (v != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) v);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_enum_value_cname (GoNamer* self,
                               ValaEnumValue* v)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (v != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) v);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_constructor_name (GoNamer* self,
                               ValaClass* c,
                               ValaMethod* m)
{
	gchar* postfix = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	_tmp0_ = g_strdup ("");
	postfix = _tmp0_;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) m);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, ".new") != 0) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = vala_symbol_get_name ((ValaSymbol*) m);
		_tmp4_ = _tmp3_;
		_tmp5_ = go_namer_camelcase (_tmp4_);
		_g_free0 (postfix);
		postfix = _tmp5_;
	}
	_tmp6_ = go_namer_get_class_name (self, c);
	_tmp7_ = _tmp6_;
	_tmp8_ = postfix;
	_tmp9_ = g_strdup_printf ("New%s%s", _tmp7_, _tmp8_);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp7_);
	result = _tmp10_;
	_g_free0 (postfix);
	return result;
}

static gchar*
go_namer_mangle_datatype (GoNamer* self,
                          ValaDataType* d)
{
	gchar* dname = NULL;
	gchar* _tmp0_;
	GHashTable* _tmp1_;
	const gchar* _tmp2_;
	gconstpointer _tmp3_;
	ValaTypeSymbol* _tmp8_;
	ValaTypeSymbol* _tmp9_;
	gchar* ret = NULL;
	ValaTypeSymbol* _tmp10_;
	ValaTypeSymbol* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	ValaList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (d != NULL, NULL);
	_tmp0_ = vala_code_node_to_string ((ValaCodeNode*) d);
	dname = _tmp0_;
	_tmp1_ = self->priv->specializations;
	_tmp2_ = dname;
	_tmp3_ = g_hash_table_lookup (_tmp1_, _tmp2_);
	if (((ValaDataType*) _tmp3_) != NULL) {
		GHashTable* _tmp4_;
		const gchar* _tmp5_;
		gconstpointer _tmp6_;
		gchar* _tmp7_;
		_tmp4_ = self->priv->specializations;
		_tmp5_ = dname;
		_tmp6_ = g_hash_table_lookup (_tmp4_, _tmp5_);
		_tmp7_ = go_namer_mangle_datatype (self, (ValaDataType*) _tmp6_);
		result = _tmp7_;
		_g_free0 (dname);
		return result;
	}
	_tmp8_ = vala_data_type_get_type_symbol (d);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == NULL) {
		result = dname;
		return result;
	}
	_tmp10_ = vala_data_type_get_type_symbol (d);
	_tmp11_ = _tmp10_;
	_tmp12_ = vala_symbol_get_name ((ValaSymbol*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strdup (_tmp13_);
	ret = _tmp14_;
	_tmp15_ = vala_data_type_get_type_arguments (d);
	_tmp16_ = vala_collection_get_size ((ValaCollection*) _tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ > 0) {
		{
			ValaList* _dd_list = NULL;
			ValaList* _tmp18_;
			gint _dd_size = 0;
			ValaList* _tmp19_;
			gint _tmp20_;
			gint _tmp21_;
			gint _dd_index = 0;
			_tmp18_ = vala_data_type_get_type_arguments (d);
			_dd_list = _tmp18_;
			_tmp19_ = _dd_list;
			_tmp20_ = vala_collection_get_size ((ValaCollection*) _tmp19_);
			_tmp21_ = _tmp20_;
			_dd_size = _tmp21_;
			_dd_index = -1;
			while (TRUE) {
				gint _tmp22_;
				gint _tmp23_;
				ValaDataType* dd = NULL;
				ValaList* _tmp24_;
				gpointer _tmp25_;
				const gchar* _tmp26_;
				gchar* _tmp27_;
				const gchar* _tmp28_;
				ValaDataType* _tmp29_;
				gchar* _tmp30_;
				gchar* _tmp31_;
				gchar* _tmp32_;
				_dd_index = _dd_index + 1;
				_tmp22_ = _dd_index;
				_tmp23_ = _dd_size;
				if (!(_tmp22_ < _tmp23_)) {
					break;
				}
				_tmp24_ = _dd_list;
				_tmp25_ = vala_list_get (_tmp24_, _dd_index);
				dd = (ValaDataType*) _tmp25_;
				_tmp26_ = ret;
				_tmp27_ = g_strconcat (_tmp26_, "_", NULL);
				_g_free0 (ret);
				ret = _tmp27_;
				_tmp28_ = ret;
				_tmp29_ = dd;
				_tmp30_ = go_namer_mangle_datatype (self, _tmp29_);
				_tmp31_ = _tmp30_;
				_tmp32_ = g_strconcat (_tmp28_, _tmp31_, NULL);
				_g_free0 (ret);
				ret = _tmp32_;
				_g_free0 (_tmp31_);
				_vala_code_node_unref0 (dd);
			}
		}
	}
	result = ret;
	_g_free0 (dname);
	return result;
}

gchar*
go_namer_get_class_name (GoNamer* self,
                         ValaClass* c)
{
	gboolean has_specializations = FALSE;
	GList* _tmp0_;
	gchar* postfix = NULL;
	gchar* _tmp2_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	has_specializations = FALSE;
	_tmp0_ = self->priv->ordered_specializations;
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp0_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			ValaDataType* _tmp1_;
			ValaDataType* s = NULL;
			_tmp1_ = _vala_code_node_ref0 ((ValaDataType*) s_it->data);
			s = _tmp1_;
			{
				has_specializations = TRUE;
				_vala_code_node_unref0 (s);
				break;
			}
		}
	}
	_tmp2_ = g_strdup ("");
	postfix = _tmp2_;
	if (has_specializations) {
		GList* _tmp3_;
		_tmp3_ = self->priv->ordered_specializations;
		{
			GList* d_collection = NULL;
			GList* d_it = NULL;
			d_collection = _tmp3_;
			for (d_it = d_collection; d_it != NULL; d_it = d_it->next) {
				ValaDataType* _tmp4_;
				ValaDataType* d = NULL;
				_tmp4_ = _vala_code_node_ref0 ((ValaDataType*) d_it->data);
				d = _tmp4_;
				{
					const gchar* _tmp5_;
					gchar* _tmp6_;
					const gchar* _tmp7_;
					ValaDataType* _tmp8_;
					gchar* _tmp9_;
					gchar* _tmp10_;
					gchar* _tmp11_;
					_tmp5_ = postfix;
					_tmp6_ = g_strconcat (_tmp5_, "_", NULL);
					_g_free0 (postfix);
					postfix = _tmp6_;
					_tmp7_ = postfix;
					_tmp8_ = d;
					_tmp9_ = go_namer_mangle_datatype (self, _tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = g_strconcat (_tmp7_, _tmp10_, NULL);
					_g_free0 (postfix);
					postfix = _tmp11_;
					_g_free0 (_tmp10_);
					_vala_code_node_unref0 (d);
				}
			}
		}
	}
	_tmp12_ = self->priv->pfx;
	_tmp13_ = vala_symbol_get_name ((ValaSymbol*) c);
	_tmp14_ = _tmp13_;
	_tmp15_ = go_namer_camelcase (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = postfix;
	_tmp18_ = g_strdup_printf ("%s%s%s", _tmp12_, _tmp16_, _tmp17_);
	_tmp19_ = _tmp18_;
	_g_free0 (_tmp16_);
	result = _tmp19_;
	_g_free0 (postfix);
	return result;
}

gchar*
go_namer_get_specialized_type_declaration (GoNamer* self,
                                           ValaDataType* d)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (d != NULL, NULL);
	_tmp0_ = go_namer_mangle_datatype (self, d);
	result = _tmp0_;
	return result;
}

gchar*
go_namer_get_class_cname (GoNamer* self,
                          ValaClass* c)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) c);
	result = _tmp0_;
	return result;
}

gchar*
go_namer_get_struct_name (GoNamer* self,
                          ValaStruct* s)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	_tmp0_ = self->priv->pfx;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) s);
	_tmp2_ = _tmp1_;
	_tmp3_ = go_namer_camelcase (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup_printf ("%s%s", _tmp0_, _tmp4_);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	result = _tmp6_;
	return result;
}

gchar*
go_namer_get_struct_cname (GoNamer* self,
                           ValaStruct* s)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) s);
	result = _tmp0_;
	return result;
}

gchar*
go_namer_get_namespace_name (GoNamer* self,
                             ValaNamespace* ns)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (ns != NULL, NULL);
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) ns);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

static inline gboolean
go_namer_is_generic (GoNamer* self,
                     const gchar* type)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (type != NULL, FALSE);
	if (string_index_of (type, "<", 0) != -1) {
		_tmp0_ = string_index_of (type, ">", 0) != -1;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	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 {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gchar*
go_namer_get_ctype (GoNamer* self,
                    const gchar* _type)
{
	gchar* type = NULL;
	gchar* _tmp0_;
	gchar* iter_type = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	GQuark _tmp28_ = 0U;
	static GQuark _tmp27_label0 = 0;
	static GQuark _tmp27_label1 = 0;
	static GQuark _tmp27_label2 = 0;
	static GQuark _tmp27_label3 = 0;
	static GQuark _tmp27_label4 = 0;
	static GQuark _tmp27_label5 = 0;
	static GQuark _tmp27_label6 = 0;
	static GQuark _tmp27_label7 = 0;
	static GQuark _tmp27_label8 = 0;
	static GQuark _tmp27_label9 = 0;
	static GQuark _tmp27_label10 = 0;
	static GQuark _tmp27_label11 = 0;
	static GQuark _tmp27_label12 = 0;
	static GQuark _tmp27_label13 = 0;
	static GQuark _tmp27_label14 = 0;
	static GQuark _tmp27_label15 = 0;
	static GQuark _tmp27_label16 = 0;
	static GQuark _tmp27_label17 = 0;
	static GQuark _tmp27_label18 = 0;
	static GQuark _tmp27_label19 = 0;
	static GQuark _tmp27_label20 = 0;
	static GQuark _tmp27_label21 = 0;
	static GQuark _tmp27_label22 = 0;
	static GQuark _tmp27_label23 = 0;
	static GQuark _tmp27_label24 = 0;
	static GQuark _tmp27_label25 = 0;
	static GQuark _tmp27_label26 = 0;
	static GQuark _tmp27_label27 = 0;
	static GQuark _tmp27_label28 = 0;
	static GQuark _tmp27_label29 = 0;
	static GQuark _tmp27_label30 = 0;
	static GQuark _tmp27_label31 = 0;
	static GQuark _tmp27_label32 = 0;
	static GQuark _tmp27_label33 = 0;
	static GQuark _tmp27_label34 = 0;
	static GQuark _tmp27_label35 = 0;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (_type != NULL, NULL);
	_tmp0_ = g_strdup (_type);
	type = _tmp0_;
	iter_type = NULL;
	_tmp1_ = type;
	if (g_strcmp0 (_tmp1_, "null") == 0) {
		error ("Cannot resolve type");
	}
	_tmp2_ = type;
	if (go_namer_is_generic (self, _tmp2_)) {
		gint ptr = 0;
		const gchar* _tmp3_;
		gchar* _tmp4_ = NULL;
		gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		const gchar* _tmp17_;
		gchar** _tmp18_;
		gchar** _tmp19_;
		gchar** _tmp20_;
		gint _tmp20__length1;
		const gchar* _tmp21_;
		gchar* _tmp22_;
		_tmp3_ = type;
		ptr = string_index_of (_tmp3_, "<", 0);
		if (ptr == -1) {
			const gchar* _tmp5_;
			gchar* _tmp6_;
			_tmp5_ = type;
			_tmp6_ = g_strdup (_tmp5_);
			_g_free0 (_tmp4_);
			_tmp4_ = _tmp6_;
		} else {
			const gchar* _tmp7_;
			const gchar* _tmp8_;
			gint _tmp9_;
			gint _tmp10_;
			gchar* _tmp11_;
			_tmp7_ = type;
			_tmp8_ = type;
			_tmp9_ = strlen (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = string_slice (_tmp7_, (glong) ptr, (glong) _tmp10_);
			_g_free0 (_tmp4_);
			_tmp4_ = _tmp11_;
		}
		_tmp12_ = _tmp4_;
		_tmp4_ = NULL;
		_g_free0 (iter_type);
		iter_type = _tmp12_;
		_tmp13_ = iter_type;
		_tmp14_ = string_replace (_tmp13_, "<", "");
		_g_free0 (iter_type);
		iter_type = _tmp14_;
		_tmp15_ = iter_type;
		_tmp16_ = string_replace (_tmp15_, ">", "");
		_g_free0 (iter_type);
		iter_type = _tmp16_;
		_tmp17_ = type;
		_tmp19_ = _tmp18_ = g_strsplit (_tmp17_, "<", 2);
		_tmp20_ = _tmp19_;
		_tmp20__length1 = _vala_array_length (_tmp18_);
		_tmp21_ = _tmp20_[0];
		_tmp22_ = g_strdup (_tmp21_);
		_g_free0 (type);
		type = _tmp22_;
		_tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_tmp4_);
	}
	_tmp23_ = type;
	_tmp24_ = string_replace (_tmp23_, "?", "");
	_g_free0 (type);
	type = _tmp24_;
	_tmp25_ = type;
	_tmp26_ = _tmp25_;
	_tmp28_ = (NULL == _tmp26_) ? 0 : g_quark_from_string (_tmp26_);
	if (((_tmp28_ == ((0 != _tmp27_label0) ? _tmp27_label0 : (_tmp27_label0 = g_quark_from_static_string ("gconstpointer")))) || (_tmp28_ == ((0 != _tmp27_label1) ? _tmp27_label1 : (_tmp27_label1 = g_quark_from_static_string ("gpointer"))))) || (_tmp28_ == ((0 != _tmp27_label2) ? _tmp27_label2 : (_tmp27_label2 = g_quark_from_static_string ("void*"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp29_;
				_tmp29_ = g_strdup ("void*");
				result = _tmp29_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label3) ? _tmp27_label3 : (_tmp27_label3 = g_quark_from_static_string ("gsize")))) {
		switch (0) {
			default:
			{
				gchar* _tmp30_;
				_tmp30_ = g_strdup ("uint");
				result = _tmp30_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label4) ? _tmp27_label4 : (_tmp27_label4 = g_quark_from_static_string ("gdouble")))) {
		switch (0) {
			default:
			{
				gchar* _tmp31_;
				_tmp31_ = g_strdup ("float64");
				result = _tmp31_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label5) ? _tmp27_label5 : (_tmp27_label5 = g_quark_from_static_string ("gfloat")))) {
		switch (0) {
			default:
			{
				gchar* _tmp32_;
				_tmp32_ = g_strdup ("float32");
				result = _tmp32_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp28_ == ((0 != _tmp27_label6) ? _tmp27_label6 : (_tmp27_label6 = g_quark_from_static_string ("ut8")))) || (_tmp28_ == ((0 != _tmp27_label7) ? _tmp27_label7 : (_tmp27_label7 = g_quark_from_static_string ("uint8"))))) || (_tmp28_ == ((0 != _tmp27_label8) ? _tmp27_label8 : (_tmp27_label8 = g_quark_from_static_string ("guint8"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp33_;
				_tmp33_ = g_strdup ("byte");
				result = _tmp33_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label9) ? _tmp27_label9 : (_tmp27_label9 = g_quark_from_static_string ("gchar**")))) {
		switch (0) {
			default:
			{
				gchar* _tmp34_;
				_tmp34_ = g_strdup ("**byte");
				result = _tmp34_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp28_ == ((0 != _tmp27_label10) ? _tmp27_label10 : (_tmp27_label10 = g_quark_from_static_string ("char")))) || (_tmp28_ == ((0 != _tmp27_label11) ? _tmp27_label11 : (_tmp27_label11 = g_quark_from_static_string ("gchar"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp35_;
				_tmp35_ = g_strdup ("byte");
				result = _tmp35_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp28_ == ((0 != _tmp27_label12) ? _tmp27_label12 : (_tmp27_label12 = g_quark_from_static_string ("gchar*")))) || (_tmp28_ == ((0 != _tmp27_label13) ? _tmp27_label13 : (_tmp27_label13 = g_quark_from_static_string ("string"))))) || (_tmp28_ == ((0 != _tmp27_label14) ? _tmp27_label14 : (_tmp27_label14 = g_quark_from_static_string ("const gchar*"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp36_;
				_tmp36_ = g_strdup ("string");
				result = _tmp36_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label15) ? _tmp27_label15 : (_tmp27_label15 = g_quark_from_static_string ("void")))) {
		switch (0) {
			default:
			{
				gchar* _tmp37_;
				_tmp37_ = g_strdup ("void");
				result = _tmp37_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp28_ == ((0 != _tmp27_label16) ? _tmp27_label16 : (_tmp27_label16 = g_quark_from_static_string ("int[]")))) || (_tmp28_ == ((0 != _tmp27_label17) ? _tmp27_label17 : (_tmp27_label17 = g_quark_from_static_string ("int"))))) || (_tmp28_ == ((0 != _tmp27_label18) ? _tmp27_label18 : (_tmp27_label18 = g_quark_from_static_string ("gint"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp38_;
				_tmp38_ = g_strdup ("int");
				result = _tmp38_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label19) ? _tmp27_label19 : (_tmp27_label19 = g_quark_from_static_string ("guint")))) {
		switch (0) {
			default:
			{
				gchar* _tmp39_;
				_tmp39_ = g_strdup ("uint");
				result = _tmp39_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (_tmp28_ == ((0 != _tmp27_label20) ? _tmp27_label20 : (_tmp27_label20 = g_quark_from_static_string ("glong")))) {
		switch (0) {
			default:
			{
				gchar* _tmp40_;
				_tmp40_ = g_strdup ("int64");
				result = _tmp40_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp28_ == ((0 != _tmp27_label21) ? _tmp27_label21 : (_tmp27_label21 = g_quark_from_static_string ("st64")))) || (_tmp28_ == ((0 != _tmp27_label22) ? _tmp27_label22 : (_tmp27_label22 = g_quark_from_static_string ("int64"))))) || (_tmp28_ == ((0 != _tmp27_label23) ? _tmp27_label23 : (_tmp27_label23 = g_quark_from_static_string ("gint64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp41_;
				_tmp41_ = g_strdup ("int64");
				result = _tmp41_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp28_ == ((0 != _tmp27_label24) ? _tmp27_label24 : (_tmp27_label24 = g_quark_from_static_string ("ut64")))) || (_tmp28_ == ((0 != _tmp27_label25) ? _tmp27_label25 : (_tmp27_label25 = g_quark_from_static_string ("uint64"))))) || (_tmp28_ == ((0 != _tmp27_label26) ? _tmp27_label26 : (_tmp27_label26 = g_quark_from_static_string ("guint64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp42_;
				_tmp42_ = g_strdup ("uint64");
				result = _tmp42_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp28_ == ((0 != _tmp27_label27) ? _tmp27_label27 : (_tmp27_label27 = g_quark_from_static_string ("uint8*")))) || (_tmp28_ == ((0 != _tmp27_label28) ? _tmp27_label28 : (_tmp27_label28 = g_quark_from_static_string ("guint8*"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp43_;
				_tmp43_ = g_strdup ("*byte");
				result = _tmp43_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp28_ == ((0 != _tmp27_label29) ? _tmp27_label29 : (_tmp27_label29 = g_quark_from_static_string ("guint16")))) || (_tmp28_ == ((0 != _tmp27_label30) ? _tmp27_label30 : (_tmp27_label30 = g_quark_from_static_string ("uint16"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp44_;
				_tmp44_ = g_strdup ("uint16");
				result = _tmp44_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp28_ == ((0 != _tmp27_label31) ? _tmp27_label31 : (_tmp27_label31 = g_quark_from_static_string ("ut32")))) || (_tmp28_ == ((0 != _tmp27_label32) ? _tmp27_label32 : (_tmp27_label32 = g_quark_from_static_string ("uint32"))))) || (_tmp28_ == ((0 != _tmp27_label33) ? _tmp27_label33 : (_tmp27_label33 = g_quark_from_static_string ("guint32"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp45_;
				_tmp45_ = g_strdup ("uint32");
				result = _tmp45_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp28_ == ((0 != _tmp27_label34) ? _tmp27_label34 : (_tmp27_label34 = g_quark_from_static_string ("bool")))) || (_tmp28_ == ((0 != _tmp27_label35) ? _tmp27_label35 : (_tmp27_label35 = g_quark_from_static_string ("gboolean"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp46_;
				_tmp46_ = g_strdup ("bool");
				result = _tmp46_;
				_g_free0 (iter_type);
				_g_free0 (type);
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				break;
			}
		}
	}
	result = type;
	_g_free0 (iter_type);
	return result;
}

static gchar*
go_namer_get_cgo_cast_type (GoNamer* self,
                            const gchar* _type)
{
	gchar* type = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GQuark _tmp4_ = 0U;
	static GQuark _tmp3_label0 = 0;
	static GQuark _tmp3_label1 = 0;
	static GQuark _tmp3_label2 = 0;
	static GQuark _tmp3_label3 = 0;
	static GQuark _tmp3_label4 = 0;
	static GQuark _tmp3_label5 = 0;
	static GQuark _tmp3_label6 = 0;
	static GQuark _tmp3_label7 = 0;
	static GQuark _tmp3_label8 = 0;
	static GQuark _tmp3_label9 = 0;
	static GQuark _tmp3_label10 = 0;
	static GQuark _tmp3_label11 = 0;
	static GQuark _tmp3_label12 = 0;
	static GQuark _tmp3_label13 = 0;
	static GQuark _tmp3_label14 = 0;
	static GQuark _tmp3_label15 = 0;
	static GQuark _tmp3_label16 = 0;
	static GQuark _tmp3_label17 = 0;
	static GQuark _tmp3_label18 = 0;
	static GQuark _tmp3_label19 = 0;
	static GQuark _tmp3_label20 = 0;
	static GQuark _tmp3_label21 = 0;
	static GQuark _tmp3_label22 = 0;
	static GQuark _tmp3_label23 = 0;
	static GQuark _tmp3_label24 = 0;
	static GQuark _tmp3_label25 = 0;
	static GQuark _tmp3_label26 = 0;
	static GQuark _tmp3_label27 = 0;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (_type != NULL, NULL);
	_tmp0_ = string_replace (_type, "?", "");
	type = _tmp0_;
	_tmp1_ = type;
	_tmp2_ = _tmp1_;
	_tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
	if (_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("gsize")))) {
		switch (0) {
			default:
			{
				gchar* _tmp5_;
				_tmp5_ = g_strdup ("C.size_t");
				result = _tmp5_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("gdouble")))) || (_tmp4_ == ((0 != _tmp3_label2) ? _tmp3_label2 : (_tmp3_label2 = g_quark_from_static_string ("float64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp6_;
				_tmp6_ = g_strdup ("C.double");
				result = _tmp6_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp4_ == ((0 != _tmp3_label3) ? _tmp3_label3 : (_tmp3_label3 = g_quark_from_static_string ("gfloat")))) || (_tmp4_ == ((0 != _tmp3_label4) ? _tmp3_label4 : (_tmp3_label4 = g_quark_from_static_string ("float32"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp7_;
				_tmp7_ = g_strdup ("C.float");
				result = _tmp7_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((((_tmp4_ == ((0 != _tmp3_label5) ? _tmp3_label5 : (_tmp3_label5 = g_quark_from_static_string ("ut8")))) || (_tmp4_ == ((0 != _tmp3_label6) ? _tmp3_label6 : (_tmp3_label6 = g_quark_from_static_string ("uint8"))))) || (_tmp4_ == ((0 != _tmp3_label7) ? _tmp3_label7 : (_tmp3_label7 = g_quark_from_static_string ("guint8"))))) || (_tmp4_ == ((0 != _tmp3_label8) ? _tmp3_label8 : (_tmp3_label8 = g_quark_from_static_string ("byte"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp8_;
				_tmp8_ = g_strdup ("C.uchar");
				result = _tmp8_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp4_ == ((0 != _tmp3_label9) ? _tmp3_label9 : (_tmp3_label9 = g_quark_from_static_string ("char")))) || (_tmp4_ == ((0 != _tmp3_label10) ? _tmp3_label10 : (_tmp3_label10 = g_quark_from_static_string ("gchar"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp9_;
				_tmp9_ = g_strdup ("C.char");
				result = _tmp9_;
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp4_ == ((0 != _tmp3_label11) ? _tmp3_label11 : (_tmp3_label11 = g_quark_from_static_string ("int[]")))) || (_tmp4_ == ((0 != _tmp3_label12) ? _tmp3_label12 : (_tmp3_label12 = g_quark_from_static_string ("int"))))) || (_tmp4_ == ((0 != _tmp3_label13) ? _tmp3_label13 : (_tmp3_label13 = g_quark_from_static_string ("gint"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp10_;
				_tmp10_ = g_strdup ("C.int");
				result = _tmp10_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp4_ == ((0 != _tmp3_label14) ? _tmp3_label14 : (_tmp3_label14 = g_quark_from_static_string ("guint")))) || (_tmp4_ == ((0 != _tmp3_label15) ? _tmp3_label15 : (_tmp3_label15 = g_quark_from_static_string ("uint"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp11_;
				_tmp11_ = g_strdup ("C.uint");
				result = _tmp11_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((((_tmp4_ == ((0 != _tmp3_label16) ? _tmp3_label16 : (_tmp3_label16 = g_quark_from_static_string ("glong")))) || (_tmp4_ == ((0 != _tmp3_label17) ? _tmp3_label17 : (_tmp3_label17 = g_quark_from_static_string ("st64"))))) || (_tmp4_ == ((0 != _tmp3_label18) ? _tmp3_label18 : (_tmp3_label18 = g_quark_from_static_string ("int64"))))) || (_tmp4_ == ((0 != _tmp3_label19) ? _tmp3_label19 : (_tmp3_label19 = g_quark_from_static_string ("gint64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp12_;
				_tmp12_ = g_strdup ("C.long");
				result = _tmp12_;
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp4_ == ((0 != _tmp3_label20) ? _tmp3_label20 : (_tmp3_label20 = g_quark_from_static_string ("ut64")))) || (_tmp4_ == ((0 != _tmp3_label21) ? _tmp3_label21 : (_tmp3_label21 = g_quark_from_static_string ("uint64"))))) || (_tmp4_ == ((0 != _tmp3_label22) ? _tmp3_label22 : (_tmp3_label22 = g_quark_from_static_string ("guint64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp13_;
				_tmp13_ = g_strdup ("C.ulong");
				result = _tmp13_;
				_g_free0 (type);
				return result;
			}
		}
	} else if ((_tmp4_ == ((0 != _tmp3_label23) ? _tmp3_label23 : (_tmp3_label23 = g_quark_from_static_string ("guint16")))) || (_tmp4_ == ((0 != _tmp3_label24) ? _tmp3_label24 : (_tmp3_label24 = g_quark_from_static_string ("uint16"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp14_;
				_tmp14_ = g_strdup ("C.ushort");
				result = _tmp14_;
				_g_free0 (type);
				return result;
			}
		}
	} else if (((_tmp4_ == ((0 != _tmp3_label25) ? _tmp3_label25 : (_tmp3_label25 = g_quark_from_static_string ("ut32")))) || (_tmp4_ == ((0 != _tmp3_label26) ? _tmp3_label26 : (_tmp3_label26 = g_quark_from_static_string ("uint32"))))) || (_tmp4_ == ((0 != _tmp3_label27) ? _tmp3_label27 : (_tmp3_label27 = g_quark_from_static_string ("guint32"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp15_;
				_tmp15_ = g_strdup ("C.uint");
				result = _tmp15_;
				_g_free0 (type);
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				gchar* _tmp16_;
				_tmp16_ = g_strdup ("");
				result = _tmp16_;
				_g_free0 (type);
				return result;
			}
		}
	}
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gchar*
go_namer_extract_basic_type_name (GoNamer* self,
                                  const gchar* type_str)
{
	gchar* basic = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint dot = 0;
	const gchar* _tmp6_;
	gint lt = 0;
	const gchar* _tmp9_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (type_str != NULL, NULL);
	_tmp0_ = string_replace (type_str, "?", "");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_replace (_tmp1_, "*", "");
	_tmp3_ = _tmp2_;
	_tmp4_ = string_strip (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	basic = _tmp5_;
	_tmp6_ = basic;
	dot = string_last_index_of_char (_tmp6_, (gunichar) '.', 0);
	if (dot >= 0) {
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp7_ = basic;
		_tmp8_ = string_substring (_tmp7_, (glong) (dot + 1), (glong) -1);
		_g_free0 (basic);
		basic = _tmp8_;
	}
	_tmp9_ = basic;
	lt = string_index_of_char (_tmp9_, (gunichar) '<', 0);
	if (lt >= 0) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = basic;
		_tmp11_ = string_substring (_tmp10_, (glong) 0, (glong) lt);
		_g_free0 (basic);
		basic = _tmp11_;
	}
	result = basic;
	return result;
}

static inline gchar*
go_namer_strip_non_class_name (GoNamer* self,
                               const gchar* s)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	_tmp0_ = string_substring (s, (glong) 0, (glong) string_index_of_char (s, (gunichar) '<', 0));
	result = _tmp0_;
	return result;
}

static inline gchar*
go_namer_strip_namespace (GoNamer* self,
                          const gchar* s)
{
	gint i1 = 0;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	i1 = string_last_index_of_char (s, (gunichar) '.', 0) + 1;
	_tmp0_ = string_substring (s, (glong) i1, (glong) -1);
	result = _tmp0_;
	return result;
}

static gchar*
go_namer_get_type_declaration (GoNamer* self,
                               ValaDataType* type)
{
	gchar* basic_name = NULL;
	gchar* _tmp0_;
	gchar* lookup_name = NULL;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GHashTable* _tmp6_;
	const gchar* _tmp7_;
	gconstpointer _tmp8_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* typename = NULL;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* maybe_pointer_sym = NULL;
	gchar* _tmp33_;
	gchar* maybe_array_sym = NULL;
	gchar* _tmp34_;
	const gchar* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	_tmp0_ = vala_code_node_to_string ((ValaCodeNode*) type);
	basic_name = _tmp0_;
	_tmp1_ = basic_name;
	_tmp2_ = string_replace (_tmp1_, "*", "");
	_tmp3_ = _tmp2_;
	_tmp4_ = string_strip (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	lookup_name = _tmp5_;
	_tmp6_ = self->priv->specializations;
	_tmp7_ = lookup_name;
	_tmp8_ = g_hash_table_lookup (_tmp6_, _tmp7_);
	if (((ValaDataType*) _tmp8_) != NULL) {
		ValaDataType* dt = NULL;
		GHashTable* _tmp9_;
		const gchar* _tmp10_;
		gconstpointer _tmp11_;
		ValaDataType* _tmp12_;
		ValaDataType* _tmp13_;
		gchar* _tmp14_;
		_tmp9_ = self->priv->specializations;
		_tmp10_ = lookup_name;
		_tmp11_ = g_hash_table_lookup (_tmp9_, _tmp10_);
		_tmp12_ = _vala_code_node_ref0 ((ValaDataType*) _tmp11_);
		dt = _tmp12_;
		_tmp13_ = dt;
		_tmp14_ = go_namer_get_specialized_type_declaration (self, _tmp13_);
		_g_free0 (basic_name);
		basic_name = _tmp14_;
		_vala_code_node_unref0 (dt);
	} else {
		gchar* _tmp15_;
		gchar* _tmp16_;
		gboolean _tmp17_;
		_tmp15_ = vala_code_node_to_string ((ValaCodeNode*) type);
		_tmp16_ = _tmp15_;
		_tmp17_ = string_index_of (_tmp16_, "<", 0) != -1;
		_g_free0 (_tmp16_);
		if (_tmp17_) {
			gchar* _tmp18_;
			_tmp18_ = go_namer_get_specialized_type_declaration (self, type);
			_g_free0 (basic_name);
			basic_name = _tmp18_;
		}
	}
	_tmp19_ = basic_name;
	_tmp20_ = go_namer_strip_non_class_name (self, _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = go_namer_strip_namespace (self, _tmp21_);
	_g_free0 (basic_name);
	basic_name = _tmp22_;
	_g_free0 (_tmp21_);
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_POINTER_TYPE)) {
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		_tmp23_ = basic_name;
		_tmp24_ = string_replace (_tmp23_, "*", "");
		_tmp25_ = _tmp24_;
		_tmp26_ = string_strip (_tmp25_);
		_g_free0 (basic_name);
		basic_name = _tmp26_;
		_g_free0 (_tmp25_);
	}
	_tmp27_ = basic_name;
	_tmp28_ = go_namer_get_ctype (self, _tmp27_);
	typename = _tmp28_;
	_tmp29_ = typename;
	_tmp30_ = string_replace (_tmp29_, "*", "");
	_tmp31_ = _tmp30_;
	_tmp32_ = string_strip (_tmp31_);
	_g_free0 (typename);
	typename = _tmp32_;
	_g_free0 (_tmp31_);
	_tmp33_ = g_strdup ("");
	maybe_pointer_sym = _tmp33_;
	_tmp34_ = g_strdup ("");
	maybe_array_sym = _tmp34_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_POINTER_TYPE)) {
		const gchar* _tmp35_;
		_tmp35_ = typename;
		if (g_strcmp0 (_tmp35_, "void") == 0) {
			gchar* _tmp36_;
			gchar* _tmp37_;
			_tmp36_ = g_strdup ("unsafe.Pointer");
			_g_free0 (typename);
			typename = _tmp36_;
			self->needs_unsafe = TRUE;
			_tmp37_ = g_strdup ("");
			_g_free0 (maybe_pointer_sym);
			maybe_pointer_sym = _tmp37_;
		} else {
			gchar* _tmp38_;
			_tmp38_ = g_strdup ("*");
			_g_free0 (maybe_pointer_sym);
			maybe_pointer_sym = _tmp38_;
		}
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_ARRAY_TYPE)) {
		gchar* _tmp39_;
		_tmp39_ = g_strdup ("[]");
		_g_free0 (maybe_array_sym);
		maybe_array_sym = _tmp39_;
	}
	_tmp40_ = maybe_array_sym;
	_tmp41_ = maybe_pointer_sym;
	_tmp42_ = typename;
	_tmp43_ = g_strdup_printf ("%s%s%s", _tmp40_, _tmp41_, _tmp42_);
	result = _tmp43_;
	_g_free0 (maybe_array_sym);
	_g_free0 (maybe_pointer_sym);
	_g_free0 (typename);
	_g_free0 (lookup_name);
	_g_free0 (basic_name);
	return result;
}

gchar*
go_namer_get_field_type_declaration (GoNamer* self,
                                     ValaField* f)
{
	ValaDataType* _tmp0_;
	ValaDataType* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = vala_variable_get_variable_type ((ValaVariable*) f);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_namer_get_type_declaration (self, _tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_parameter_type_declaration (GoNamer* self,
                                         ValaParameter* p)
{
	ValaDataType* _tmp0_;
	ValaDataType* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (p != NULL, NULL);
	_tmp0_ = vala_variable_get_variable_type ((ValaVariable*) p);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_namer_get_type_declaration (self, _tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_method_return_type_declaration (GoNamer* self,
                                             ValaMethod* m)
{
	ValaDataType* _tmp0_;
	ValaDataType* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	_tmp0_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_namer_get_type_declaration (self, _tmp1_);
	result = _tmp2_;
	return result;
}

gchar*
go_namer_get_param_c_expr (GoNamer* self,
                           const gchar* go_expr,
                           ValaParameter* p)
{
	gboolean _tmp0_ = FALSE;
	ValaParameterDirection _tmp1_;
	ValaParameterDirection _tmp2_;
	gboolean is_ptr = FALSE;
	gchar* go_type = NULL;
	gchar* _tmp5_;
	gchar* base_type = NULL;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* cgo = NULL;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp20_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (go_expr != NULL, NULL);
	g_return_val_if_fail (p != NULL, NULL);
	_tmp1_ = vala_parameter_get_direction (p);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != VALA_PARAMETER_DIRECTION_IN) {
		_tmp0_ = TRUE;
	} else {
		ValaDataType* _tmp3_;
		ValaDataType* _tmp4_;
		_tmp3_ = vala_variable_get_variable_type ((ValaVariable*) p);
		_tmp4_ = _tmp3_;
		_tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_POINTER_TYPE);
	}
	is_ptr = _tmp0_;
	_tmp5_ = go_namer_get_parameter_type_declaration (self, p);
	go_type = _tmp5_;
	_tmp6_ = go_type;
	_tmp7_ = string_replace (_tmp6_, "*", "");
	_tmp8_ = _tmp7_;
	_tmp9_ = string_replace (_tmp8_, "[]", "");
	_tmp10_ = _tmp9_;
	_tmp11_ = string_strip (_tmp10_);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	base_type = _tmp12_;
	_tmp13_ = base_type;
	_tmp14_ = go_namer_get_cgo_cast_type (self, _tmp13_);
	cgo = _tmp14_;
	_tmp15_ = cgo;
	if (g_strcmp0 (_tmp15_, "") != 0) {
		const gchar* _tmp18_;
		gchar* _tmp19_;
		if (is_ptr) {
			const gchar* _tmp16_;
			gchar* _tmp17_;
			self->needs_unsafe = TRUE;
			_tmp16_ = cgo;
			_tmp17_ = g_strdup_printf ("(*%s)(unsafe.Pointer(%s))", _tmp16_, go_expr);
			result = _tmp17_;
			_g_free0 (cgo);
			_g_free0 (base_type);
			_g_free0 (go_type);
			return result;
		}
		_tmp18_ = cgo;
		_tmp19_ = g_strdup_printf ("%s(%s)", _tmp18_, go_expr);
		result = _tmp19_;
		_g_free0 (cgo);
		_g_free0 (base_type);
		_g_free0 (go_type);
		return result;
	}
	_tmp20_ = g_strdup (go_expr);
	result = _tmp20_;
	_g_free0 (cgo);
	_g_free0 (base_type);
	_g_free0 (go_type);
	return result;
}

gchar*
go_namer_wrap_return_to_go (GoNamer* self,
                            const gchar* c_expr,
                            ValaMethod* m)
{
	gchar* ret_type = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp5_;
	const gchar* _tmp7_;
	const gchar* _tmp9_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gboolean _tmp15_;
	gchar* _tmp18_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (c_expr != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	_tmp0_ = go_namer_get_method_return_type_declaration (self, m);
	ret_type = _tmp0_;
	_tmp2_ = ret_type;
	if (g_strcmp0 (_tmp2_, "") == 0) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = ret_type;
		_tmp1_ = g_strcmp0 (_tmp3_, "void") == 0;
	}
	if (_tmp1_) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup (c_expr);
		result = _tmp4_;
		_g_free0 (ret_type);
		return result;
	}
	_tmp5_ = ret_type;
	if (g_strcmp0 (_tmp5_, "unsafe.Pointer") == 0) {
		gchar* _tmp6_;
		_tmp6_ = g_strdup_printf ("unsafe.Pointer(%s)", c_expr);
		result = _tmp6_;
		_g_free0 (ret_type);
		return result;
	}
	_tmp7_ = ret_type;
	if (g_strcmp0 (_tmp7_, "bool") == 0) {
		gchar* _tmp8_;
		_tmp8_ = g_strdup_printf ("%s != 0", c_expr);
		result = _tmp8_;
		_g_free0 (ret_type);
		return result;
	}
	_tmp9_ = ret_type;
	if (g_str_has_prefix (_tmp9_, "*")) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		self->needs_unsafe = TRUE;
		_tmp10_ = ret_type;
		_tmp11_ = g_strdup_printf ("(%s)(unsafe.Pointer(%s))", _tmp10_, c_expr);
		result = _tmp11_;
		_g_free0 (ret_type);
		return result;
	}
	_tmp12_ = ret_type;
	_tmp13_ = go_namer_get_cgo_cast_type (self, _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strcmp0 (_tmp14_, "") != 0;
	_g_free0 (_tmp14_);
	if (_tmp15_) {
		const gchar* _tmp16_;
		gchar* _tmp17_;
		_tmp16_ = ret_type;
		_tmp17_ = g_strdup_printf ("%s(%s)", _tmp16_, c_expr);
		result = _tmp17_;
		_g_free0 (ret_type);
		return result;
	}
	_tmp18_ = g_strdup (c_expr);
	result = _tmp18_;
	_g_free0 (ret_type);
	return result;
}

gchar*
go_namer_get_field_cgo_cast (GoNamer* self,
                             ValaField* f)
{
	ValaDataType* _tmp0_;
	ValaDataType* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = vala_variable_get_variable_type ((ValaVariable*) f);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_code_node_to_string ((ValaCodeNode*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = go_namer_extract_basic_type_name (self, _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = go_namer_get_cgo_cast_type (self, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	result = _tmp7_;
	return result;
}

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

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

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

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

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

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

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

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

void
value_set_go_namer (GValue* value,
                    gpointer v_object)
{
	GoNamer * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GO_NAMER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_GO_NAMER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		go_namer_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		go_namer_unref (old);
	}
}

void
value_take_go_namer (GValue* value,
                     gpointer v_object)
{
	GoNamer * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GO_NAMER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_GO_NAMER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		go_namer_unref (old);
	}
}

static void
go_namer_class_init (GoNamerClass * klass,
                     gpointer klass_data)
{
	go_namer_parent_class = g_type_class_peek_parent (klass);
	((GoNamerClass *) klass)->finalize = go_namer_finalize;
	g_type_class_adjust_private_offset (klass, &GoNamer_private_offset);
}

static void
go_namer_instance_init (GoNamer * self,
                        gpointer klass)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	self->priv = go_namer_get_instance_private (self);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _vala_code_node_unref0_);
	self->priv->specializations = _tmp2_;
	self->priv->ordered_specializations = NULL;
	self->needs_unsafe = FALSE;
	self->ref_count = 1;
}

static void
go_namer_finalize (GoNamer * obj)
{
	GoNamer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GO_NAMER, GoNamer);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->pfx);
	_g_hash_table_unref0 (self->priv->specializations);
	(self->priv->ordered_specializations == NULL) ? NULL : (self->priv->ordered_specializations = (_g_list_free__vala_code_node_unref0_ (self->priv->ordered_specializations), NULL));
}

static GType
go_namer_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_go_namer_init, value_go_namer_free_value, value_go_namer_copy_value, value_go_namer_peek_pointer, "p", value_go_namer_collect_value, "p", value_go_namer_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (GoNamerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) go_namer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GoNamer), 0, (GInstanceInitFunc) go_namer_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType go_namer_type_id;
	go_namer_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GoNamer", &g_define_type_info, &g_define_type_fundamental_info, 0);
	GoNamer_private_offset = g_type_add_instance_private (go_namer_type_id, sizeof (GoNamerPrivate));
	return go_namer_type_id;
}

GType
go_namer_get_type (void)
{
	static volatile gsize go_namer_type_id__once = 0;
	if (g_once_init_enter (&go_namer_type_id__once)) {
		GType go_namer_type_id;
		go_namer_type_id = go_namer_get_type_once ();
		g_once_init_leave (&go_namer_type_id__once, go_namer_type_id);
	}
	return go_namer_type_id__once;
}

gpointer
go_namer_ref (gpointer instance)
{
	GoNamer * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
go_namer_unref (gpointer instance)
{
	GoNamer * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GO_NAMER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
go_src_writer_get_instance_private (GoSrcWriter* self)
{
	return G_STRUCT_MEMBER_P (self, GoSrcWriter_private_offset);
}

GoSrcWriter*
go_src_writer_construct (GType object_type)
{
	GoSrcWriter* self = NULL;
	self = (GoSrcWriter*) valabind_writer_construct (object_type);
	return self;
}

GoSrcWriter*
go_src_writer_new (void)
{
	return go_src_writer_construct (TYPE_GO_SRC_WRITER);
}

static void
go_src_writer_debug (GoSrcWriter* self,
                     const gchar* s)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = self->priv->_indent;
	_tmp1_ = g_strconcat (_tmp0_, s, NULL);
	_tmp2_ = _tmp1_;
	notice (_tmp2_);
	_g_free0 (_tmp2_);
}

static void
go_src_writer_indent (GoSrcWriter* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_indent;
	_tmp1_ = g_strconcat (_tmp0_, "  ", NULL);
	_g_free0 (self->priv->_indent);
	self->priv->_indent = _tmp1_;
}

static void
go_src_writer_dedent (GoSrcWriter* self)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_indent;
	_tmp1_ = self->priv->_indent;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = string_substring (_tmp0_, (glong) 0, (glong) (_tmp3_ - 2));
	_g_free0 (self->priv->_indent);
	self->priv->_indent = _tmp4_;
}

void
go_src_writer_set_generic_class_instances (GoSrcWriter* self,
                                           GHashTable* generic_classes)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (generic_classes != NULL);
	_tmp0_ = _g_hash_table_ref0 (generic_classes);
	_g_hash_table_unref0 (self->priv->generic_classes);
	self->priv->generic_classes = _tmp0_;
}

static gboolean
go_src_writer_is_target_file (GoSrcWriter* self,
                              const gchar* path)
{
	GList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = ((ValabindWriter*) self)->source_files;
	{
		GList* file_collection = NULL;
		GList* file_it = NULL;
		file_collection = _tmp0_;
		for (file_it = file_collection; file_it != NULL; file_it = file_it->next) {
			gchar* _tmp1_;
			gchar* file = NULL;
			_tmp1_ = g_strdup ((const gchar*) file_it->data);
			file = _tmp1_;
			{
				const gchar* _tmp2_;
				_tmp2_ = file;
				if (g_strcmp0 (_tmp2_, path) == 0) {
					result = TRUE;
					_g_free0 (file);
					return result;
				}
				_g_free0 (file);
			}
		}
	}
	result = FALSE;
	return result;
}

static void
go_src_writer_real_visit_source_file (ValaCodeVisitor* base,
                                      ValaSourceFile* source)
{
	GoSrcWriter * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	self = (GoSrcWriter*) base;
	g_return_if_fail (source != NULL);
	_tmp0_ = vala_source_file_get_filename (source);
	_tmp1_ = _tmp0_;
	if (go_src_writer_is_target_file (self, _tmp1_)) {
		vala_source_file_accept_children (source, (ValaCodeVisitor*) self);
	}
}

static void
go_src_writer_process_includes (GoSrcWriter* self,
                                ValaSymbol* s)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = vala_symbol_get_name (s);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("process_includes(sym: %s)", _tmp1_);
	_tmp3_ = _tmp2_;
	go_src_writer_debug (self, _tmp3_);
	_g_free0 (_tmp3_);
	go_src_writer_indent (self);
	_tmp4_ = vala_get_ccode_header_filenames (s);
	_tmp5_ = _tmp4_;
	_tmp7_ = _tmp6_ = g_strsplit (_tmp5_, ",", 0);
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _vala_array_length (_tmp6_);
	_g_free0 (_tmp5_);
	{
		gchar** foo_collection = NULL;
		gint foo_collection_length1 = 0;
		gint _foo_collection_size_ = 0;
		gint foo_it = 0;
		foo_collection = _tmp8_;
		foo_collection_length1 = _tmp8__length1;
		for (foo_it = 0; foo_it < foo_collection_length1; foo_it = foo_it + 1) {
			gchar* _tmp9_;
			gchar* foo = NULL;
			_tmp9_ = g_strdup (foo_collection[foo_it]);
			foo = _tmp9_;
			{
				const gchar* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				gboolean include = FALSE;
				GList* _tmp13_;
				_tmp10_ = foo;
				_tmp11_ = g_strdup_printf ("include(%s)", _tmp10_);
				_tmp12_ = _tmp11_;
				go_src_writer_debug (self, _tmp12_);
				_g_free0 (_tmp12_);
				include = TRUE;
				_tmp13_ = ((ValabindWriter*) self)->includefiles;
				{
					GList* inc_collection = NULL;
					GList* inc_it = NULL;
					inc_collection = _tmp13_;
					for (inc_it = inc_collection; inc_it != NULL; inc_it = inc_it->next) {
						gchar* _tmp14_;
						gchar* inc = NULL;
						_tmp14_ = g_strdup ((const gchar*) inc_it->data);
						inc = _tmp14_;
						{
							const gchar* _tmp15_;
							const gchar* _tmp16_;
							_tmp15_ = inc;
							_tmp16_ = foo;
							if (g_strcmp0 (_tmp15_, _tmp16_) == 0) {
								include = FALSE;
								_g_free0 (inc);
								break;
							}
							_g_free0 (inc);
						}
					}
				}
				if (include) {
					const gchar* _tmp17_;
					gchar* _tmp18_;
					_tmp17_ = foo;
					_tmp18_ = g_strdup (_tmp17_);
					((ValabindWriter*) self)->includefiles = g_list_prepend (((ValabindWriter*) self)->includefiles, _tmp18_);
				}
				_g_free0 (foo);
			}
		}
		foo_collection = (_vala_array_free (foo_collection, foo_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	go_src_writer_dedent (self);
}

static gboolean
go_src_writer_is_string (GoSrcWriter* self,
                         ValaCodeNode* t)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (t != NULL, FALSE);
	if (G_TYPE_CHECK_INSTANCE_TYPE (t, VALA_TYPE_DATA_TYPE)) {
		ValaDataType* a = NULL;
		ValaDataType* _tmp0_;
		ValaDataType* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gboolean _tmp6_;
		_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (t, VALA_TYPE_DATA_TYPE) ? ((ValaDataType*) t) : NULL);
		a = _tmp0_;
		_tmp1_ = a;
		_tmp2_ = vala_code_node_to_string ((ValaCodeNode*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = string_replace (_tmp3_, "?", "");
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strcmp0 (_tmp5_, "string") == 0;
		_g_free0 (_tmp5_);
		_g_free0 (_tmp3_);
		result = _tmp6_;
		_vala_code_node_unref0 (a);
		return result;
	} else {
		if (G_TYPE_CHECK_INSTANCE_TYPE (t, VALA_TYPE_FIELD)) {
			ValaField* a = NULL;
			ValaField* _tmp7_;
			ValaField* _tmp8_;
			ValaDataType* _tmp9_;
			ValaDataType* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gboolean _tmp15_;
			_tmp7_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (t, VALA_TYPE_FIELD) ? ((ValaField*) t) : NULL);
			a = _tmp7_;
			_tmp8_ = a;
			_tmp9_ = vala_variable_get_variable_type ((ValaVariable*) _tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = vala_code_node_to_string ((ValaCodeNode*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = string_replace (_tmp12_, "?", "");
			_tmp14_ = _tmp13_;
			_tmp15_ = g_strcmp0 (_tmp14_, "string") == 0;
			_g_free0 (_tmp14_);
			_g_free0 (_tmp12_);
			result = _tmp15_;
			_vala_code_node_unref0 (a);
			return result;
		} else {
			if (G_TYPE_CHECK_INSTANCE_TYPE (t, VALA_TYPE_PARAMETER)) {
				ValaParameter* a = NULL;
				ValaParameter* _tmp16_;
				ValaParameter* _tmp17_;
				ValaDataType* _tmp18_;
				ValaDataType* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				gchar* _tmp22_;
				gchar* _tmp23_;
				gboolean _tmp24_;
				_tmp16_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (t, VALA_TYPE_PARAMETER) ? ((ValaParameter*) t) : NULL);
				a = _tmp16_;
				_tmp17_ = a;
				_tmp18_ = vala_variable_get_variable_type ((ValaVariable*) _tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = vala_code_node_to_string ((ValaCodeNode*) _tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = string_replace (_tmp21_, "?", "");
				_tmp23_ = _tmp22_;
				_tmp24_ = g_strcmp0 (_tmp23_, "string") == 0;
				_g_free0 (_tmp23_);
				_g_free0 (_tmp21_);
				result = _tmp24_;
				_vala_code_node_unref0 (a);
				return result;
			} else {
				warning ("unexpected type to is_string");
				result = FALSE;
				return result;
			}
		}
	}
}

static gchar*
go_src_writer_walk_field (GoSrcWriter* self,
                          GoNamer* namer,
                          const gchar* owner_name,
                          ValaField* f)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* fname = NULL;
	gchar* _tmp5_;
	gchar* fcname = NULL;
	gchar* _tmp6_;
	gchar* ftype = NULL;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (owner_name != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) f);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("walk_field(name: %s)", _tmp2_);
	_tmp4_ = _tmp3_;
	go_src_writer_debug (self, _tmp4_);
	_g_free0 (_tmp4_);
	go_src_writer_indent (self);
	if (vala_symbol_is_private_symbol ((ValaSymbol*) f)) {
		go_src_writer_debug (self, "private.");
		go_src_writer_dedent (self);
		result = ret;
		return result;
	}
	_tmp5_ = go_namer_get_field_name (namer, f);
	fname = _tmp5_;
	_tmp6_ = go_namer_get_field_cname (namer, f);
	fcname = _tmp6_;
	_tmp7_ = go_namer_get_field_type_declaration (namer, f);
	ftype = _tmp7_;
	if (go_src_writer_is_string (self, (ValaCodeNode*) f)) {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		const gchar* _tmp19_;
		gchar* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		const gchar* _tmp27_;
		const gchar* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		const gchar* _tmp32_;
		gchar* _tmp33_;
		_tmp8_ = ret;
		_tmp9_ = fname;
		_tmp10_ = ftype;
		_tmp11_ = g_strdup_printf ("func (s %s) Get%s() %s {\n", owner_name, _tmp9_, _tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_strconcat (_tmp8_, _tmp12_, NULL);
		_g_free0 (ret);
		ret = _tmp13_;
		_g_free0 (_tmp12_);
		_tmp14_ = ret;
		_tmp15_ = fcname;
		_tmp16_ = g_strdup_printf ("    return C.GoString(s.%s)\n", _tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strconcat (_tmp14_, _tmp17_, NULL);
		_g_free0 (ret);
		ret = _tmp18_;
		_g_free0 (_tmp17_);
		_tmp19_ = ret;
		_tmp20_ = g_strconcat (_tmp19_, "}\n", NULL);
		_g_free0 (ret);
		ret = _tmp20_;
		_tmp21_ = ret;
		_tmp22_ = fname;
		_tmp23_ = ftype;
		_tmp24_ = g_strdup_printf ("func (s *%s) Set%s(a %s) {\n", owner_name, _tmp22_, _tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = g_strconcat (_tmp21_, _tmp25_, NULL);
		_g_free0 (ret);
		ret = _tmp26_;
		_g_free0 (_tmp25_);
		_tmp27_ = ret;
		_tmp28_ = fcname;
		_tmp29_ = g_strdup_printf ("    s.%s = C.CString(a)\n", _tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = g_strconcat (_tmp27_, _tmp30_, NULL);
		_g_free0 (ret);
		ret = _tmp31_;
		_g_free0 (_tmp30_);
		_tmp32_ = ret;
		_tmp33_ = g_strconcat (_tmp32_, "}\n", NULL);
		_g_free0 (ret);
		ret = _tmp33_;
	} else {
		gchar* cgo = NULL;
		gchar* _tmp34_;
		const gchar* _tmp35_;
		const gchar* _tmp36_;
		const gchar* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		const gchar* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		gchar* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		const gchar* _tmp47_;
		gchar* _tmp48_;
		const gchar* _tmp49_;
		const gchar* _tmp50_;
		const gchar* _tmp51_;
		gchar* _tmp52_;
		gchar* _tmp53_;
		gchar* _tmp54_;
		const gchar* _tmp55_;
		const gchar* _tmp67_;
		gchar* _tmp68_;
		_tmp34_ = go_namer_get_field_cgo_cast (namer, f);
		cgo = _tmp34_;
		_tmp35_ = ret;
		_tmp36_ = fname;
		_tmp37_ = ftype;
		_tmp38_ = g_strdup_printf ("func (s %s) Get%s() %s {\n", owner_name, _tmp36_, _tmp37_);
		_tmp39_ = _tmp38_;
		_tmp40_ = g_strconcat (_tmp35_, _tmp39_, NULL);
		_g_free0 (ret);
		ret = _tmp40_;
		_g_free0 (_tmp39_);
		_tmp41_ = ret;
		_tmp42_ = ftype;
		_tmp43_ = fcname;
		_tmp44_ = g_strdup_printf ("    return %s(s.%s)\n", _tmp42_, _tmp43_);
		_tmp45_ = _tmp44_;
		_tmp46_ = g_strconcat (_tmp41_, _tmp45_, NULL);
		_g_free0 (ret);
		ret = _tmp46_;
		_g_free0 (_tmp45_);
		_tmp47_ = ret;
		_tmp48_ = g_strconcat (_tmp47_, "}\n", NULL);
		_g_free0 (ret);
		ret = _tmp48_;
		_tmp49_ = ret;
		_tmp50_ = fname;
		_tmp51_ = ftype;
		_tmp52_ = g_strdup_printf ("func (s *%s) Set%s(a %s) {\n", owner_name, _tmp50_, _tmp51_);
		_tmp53_ = _tmp52_;
		_tmp54_ = g_strconcat (_tmp49_, _tmp53_, NULL);
		_g_free0 (ret);
		ret = _tmp54_;
		_g_free0 (_tmp53_);
		_tmp55_ = cgo;
		if (g_strcmp0 (_tmp55_, "") != 0) {
			const gchar* _tmp56_;
			const gchar* _tmp57_;
			const gchar* _tmp58_;
			gchar* _tmp59_;
			gchar* _tmp60_;
			gchar* _tmp61_;
			_tmp56_ = ret;
			_tmp57_ = fcname;
			_tmp58_ = cgo;
			_tmp59_ = g_strdup_printf ("    s.%s = %s(a)\n", _tmp57_, _tmp58_);
			_tmp60_ = _tmp59_;
			_tmp61_ = g_strconcat (_tmp56_, _tmp60_, NULL);
			_g_free0 (ret);
			ret = _tmp61_;
			_g_free0 (_tmp60_);
		} else {
			const gchar* _tmp62_;
			const gchar* _tmp63_;
			gchar* _tmp64_;
			gchar* _tmp65_;
			gchar* _tmp66_;
			_tmp62_ = ret;
			_tmp63_ = fcname;
			_tmp64_ = g_strdup_printf ("    s.%s = a\n", _tmp63_);
			_tmp65_ = _tmp64_;
			_tmp66_ = g_strconcat (_tmp62_, _tmp65_, NULL);
			_g_free0 (ret);
			ret = _tmp66_;
			_g_free0 (_tmp65_);
		}
		_tmp67_ = ret;
		_tmp68_ = g_strconcat (_tmp67_, "}\n", NULL);
		_g_free0 (ret);
		ret = _tmp68_;
		_g_free0 (cgo);
	}
	go_src_writer_dedent (self);
	result = ret;
	_g_free0 (ftype);
	_g_free0 (fcname);
	_g_free0 (fname);
	return result;
}

static gchar*
go_src_writer_walk_class_field (GoSrcWriter* self,
                                GoNamer* namer,
                                ValaClass* c,
                                ValaField* f)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = go_namer_get_class_name (namer, c);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_src_writer_walk_field (self, namer, _tmp1_, f);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static gchar*
go_src_writer_walk_struct_field (GoSrcWriter* self,
                                 GoNamer* namer,
                                 ValaStruct* s,
                                 ValaField* f)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = go_namer_get_struct_name (namer, s);
	_tmp1_ = _tmp0_;
	_tmp2_ = go_src_writer_walk_field (self, namer, _tmp1_, f);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static gchar*
go_src_writer_walk_namespace_field (GoSrcWriter* self,
                                    GoNamer* namer,
                                    ValaNamespace* ns,
                                    ValaField* f)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (ns != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = go_namer_get_namespace_name (namer, ns);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("nsimp", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = go_src_writer_walk_field (self, namer, _tmp3_, f);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp5_;
	return result;
}

static gchar*
go_src_writer_walk_struct (GoSrcWriter* self,
                           GoNamer* namer,
                           ValaStruct* s)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (s != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) s);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("walk_struct(name: %s)", _tmp2_);
	_tmp4_ = _tmp3_;
	go_src_writer_debug (self, _tmp4_);
	_g_free0 (_tmp4_);
	go_src_writer_indent (self);
	_tmp5_ = ret;
	_tmp6_ = go_namer_get_struct_name (namer, s);
	_tmp7_ = _tmp6_;
	_tmp8_ = go_namer_get_struct_cname (namer, s);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup_printf ("type %s C.%s\n", _tmp7_, _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strconcat (_tmp5_, _tmp11_, NULL);
	_g_free0 (ret);
	ret = _tmp12_;
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	{
		ValaList* _f_list = NULL;
		ValaList* _tmp13_;
		gint _f_size = 0;
		ValaList* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gint _f_index = 0;
		_tmp13_ = vala_struct_get_fields (s);
		_f_list = _tmp13_;
		_tmp14_ = _f_list;
		_tmp15_ = vala_collection_get_size ((ValaCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		_f_size = _tmp16_;
		_f_index = -1;
		while (TRUE) {
			gint _tmp17_;
			gint _tmp18_;
			ValaField* f = NULL;
			ValaList* _tmp19_;
			gpointer _tmp20_;
			const gchar* _tmp21_;
			ValaField* _tmp22_;
			gchar* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			_f_index = _f_index + 1;
			_tmp17_ = _f_index;
			_tmp18_ = _f_size;
			if (!(_tmp17_ < _tmp18_)) {
				break;
			}
			_tmp19_ = _f_list;
			_tmp20_ = vala_list_get (_tmp19_, _f_index);
			f = (ValaField*) _tmp20_;
			_tmp21_ = ret;
			_tmp22_ = f;
			_tmp23_ = go_src_writer_walk_struct_field (self, namer, s, _tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = g_strconcat (_tmp21_, _tmp24_, NULL);
			_g_free0 (ret);
			ret = _tmp25_;
			_g_free0 (_tmp24_);
			_vala_code_node_unref0 (f);
		}
	}
	_tmp26_ = ret;
	_tmp27_ = g_strconcat (_tmp26_, "\n", NULL);
	_g_free0 (ret);
	ret = _tmp27_;
	go_src_writer_dedent (self);
	result = ret;
	return result;
}

static gchar*
go_src_writer_walk_enum (GoSrcWriter* self,
                         GoNamer* namer,
                         ValaEnum* e)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* pfx = NULL;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (e != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = vala_get_ccode_prefix ((ValaSymbol*) e);
	pfx = _tmp1_;
	_tmp2_ = pfx;
	_tmp3_ = vala_symbol_get_name ((ValaSymbol*) e);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup_printf ("walk_enum(pfx: %s, name: %s)", _tmp2_, _tmp4_);
	_tmp6_ = _tmp5_;
	go_src_writer_debug (self, _tmp6_);
	_g_free0 (_tmp6_);
	go_src_writer_indent (self);
	_tmp7_ = ret;
	_tmp8_ = g_strconcat (_tmp7_, "const (\n", NULL);
	_g_free0 (ret);
	ret = _tmp8_;
	{
		ValaList* _v_list = NULL;
		ValaList* _tmp9_;
		gint _v_size = 0;
		ValaList* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gint _v_index = 0;
		_tmp9_ = vala_enum_get_values (e);
		_v_list = _tmp9_;
		_tmp10_ = _v_list;
		_tmp11_ = vala_collection_get_size ((ValaCollection*) _tmp10_);
		_tmp12_ = _tmp11_;
		_v_size = _tmp12_;
		_v_index = -1;
		while (TRUE) {
			gint _tmp13_;
			gint _tmp14_;
			ValaEnumValue* v = NULL;
			ValaList* _tmp15_;
			gpointer _tmp16_;
			ValaEnumValue* _tmp17_;
			const gchar* _tmp18_;
			const gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			ValaEnumValue* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			const gchar* _tmp27_;
			ValaEnumValue* _tmp28_;
			gchar* _tmp29_;
			gchar* _tmp30_;
			gchar* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			_v_index = _v_index + 1;
			_tmp13_ = _v_index;
			_tmp14_ = _v_size;
			if (!(_tmp13_ < _tmp14_)) {
				break;
			}
			_tmp15_ = _v_list;
			_tmp16_ = vala_list_get (_tmp15_, _v_index);
			v = (ValaEnumValue*) _tmp16_;
			_tmp17_ = v;
			_tmp18_ = vala_symbol_get_name ((ValaSymbol*) _tmp17_);
			_tmp19_ = _tmp18_;
			_tmp20_ = g_strdup_printf ("enum(name: %s)", _tmp19_);
			_tmp21_ = _tmp20_;
			go_src_writer_debug (self, _tmp21_);
			_g_free0 (_tmp21_);
			_tmp22_ = ret;
			_tmp23_ = pfx;
			_tmp24_ = v;
			_tmp25_ = go_namer_get_enum_value_name (namer, _tmp24_);
			_tmp26_ = _tmp25_;
			_tmp27_ = pfx;
			_tmp28_ = v;
			_tmp29_ = go_namer_get_enum_value_cname (namer, _tmp28_);
			_tmp30_ = _tmp29_;
			_tmp31_ = g_strdup_printf ("    %s%s = C.%s%s\n", _tmp23_, _tmp26_, _tmp27_, _tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = g_strconcat (_tmp22_, _tmp32_, NULL);
			_g_free0 (ret);
			ret = _tmp33_;
			_g_free0 (_tmp32_);
			_g_free0 (_tmp30_);
			_g_free0 (_tmp26_);
			_vala_code_node_unref0 (v);
		}
	}
	_tmp34_ = ret;
	_tmp35_ = g_strconcat (_tmp34_, ")\n", NULL);
	_g_free0 (ret);
	ret = _tmp35_;
	_tmp36_ = ret;
	_tmp37_ = go_namer_get_enum_name (namer, e);
	_tmp38_ = _tmp37_;
	_tmp39_ = g_strdup_printf ("type %s int\n\n", _tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = g_strconcat (_tmp36_, _tmp40_, NULL);
	_g_free0 (ret);
	ret = _tmp41_;
	_g_free0 (_tmp40_);
	_g_free0 (_tmp38_);
	go_src_writer_dedent (self);
	result = ret;
	_g_free0 (pfx);
	return result;
}

static gchar*
go_src_writer_get_parameter_pointer_symbol (GoSrcWriter* self,
                                            ValaParameter* p)
{
	gboolean _tmp0_ = FALSE;
	ValaParameterDirection _tmp1_;
	ValaParameterDirection _tmp2_;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (p != NULL, NULL);
	_tmp1_ = vala_parameter_get_direction (p);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != VALA_PARAMETER_DIRECTION_IN) {
		_tmp0_ = !go_src_writer_is_string (self, (ValaCodeNode*) p);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("*");
		result = _tmp3_;
		return result;
	}
	_tmp4_ = g_strdup ("");
	result = _tmp4_;
	return result;
}

static gchar*
go_src_writer_get_function_declaration_parameters (GoSrcWriter* self,
                                                   GoNamer* namer,
                                                   ValaMethod* f)
{
	gchar* args = NULL;
	gchar* _tmp0_;
	gboolean first = FALSE;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = g_strdup ("");
	args = _tmp0_;
	first = TRUE;
	{
		ValaList* _p_list = NULL;
		ValaList* _tmp1_;
		gint _p_size = 0;
		ValaList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _p_index = 0;
		_tmp1_ = vala_callable_get_parameters ((ValaCallable*) f);
		_p_list = _tmp1_;
		_tmp2_ = _p_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_p_size = _tmp4_;
		_p_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ValaParameter* p = NULL;
			ValaList* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp11_;
			ValaParameter* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			ValaParameter* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			ValaParameter* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			gchar* _tmp23_;
			_p_index = _p_index + 1;
			_tmp5_ = _p_index;
			_tmp6_ = _p_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _p_list;
			_tmp8_ = vala_list_get (_tmp7_, _p_index);
			p = (ValaParameter*) _tmp8_;
			if (!first) {
				const gchar* _tmp9_;
				gchar* _tmp10_;
				_tmp9_ = args;
				_tmp10_ = g_strconcat (_tmp9_, ", ", NULL);
				_g_free0 (args);
				args = _tmp10_;
			}
			first = FALSE;
			_tmp11_ = args;
			_tmp12_ = p;
			_tmp13_ = go_namer_get_parameter_name (namer, _tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = p;
			_tmp16_ = go_src_writer_get_parameter_pointer_symbol (self, _tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = p;
			_tmp19_ = go_namer_get_parameter_type_declaration (namer, _tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = g_strdup_printf ("%s %s%s", _tmp14_, _tmp17_, _tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = g_strconcat (_tmp11_, _tmp22_, NULL);
			_g_free0 (args);
			args = _tmp23_;
			_g_free0 (_tmp22_);
			_g_free0 (_tmp20_);
			_g_free0 (_tmp17_);
			_g_free0 (_tmp14_);
			_vala_code_node_unref0 (p);
		}
	}
	result = args;
	return result;
}

static gchar*
go_src_writer_get_function_call_parameters (GoSrcWriter* self,
                                            GoNamer* namer,
                                            ValaMethod* f,
                                            gchar** preamble)
{
	gchar* _vala_preamble = NULL;
	gchar* _tmp0_;
	gchar* args = NULL;
	gchar* _tmp1_;
	gboolean first = FALSE;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = g_strdup ("");
	_g_free0 (_vala_preamble);
	_vala_preamble = _tmp0_;
	_tmp1_ = g_strdup ("");
	args = _tmp1_;
	first = TRUE;
	{
		ValaList* _p_list = NULL;
		ValaList* _tmp2_;
		gint _p_size = 0;
		ValaList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _p_index = 0;
		_tmp2_ = vala_callable_get_parameters ((ValaCallable*) f);
		_p_list = _tmp2_;
		_tmp3_ = _p_list;
		_tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_p_size = _tmp5_;
		_p_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ValaParameter* p = NULL;
			ValaList* _tmp8_;
			gpointer _tmp9_;
			gchar* pname = NULL;
			ValaParameter* _tmp12_;
			gchar* _tmp13_;
			ValaParameter* _tmp14_;
			_p_index = _p_index + 1;
			_tmp6_ = _p_index;
			_tmp7_ = _p_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _p_list;
			_tmp9_ = vala_list_get (_tmp8_, _p_index);
			p = (ValaParameter*) _tmp9_;
			if (!first) {
				const gchar* _tmp10_;
				gchar* _tmp11_;
				_tmp10_ = args;
				_tmp11_ = g_strconcat (_tmp10_, ", ", NULL);
				_g_free0 (args);
				args = _tmp11_;
			}
			first = FALSE;
			_tmp12_ = p;
			_tmp13_ = go_namer_get_parameter_name (namer, _tmp12_);
			pname = _tmp13_;
			_tmp14_ = p;
			if (go_src_writer_is_string (self, (ValaCodeNode*) _tmp14_)) {
				gchar* tmp = NULL;
				const gchar* _tmp15_;
				gchar* _tmp16_;
				const gchar* _tmp17_;
				const gchar* _tmp18_;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				gchar* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				gchar* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				gchar* _tmp30_;
				_tmp15_ = pname;
				_tmp16_ = g_strdup_printf ("_c%s", _tmp15_);
				tmp = _tmp16_;
				_tmp17_ = _vala_preamble;
				_tmp18_ = tmp;
				_tmp19_ = pname;
				_tmp20_ = g_strdup_printf ("    %s := C.CString(%s)\n", _tmp18_, _tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = g_strconcat (_tmp17_, _tmp21_, NULL);
				_g_free0 (_vala_preamble);
				_vala_preamble = _tmp22_;
				_g_free0 (_tmp21_);
				_tmp23_ = _vala_preamble;
				_tmp24_ = tmp;
				_tmp25_ = g_strdup_printf ("    defer C.free(unsafe.Pointer(%s))\n", _tmp24_);
				_tmp26_ = _tmp25_;
				_tmp27_ = g_strconcat (_tmp23_, _tmp26_, NULL);
				_g_free0 (_vala_preamble);
				_vala_preamble = _tmp27_;
				_g_free0 (_tmp26_);
				self->priv->needs_unsafe = TRUE;
				_tmp28_ = args;
				_tmp29_ = tmp;
				_tmp30_ = g_strconcat (_tmp28_, _tmp29_, NULL);
				_g_free0 (args);
				args = _tmp30_;
				_g_free0 (tmp);
			} else {
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				ValaParameter* _tmp33_;
				gchar* _tmp34_;
				gchar* _tmp35_;
				gchar* _tmp36_;
				_tmp31_ = args;
				_tmp32_ = pname;
				_tmp33_ = p;
				_tmp34_ = go_namer_get_param_c_expr (namer, _tmp32_, _tmp33_);
				_tmp35_ = _tmp34_;
				_tmp36_ = g_strconcat (_tmp31_, _tmp35_, NULL);
				_g_free0 (args);
				args = _tmp36_;
				_g_free0 (_tmp35_);
			}
			_g_free0 (pname);
			_vala_code_node_unref0 (p);
		}
	}
	if (namer->needs_unsafe) {
		self->priv->needs_unsafe = TRUE;
	}
	result = args;
	if (preamble) {
		*preamble = _vala_preamble;
	} else {
		_g_free0 (_vala_preamble);
	}
	return result;
}

static gboolean
go_src_writer_is_void_function (GoSrcWriter* self,
                                ValaMethod* f)
{
	ValaDataType* _tmp0_;
	ValaDataType* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (f != NULL, FALSE);
	_tmp0_ = vala_callable_get_return_type ((ValaCallable*) f);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_code_node_to_string ((ValaCodeNode*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strcmp0 (_tmp3_, "void") == 0;
	_g_free0 (_tmp3_);
	result = _tmp4_;
	return result;
}

static gchar*
go_src_writer_walk_function (GoSrcWriter* self,
                             GoNamer* namer,
                             ValaNamespace* ns,
                             ValaMethod* f)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* nsname = NULL;
	gchar* _tmp1_;
	gchar* cname = NULL;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* def_args = NULL;
	gchar* _tmp7_;
	gchar* preamble = NULL;
	gchar* call_args = NULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_;
	const gchar* _tmp58_;
	gchar* _tmp59_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (ns != NULL, NULL);
	g_return_val_if_fail (f != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = go_namer_get_namespace_name (namer, ns);
	nsname = _tmp1_;
	_tmp2_ = go_namer_get_method_cname (namer, f);
	cname = _tmp2_;
	_tmp3_ = nsname;
	_tmp4_ = cname;
	_tmp5_ = g_strdup_printf ("walk_function(ns: %s, name: %s)", _tmp3_, _tmp4_);
	_tmp6_ = _tmp5_;
	go_src_writer_debug (self, _tmp6_);
	_g_free0 (_tmp6_);
	go_src_writer_indent (self);
	if (G_TYPE_CHECK_INSTANCE_TYPE (f, VALA_TYPE_CREATION_METHOD)) {
		warning ("constructor where function expected");
	}
	if (vala_symbol_is_private_symbol ((ValaSymbol*) f)) {
		go_src_writer_debug (self, "private.");
		go_src_writer_dedent (self);
		result = ret;
		_g_free0 (cname);
		_g_free0 (nsname);
		return result;
	}
	_tmp7_ = go_src_writer_get_function_declaration_parameters (self, namer, f);
	def_args = _tmp7_;
	_tmp9_ = go_src_writer_get_function_call_parameters (self, namer, f, &_tmp8_);
	_g_free0 (preamble);
	preamble = _tmp8_;
	call_args = _tmp9_;
	if (!go_src_writer_is_void_function (self, f)) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		gchar* _tmp22_;
		ValaDataType* _tmp23_;
		ValaDataType* _tmp24_;
		_tmp10_ = ret;
		_tmp11_ = nsname;
		_tmp12_ = go_namer_get_method_name (namer, f);
		_tmp13_ = _tmp12_;
		_tmp14_ = def_args;
		_tmp15_ = go_namer_get_method_return_type_declaration (namer, f);
		_tmp16_ = _tmp15_;
		_tmp17_ = g_strdup_printf ("func (_ nsimp%s) %s(%s) %s {\n", _tmp11_, _tmp13_, _tmp14_, _tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = g_strconcat (_tmp10_, _tmp18_, NULL);
		_g_free0 (ret);
		ret = _tmp19_;
		_g_free0 (_tmp18_);
		_g_free0 (_tmp16_);
		_g_free0 (_tmp13_);
		_tmp20_ = ret;
		_tmp21_ = preamble;
		_tmp22_ = g_strconcat (_tmp20_, _tmp21_, NULL);
		_g_free0 (ret);
		ret = _tmp22_;
		_tmp23_ = vala_callable_get_return_type ((ValaCallable*) f);
		_tmp24_ = _tmp23_;
		if (go_src_writer_is_string (self, (ValaCodeNode*) _tmp24_)) {
			const gchar* _tmp25_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			gchar* _tmp28_;
			gchar* _tmp29_;
			gchar* _tmp30_;
			_tmp25_ = ret;
			_tmp26_ = cname;
			_tmp27_ = call_args;
			_tmp28_ = g_strdup_printf ("    return C.GoString(C.%s(%s))\n", _tmp26_, _tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = g_strconcat (_tmp25_, _tmp29_, NULL);
			_g_free0 (ret);
			ret = _tmp30_;
			_g_free0 (_tmp29_);
		} else {
			const gchar* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			gchar* _tmp34_;
			gchar* _tmp35_;
			gchar* _tmp36_;
			gchar* _tmp37_;
			gchar* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			_tmp31_ = ret;
			_tmp32_ = cname;
			_tmp33_ = call_args;
			_tmp34_ = g_strdup_printf ("C.%s(%s)", _tmp32_, _tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = go_namer_wrap_return_to_go (namer, _tmp35_, f);
			_tmp37_ = _tmp36_;
			_tmp38_ = g_strdup_printf ("    return %s\n", _tmp37_);
			_tmp39_ = _tmp38_;
			_tmp40_ = g_strconcat (_tmp31_, _tmp39_, NULL);
			_g_free0 (ret);
			ret = _tmp40_;
			_g_free0 (_tmp39_);
			_g_free0 (_tmp37_);
			_g_free0 (_tmp35_);
		}
	} else {
		const gchar* _tmp41_;
		const gchar* _tmp42_;
		gchar* _tmp43_;
		gchar* _tmp44_;
		const gchar* _tmp45_;
		gchar* _tmp46_;
		gchar* _tmp47_;
		gchar* _tmp48_;
		const gchar* _tmp49_;
		const gchar* _tmp50_;
		gchar* _tmp51_;
		const gchar* _tmp52_;
		const gchar* _tmp53_;
		const gchar* _tmp54_;
		gchar* _tmp55_;
		gchar* _tmp56_;
		gchar* _tmp57_;
		_tmp41_ = ret;
		_tmp42_ = nsname;
		_tmp43_ = go_namer_get_method_name (namer, f);
		_tmp44_ = _tmp43_;
		_tmp45_ = def_args;
		_tmp46_ = g_strdup_printf ("func (_ nsimp%s) %s(%s) {\n", _tmp42_, _tmp44_, _tmp45_);
		_tmp47_ = _tmp46_;
		_tmp48_ = g_strconcat (_tmp41_, _tmp47_, NULL);
		_g_free0 (ret);
		ret = _tmp48_;
		_g_free0 (_tmp47_);
		_g_free0 (_tmp44_);
		_tmp49_ = ret;
		_tmp50_ = preamble;
		_tmp51_ = g_strconcat (_tmp49_, _tmp50_, NULL);
		_g_free0 (ret);
		ret = _tmp51_;
		_tmp52_ = ret;
		_tmp53_ = cname;
		_tmp54_ = call_args;
		_tmp55_ = g_strdup_printf ("    C.%s(%s)\n", _tmp53_, _tmp54_);
		_tmp56_ = _tmp55_;
		_tmp57_ = g_strconcat (_tmp52_, _tmp56_, NULL);
		_g_free0 (ret);
		ret = _tmp57_;
		_g_free0 (_tmp56_);
	}
	_tmp58_ = ret;
	_tmp59_ = g_strconcat (_tmp58_, "}\n", NULL);
	_g_free0 (ret);
	ret = _tmp59_;
	go_src_writer_dedent (self);
	result = ret;
	_g_free0 (call_args);
	_g_free0 (preamble);
	_g_free0 (def_args);
	_g_free0 (cname);
	_g_free0 (nsname);
	return result;
}

static gchar*
go_src_writer_walk_method (GoSrcWriter* self,
                           GoNamer* namer,
                           ValaClass* c,
                           ValaMethod* m)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* classname = NULL;
	gchar* _tmp1_;
	gchar* classcname = NULL;
	gchar* _tmp2_;
	gchar* cname = NULL;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* def_args = NULL;
	gchar* _tmp8_;
	gchar* preamble = NULL;
	gchar* call_args = NULL;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_;
	gchar* self_expr = NULL;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	gchar* _tmp38_;
	const gchar* _tmp78_;
	gchar* _tmp79_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = go_namer_get_class_name (namer, c);
	classname = _tmp1_;
	_tmp2_ = go_namer_get_class_cname (namer, c);
	classcname = _tmp2_;
	_tmp3_ = go_namer_get_method_cname (namer, m);
	cname = _tmp3_;
	_tmp4_ = classname;
	_tmp5_ = cname;
	_tmp6_ = g_strdup_printf ("walk_method(cls: %s, name: %s)", _tmp4_, _tmp5_);
	_tmp7_ = _tmp6_;
	go_src_writer_debug (self, _tmp7_);
	_g_free0 (_tmp7_);
	go_src_writer_indent (self);
	if (G_TYPE_CHECK_INSTANCE_TYPE (m, VALA_TYPE_CREATION_METHOD)) {
		warning ("constructor where method expected");
	}
	if (vala_symbol_is_private_symbol ((ValaSymbol*) m)) {
		go_src_writer_debug (self, "private.");
		go_src_writer_dedent (self);
		result = ret;
		_g_free0 (cname);
		_g_free0 (classcname);
		_g_free0 (classname);
		return result;
	}
	_tmp8_ = go_src_writer_get_function_declaration_parameters (self, namer, m);
	def_args = _tmp8_;
	_tmp10_ = go_src_writer_get_function_call_parameters (self, namer, m, &_tmp9_);
	_g_free0 (preamble);
	preamble = _tmp9_;
	call_args = _tmp10_;
	_tmp11_ = classcname;
	_tmp12_ = g_strdup_printf ("(*C.%s)(unsafe.Pointer(this))", _tmp11_);
	self_expr = _tmp12_;
	self->priv->needs_unsafe = TRUE;
	_tmp13_ = ret;
	_tmp14_ = classname;
	_tmp15_ = go_namer_get_method_name (namer, m);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strdup_printf ("func (this *%s) %s(", _tmp14_, _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strconcat (_tmp13_, _tmp18_, NULL);
	_g_free0 (ret);
	ret = _tmp19_;
	_g_free0 (_tmp18_);
	_g_free0 (_tmp16_);
	_tmp20_ = def_args;
	if (g_strcmp0 (_tmp20_, "") != 0) {
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp21_ = ret;
		_tmp22_ = def_args;
		_tmp23_ = g_strdup_printf ("%s", _tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = g_strconcat (_tmp21_, _tmp24_, NULL);
		_g_free0 (ret);
		ret = _tmp25_;
		_g_free0 (_tmp24_);
	}
	_tmp26_ = ret;
	_tmp27_ = g_strconcat (_tmp26_, ") ", NULL);
	_g_free0 (ret);
	ret = _tmp27_;
	if (!go_src_writer_is_void_function (self, m)) {
		const gchar* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		_tmp28_ = ret;
		_tmp29_ = go_namer_get_method_return_type_declaration (namer, m);
		_tmp30_ = _tmp29_;
		_tmp31_ = g_strdup_printf ("%s ", _tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = g_strconcat (_tmp28_, _tmp32_, NULL);
		_g_free0 (ret);
		ret = _tmp33_;
		_g_free0 (_tmp32_);
		_g_free0 (_tmp30_);
	}
	_tmp34_ = ret;
	_tmp35_ = g_strconcat (_tmp34_, "{\n", NULL);
	_g_free0 (ret);
	ret = _tmp35_;
	_tmp36_ = ret;
	_tmp37_ = preamble;
	_tmp38_ = g_strconcat (_tmp36_, _tmp37_, NULL);
	_g_free0 (ret);
	ret = _tmp38_;
	if (!go_src_writer_is_void_function (self, m)) {
		gchar* c_call = NULL;
		const gchar* _tmp39_;
		const gchar* _tmp40_;
		gchar* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp48_;
		gchar* _tmp49_;
		ValaDataType* _tmp50_;
		ValaDataType* _tmp51_;
		_tmp39_ = cname;
		_tmp40_ = self_expr;
		_tmp41_ = g_strdup_printf ("C.%s(%s", _tmp39_, _tmp40_);
		c_call = _tmp41_;
		_tmp42_ = call_args;
		if (g_strcmp0 (_tmp42_, "") != 0) {
			const gchar* _tmp43_;
			const gchar* _tmp44_;
			gchar* _tmp45_;
			gchar* _tmp46_;
			gchar* _tmp47_;
			_tmp43_ = c_call;
			_tmp44_ = call_args;
			_tmp45_ = g_strdup_printf (", %s", _tmp44_);
			_tmp46_ = _tmp45_;
			_tmp47_ = g_strconcat (_tmp43_, _tmp46_, NULL);
			_g_free0 (c_call);
			c_call = _tmp47_;
			_g_free0 (_tmp46_);
		}
		_tmp48_ = c_call;
		_tmp49_ = g_strconcat (_tmp48_, ")", NULL);
		_g_free0 (c_call);
		c_call = _tmp49_;
		_tmp50_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp51_ = _tmp50_;
		if (go_src_writer_is_string (self, (ValaCodeNode*) _tmp51_)) {
			const gchar* _tmp52_;
			const gchar* _tmp53_;
			gchar* _tmp54_;
			gchar* _tmp55_;
			gchar* _tmp56_;
			_tmp52_ = ret;
			_tmp53_ = c_call;
			_tmp54_ = g_strdup_printf ("    return C.GoString(%s)\n", _tmp53_);
			_tmp55_ = _tmp54_;
			_tmp56_ = g_strconcat (_tmp52_, _tmp55_, NULL);
			_g_free0 (ret);
			ret = _tmp56_;
			_g_free0 (_tmp55_);
		} else {
			const gchar* _tmp57_;
			const gchar* _tmp58_;
			gchar* _tmp59_;
			gchar* _tmp60_;
			gchar* _tmp61_;
			gchar* _tmp62_;
			gchar* _tmp63_;
			_tmp57_ = ret;
			_tmp58_ = c_call;
			_tmp59_ = go_namer_wrap_return_to_go (namer, _tmp58_, m);
			_tmp60_ = _tmp59_;
			_tmp61_ = g_strdup_printf ("    return %s\n", _tmp60_);
			_tmp62_ = _tmp61_;
			_tmp63_ = g_strconcat (_tmp57_, _tmp62_, NULL);
			_g_free0 (ret);
			ret = _tmp63_;
			_g_free0 (_tmp62_);
			_g_free0 (_tmp60_);
		}
		_g_free0 (c_call);
	} else {
		const gchar* _tmp64_;
		const gchar* _tmp65_;
		const gchar* _tmp66_;
		gchar* _tmp67_;
		gchar* _tmp68_;
		gchar* _tmp69_;
		const gchar* _tmp70_;
		const gchar* _tmp76_;
		gchar* _tmp77_;
		_tmp64_ = ret;
		_tmp65_ = cname;
		_tmp66_ = self_expr;
		_tmp67_ = g_strdup_printf ("    C.%s(%s", _tmp65_, _tmp66_);
		_tmp68_ = _tmp67_;
		_tmp69_ = g_strconcat (_tmp64_, _tmp68_, NULL);
		_g_free0 (ret);
		ret = _tmp69_;
		_g_free0 (_tmp68_);
		_tmp70_ = call_args;
		if (g_strcmp0 (_tmp70_, "") != 0) {
			const gchar* _tmp71_;
			const gchar* _tmp72_;
			gchar* _tmp73_;
			gchar* _tmp74_;
			gchar* _tmp75_;
			_tmp71_ = ret;
			_tmp72_ = call_args;
			_tmp73_ = g_strdup_printf (", %s", _tmp72_);
			_tmp74_ = _tmp73_;
			_tmp75_ = g_strconcat (_tmp71_, _tmp74_, NULL);
			_g_free0 (ret);
			ret = _tmp75_;
			_g_free0 (_tmp74_);
		}
		_tmp76_ = ret;
		_tmp77_ = g_strconcat (_tmp76_, ")\n", NULL);
		_g_free0 (ret);
		ret = _tmp77_;
	}
	_tmp78_ = ret;
	_tmp79_ = g_strconcat (_tmp78_, "}\n", NULL);
	_g_free0 (ret);
	ret = _tmp79_;
	go_src_writer_dedent (self);
	result = ret;
	_g_free0 (self_expr);
	_g_free0 (call_args);
	_g_free0 (preamble);
	_g_free0 (def_args);
	_g_free0 (cname);
	_g_free0 (classcname);
	_g_free0 (classname);
	return result;
}

static gchar*
go_src_writer_walk_constructor (GoSrcWriter* self,
                                GoNamer* namer,
                                ValaClass* c,
                                ValaMethod* m,
                                const gchar* free_function)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* classname = NULL;
	gchar* _tmp1_;
	gchar* classcname = NULL;
	gchar* _tmp2_;
	gchar* cname = NULL;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* preamble = NULL;
	gchar* call_args = NULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	const gchar* _tmp49_;
	gchar* _tmp50_;
	const gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	g_return_val_if_fail (m != NULL, NULL);
	g_return_val_if_fail (free_function != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = go_namer_get_class_name (namer, c);
	classname = _tmp1_;
	_tmp2_ = go_namer_get_class_cname (namer, c);
	classcname = _tmp2_;
	_tmp3_ = go_namer_get_method_cname (namer, m);
	cname = _tmp3_;
	_tmp4_ = classname;
	_tmp5_ = cname;
	_tmp6_ = g_strdup_printf ("walk_constructor(cls: %s, name: %s)", _tmp4_, _tmp5_);
	_tmp7_ = _tmp6_;
	go_src_writer_debug (self, _tmp7_);
	_g_free0 (_tmp7_);
	go_src_writer_indent (self);
	if (vala_symbol_is_private_symbol ((ValaSymbol*) m)) {
		go_src_writer_debug (self, "private.");
		go_src_writer_dedent (self);
		result = ret;
		_g_free0 (cname);
		_g_free0 (classcname);
		_g_free0 (classname);
		return result;
	}
	_tmp9_ = go_src_writer_get_function_call_parameters (self, namer, m, &_tmp8_);
	_g_free0 (preamble);
	preamble = _tmp8_;
	call_args = _tmp9_;
	self->priv->needs_unsafe = TRUE;
	_tmp10_ = ret;
	_tmp11_ = go_namer_get_constructor_name (namer, c, m);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strdup_printf ("func %s(", _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strconcat (_tmp10_, _tmp14_, NULL);
	_g_free0 (ret);
	ret = _tmp15_;
	_g_free0 (_tmp14_);
	_g_free0 (_tmp12_);
	_tmp16_ = ret;
	_tmp17_ = go_src_writer_get_function_declaration_parameters (self, namer, m);
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strdup_printf ("%s", _tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = g_strconcat (_tmp16_, _tmp20_, NULL);
	_g_free0 (ret);
	ret = _tmp21_;
	_g_free0 (_tmp20_);
	_g_free0 (_tmp18_);
	_tmp22_ = ret;
	_tmp23_ = classname;
	_tmp24_ = g_strdup_printf (") *%s {\n", _tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strconcat (_tmp22_, _tmp25_, NULL);
	_g_free0 (ret);
	ret = _tmp26_;
	_g_free0 (_tmp25_);
	_tmp27_ = ret;
	_tmp28_ = preamble;
	_tmp29_ = g_strconcat (_tmp27_, _tmp28_, NULL);
	_g_free0 (ret);
	ret = _tmp29_;
	_tmp30_ = ret;
	_tmp31_ = classname;
	_tmp32_ = cname;
	_tmp33_ = call_args;
	_tmp34_ = g_strdup_printf ("    ret := (*%s)(unsafe.Pointer(C.%s(%s)))\n", _tmp31_, _tmp32_, _tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = g_strconcat (_tmp30_, _tmp35_, NULL);
	_g_free0 (ret);
	ret = _tmp36_;
	_g_free0 (_tmp35_);
	if (g_strcmp0 (free_function, "") != 0) {
		const gchar* _tmp37_;
		const gchar* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		gchar* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		gchar* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		const gchar* _tmp47_;
		gchar* _tmp48_;
		self->priv->needs_runtime = TRUE;
		_tmp37_ = ret;
		_tmp38_ = classname;
		_tmp39_ = g_strdup_printf ("    runtime.SetFinalizer(ret, func(r *%s) {\n", _tmp38_);
		_tmp40_ = _tmp39_;
		_tmp41_ = g_strconcat (_tmp37_, _tmp40_, NULL);
		_g_free0 (ret);
		ret = _tmp41_;
		_g_free0 (_tmp40_);
		_tmp42_ = ret;
		_tmp43_ = classcname;
		_tmp44_ = g_strdup_printf ("        C.%s((*C.%s)(unsafe.Pointer(r)))\n", free_function, _tmp43_);
		_tmp45_ = _tmp44_;
		_tmp46_ = g_strconcat (_tmp42_, _tmp45_, NULL);
		_g_free0 (ret);
		ret = _tmp46_;
		_g_free0 (_tmp45_);
		_tmp47_ = ret;
		_tmp48_ = g_strconcat (_tmp47_, "    })\n", NULL);
		_g_free0 (ret);
		ret = _tmp48_;
	}
	_tmp49_ = ret;
	_tmp50_ = g_strconcat (_tmp49_, "    return ret\n", NULL);
	_g_free0 (ret);
	ret = _tmp50_;
	_tmp51_ = ret;
	_tmp52_ = g_strconcat (_tmp51_, "}\n", NULL);
	_g_free0 (ret);
	ret = _tmp52_;
	go_src_writer_dedent (self);
	result = ret;
	_g_free0 (call_args);
	_g_free0 (preamble);
	_g_free0 (cname);
	_g_free0 (classcname);
	_g_free0 (classname);
	return result;
}

static gchar*
go_src_writer_get_class_src (GoSrcWriter* self,
                             GoNamer* namer,
                             ValaClass* c)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GHashTable* _tmp29_;
	const gchar* _tmp30_;
	gconstpointer _tmp31_;
	GHashTable* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gboolean has_constructor = FALSE;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	const gchar* _tmp107_;
	gchar* _tmp108_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (namer != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	{
		ValaList* _k_list = NULL;
		ValaList* _tmp1_;
		gint _k_size = 0;
		ValaList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _k_index = 0;
		_tmp1_ = vala_object_type_symbol_get_structs ((ValaObjectTypeSymbol*) c);
		_k_list = _tmp1_;
		_tmp2_ = _k_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_k_size = _tmp4_;
		_k_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ValaStruct* k = NULL;
			ValaList* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp9_;
			ValaStruct* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			_k_index = _k_index + 1;
			_tmp5_ = _k_index;
			_tmp6_ = _k_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _k_list;
			_tmp8_ = vala_list_get (_tmp7_, _k_index);
			k = (ValaStruct*) _tmp8_;
			_tmp9_ = ret;
			_tmp10_ = k;
			_tmp11_ = go_src_writer_walk_struct (self, namer, _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_strconcat (_tmp9_, _tmp12_, NULL);
			_g_free0 (ret);
			ret = _tmp13_;
			_g_free0 (_tmp12_);
			_vala_code_node_unref0 (k);
		}
	}
	{
		ValaList* _k_list = NULL;
		ValaList* _tmp14_;
		gint _k_size = 0;
		ValaList* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		gint _k_index = 0;
		_tmp14_ = vala_object_type_symbol_get_classes ((ValaObjectTypeSymbol*) c);
		_k_list = _tmp14_;
		_tmp15_ = _k_list;
		_tmp16_ = vala_collection_get_size ((ValaCollection*) _tmp15_);
		_tmp17_ = _tmp16_;
		_k_size = _tmp17_;
		_k_index = -1;
		while (TRUE) {
			gint _tmp18_;
			gint _tmp19_;
			ValaClass* k = NULL;
			ValaList* _tmp20_;
			gpointer _tmp21_;
			const gchar* _tmp22_;
			ValaClass* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			_k_index = _k_index + 1;
			_tmp18_ = _k_index;
			_tmp19_ = _k_size;
			if (!(_tmp18_ < _tmp19_)) {
				break;
			}
			_tmp20_ = _k_list;
			_tmp21_ = vala_list_get (_tmp20_, _k_index);
			k = (ValaClass*) _tmp21_;
			_tmp22_ = ret;
			_tmp23_ = k;
			_tmp24_ = go_src_writer_walk_class (self, _tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = g_strconcat (_tmp22_, _tmp25_, NULL);
			_g_free0 (ret);
			ret = _tmp26_;
			_g_free0 (_tmp25_);
			_vala_code_node_unref0 (k);
		}
	}
	_tmp27_ = go_namer_get_class_name (namer, c);
	_g_free0 (self->priv->classname);
	self->priv->classname = _tmp27_;
	_tmp28_ = go_namer_get_class_cname (namer, c);
	_g_free0 (self->priv->classcname);
	self->priv->classcname = _tmp28_;
	go_src_writer_process_includes (self, (ValaSymbol*) c);
	_tmp29_ = self->priv->defined_classes;
	_tmp30_ = self->priv->classname;
	_tmp31_ = g_hash_table_lookup (_tmp29_, _tmp30_);
	if ((gboolean) ((gintptr) _tmp31_)) {
		go_src_writer_debug (self, "already defined");
		go_src_writer_dedent (self);
		result = ret;
		return result;
	}
	_tmp32_ = self->priv->defined_classes;
	_tmp33_ = self->priv->classname;
	_tmp34_ = g_strdup (_tmp33_);
	g_hash_table_insert (_tmp32_, _tmp34_, (gpointer) ((gintptr) TRUE));
	has_constructor = FALSE;
	{
		ValaList* _m_list = NULL;
		ValaList* _tmp35_;
		gint _m_size = 0;
		ValaList* _tmp36_;
		gint _tmp37_;
		gint _tmp38_;
		gint _m_index = 0;
		_tmp35_ = vala_object_type_symbol_get_methods ((ValaObjectTypeSymbol*) c);
		_m_list = _tmp35_;
		_tmp36_ = _m_list;
		_tmp37_ = vala_collection_get_size ((ValaCollection*) _tmp36_);
		_tmp38_ = _tmp37_;
		_m_size = _tmp38_;
		_m_index = -1;
		while (TRUE) {
			gint _tmp39_;
			gint _tmp40_;
			ValaMethod* m = NULL;
			ValaList* _tmp41_;
			gpointer _tmp42_;
			ValaMethod* _tmp43_;
			_m_index = _m_index + 1;
			_tmp39_ = _m_index;
			_tmp40_ = _m_size;
			if (!(_tmp39_ < _tmp40_)) {
				break;
			}
			_tmp41_ = _m_list;
			_tmp42_ = vala_list_get (_tmp41_, _m_index);
			m = (ValaMethod*) _tmp42_;
			_tmp43_ = m;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp43_, VALA_TYPE_CREATION_METHOD)) {
				has_constructor = TRUE;
				_vala_code_node_unref0 (m);
				break;
			}
			_vala_code_node_unref0 (m);
		}
	}
	_tmp44_ = ret;
	_tmp45_ = self->priv->classname;
	_tmp46_ = self->priv->classcname;
	_tmp47_ = g_strdup_printf ("type %s C.%s\n", _tmp45_, _tmp46_);
	_tmp48_ = _tmp47_;
	_tmp49_ = g_strconcat (_tmp44_, _tmp48_, NULL);
	_g_free0 (ret);
	ret = _tmp49_;
	_g_free0 (_tmp48_);
	{
		ValaList* _f_list = NULL;
		ValaList* _tmp50_;
		gint _f_size = 0;
		ValaList* _tmp51_;
		gint _tmp52_;
		gint _tmp53_;
		gint _f_index = 0;
		_tmp50_ = vala_object_type_symbol_get_fields ((ValaObjectTypeSymbol*) c);
		_f_list = _tmp50_;
		_tmp51_ = _f_list;
		_tmp52_ = vala_collection_get_size ((ValaCollection*) _tmp51_);
		_tmp53_ = _tmp52_;
		_f_size = _tmp53_;
		_f_index = -1;
		while (TRUE) {
			gint _tmp54_;
			gint _tmp55_;
			ValaField* f = NULL;
			ValaList* _tmp56_;
			gpointer _tmp57_;
			const gchar* _tmp58_;
			ValaField* _tmp59_;
			gchar* _tmp60_;
			gchar* _tmp61_;
			gchar* _tmp62_;
			_f_index = _f_index + 1;
			_tmp54_ = _f_index;
			_tmp55_ = _f_size;
			if (!(_tmp54_ < _tmp55_)) {
				break;
			}
			_tmp56_ = _f_list;
			_tmp57_ = vala_list_get (_tmp56_, _f_index);
			f = (ValaField*) _tmp57_;
			_tmp58_ = ret;
			_tmp59_ = f;
			_tmp60_ = go_src_writer_walk_class_field (self, namer, c, _tmp59_);
			_tmp61_ = _tmp60_;
			_tmp62_ = g_strconcat (_tmp58_, _tmp61_, NULL);
			_g_free0 (ret);
			ret = _tmp62_;
			_g_free0 (_tmp61_);
			_vala_code_node_unref0 (f);
		}
	}
	{
		ValaList* _e_list = NULL;
		ValaList* _tmp63_;
		gint _e_size = 0;
		ValaList* _tmp64_;
		gint _tmp65_;
		gint _tmp66_;
		gint _e_index = 0;
		_tmp63_ = vala_object_type_symbol_get_enums ((ValaObjectTypeSymbol*) c);
		_e_list = _tmp63_;
		_tmp64_ = _e_list;
		_tmp65_ = vala_collection_get_size ((ValaCollection*) _tmp64_);
		_tmp66_ = _tmp65_;
		_e_size = _tmp66_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp67_;
			gint _tmp68_;
			ValaEnum* e = NULL;
			ValaList* _tmp69_;
			gpointer _tmp70_;
			const gchar* _tmp71_;
			ValaEnum* _tmp72_;
			gchar* _tmp73_;
			gchar* _tmp74_;
			gchar* _tmp75_;
			_e_index = _e_index + 1;
			_tmp67_ = _e_index;
			_tmp68_ = _e_size;
			if (!(_tmp67_ < _tmp68_)) {
				break;
			}
			_tmp69_ = _e_list;
			_tmp70_ = vala_list_get (_tmp69_, _e_index);
			e = (ValaEnum*) _tmp70_;
			_tmp71_ = ret;
			_tmp72_ = e;
			_tmp73_ = go_src_writer_walk_enum (self, namer, _tmp72_);
			_tmp74_ = _tmp73_;
			_tmp75_ = g_strconcat (_tmp71_, _tmp74_, NULL);
			_g_free0 (ret);
			ret = _tmp75_;
			_g_free0 (_tmp74_);
			_vala_code_node_unref0 (e);
		}
	}
	{
		ValaList* _m_list = NULL;
		ValaList* _tmp76_;
		gint _m_size = 0;
		ValaList* _tmp77_;
		gint _tmp78_;
		gint _tmp79_;
		gint _m_index = 0;
		_tmp76_ = vala_object_type_symbol_get_methods ((ValaObjectTypeSymbol*) c);
		_m_list = _tmp76_;
		_tmp77_ = _m_list;
		_tmp78_ = vala_collection_get_size ((ValaCollection*) _tmp77_);
		_tmp79_ = _tmp78_;
		_m_size = _tmp79_;
		_m_index = -1;
		while (TRUE) {
			gint _tmp80_;
			gint _tmp81_;
			ValaMethod* m = NULL;
			ValaList* _tmp82_;
			gpointer _tmp83_;
			ValaMethod* _tmp84_;
			_m_index = _m_index + 1;
			_tmp80_ = _m_index;
			_tmp81_ = _m_size;
			if (!(_tmp80_ < _tmp81_)) {
				break;
			}
			_tmp82_ = _m_list;
			_tmp83_ = vala_list_get (_tmp82_, _m_index);
			m = (ValaMethod*) _tmp83_;
			_tmp84_ = m;
			if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp84_, VALA_TYPE_CREATION_METHOD)) {
				const gchar* _tmp85_;
				ValaMethod* _tmp86_;
				gchar* _tmp87_;
				gchar* _tmp88_;
				gchar* _tmp89_;
				_tmp85_ = ret;
				_tmp86_ = m;
				_tmp87_ = go_src_writer_walk_method (self, namer, c, _tmp86_);
				_tmp88_ = _tmp87_;
				_tmp89_ = g_strconcat (_tmp85_, _tmp88_, NULL);
				_g_free0 (ret);
				ret = _tmp89_;
				_g_free0 (_tmp88_);
			} else {
				gchar* free_function = NULL;
				gchar* _tmp90_;
				const gchar* _tmp101_;
				ValaMethod* _tmp102_;
				const gchar* _tmp103_;
				gchar* _tmp104_;
				gchar* _tmp105_;
				gchar* _tmp106_;
				_tmp90_ = g_strdup ("");
				free_function = _tmp90_;
				if (vala_is_reference_counting ((ValaTypeSymbol*) c)) {
					gchar* freefun = NULL;
					gchar* _tmp91_;
					gboolean _tmp92_ = FALSE;
					const gchar* _tmp93_;
					_tmp91_ = vala_get_ccode_unref_function ((ValaObjectTypeSymbol*) c);
					freefun = _tmp91_;
					_tmp93_ = freefun;
					if (_tmp93_ != NULL) {
						const gchar* _tmp94_;
						_tmp94_ = freefun;
						_tmp92_ = g_strcmp0 (_tmp94_, "") != 0;
					} else {
						_tmp92_ = FALSE;
					}
					if (_tmp92_) {
						const gchar* _tmp95_;
						gchar* _tmp96_;
						_tmp95_ = freefun;
						_tmp96_ = g_strdup (_tmp95_);
						_g_free0 (free_function);
						free_function = _tmp96_;
					}
					_g_free0 (freefun);
				} else {
					gchar* freefun = NULL;
					gchar* _tmp97_;
					const gchar* _tmp98_;
					_tmp97_ = vala_get_ccode_free_function ((ValaTypeSymbol*) c);
					freefun = _tmp97_;
					_tmp98_ = freefun;
					if (_tmp98_ != NULL) {
						const gchar* _tmp99_;
						gchar* _tmp100_;
						_tmp99_ = freefun;
						_tmp100_ = g_strdup (_tmp99_);
						_g_free0 (free_function);
						free_function = _tmp100_;
					}
					_g_free0 (freefun);
				}
				_tmp101_ = ret;
				_tmp102_ = m;
				_tmp103_ = free_function;
				_tmp104_ = go_src_writer_walk_constructor (self, namer, c, _tmp102_, _tmp103_);
				_tmp105_ = _tmp104_;
				_tmp106_ = g_strconcat (_tmp101_, _tmp105_, NULL);
				_g_free0 (ret);
				ret = _tmp106_;
				_g_free0 (_tmp105_);
				_g_free0 (free_function);
			}
			_vala_code_node_unref0 (m);
		}
	}
	if (namer->needs_unsafe) {
		self->priv->needs_unsafe = TRUE;
	}
	_tmp107_ = ret;
	_tmp108_ = g_strconcat (_tmp107_, "\n", NULL);
	_g_free0 (ret);
	ret = _tmp108_;
	go_src_writer_dedent (self);
	result = ret;
	return result;
}

static gchar*
go_src_writer_walk_class (GoSrcWriter* self,
                          ValaClass* c)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GHashTable* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (c != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) c);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("walk_class(name: %s)", _tmp2_);
	_tmp4_ = _tmp3_;
	go_src_writer_debug (self, _tmp4_);
	_g_free0 (_tmp4_);
	go_src_writer_indent (self);
	_tmp5_ = self->priv->generic_classes;
	_tmp6_ = vala_symbol_get_name ((ValaSymbol*) c);
	_tmp7_ = _tmp6_;
	if (g_hash_table_contains (_tmp5_, _tmp7_)) {
		GHashTable* specializations = NULL;
		GHashTable* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gconstpointer _tmp11_;
		GList* keys = NULL;
		GHashTable* _tmp12_;
		GList* _tmp13_;
		GList* _tmp14_;
		go_src_writer_debug (self, "generic class");
		go_src_writer_indent (self);
		_tmp8_ = self->priv->generic_classes;
		_tmp9_ = vala_symbol_get_name ((ValaSymbol*) c);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_hash_table_lookup (_tmp8_, _tmp10_);
		specializations = (GHashTable*) _tmp11_;
		_tmp12_ = specializations;
		_tmp13_ = g_hash_table_get_keys (_tmp12_);
		keys = _tmp13_;
		_tmp14_ = keys;
		{
			GList* k_collection = NULL;
			GList* k_it = NULL;
			k_collection = _tmp14_;
			for (k_it = k_collection; k_it != NULL; k_it = k_it->next) {
				const gchar* k = NULL;
				k = (const gchar*) k_it->data;
				{
					GList* v = NULL;
					GHashTable* _tmp15_;
					const gchar* _tmp16_;
					gconstpointer _tmp17_;
					const gchar* _tmp18_;
					gchar* _tmp19_;
					gchar* _tmp20_;
					GoNamer* namer = NULL;
					GoNamer* _tmp21_;
					GList* vv = NULL;
					GList* _tmp22_;
					GList* _tmp23_;
					const gchar* _tmp47_;
					const gchar* _tmp48_;
					const gchar* _tmp49_;
					gchar* _tmp50_;
					gchar* _tmp51_;
					gchar* _tmp52_;
					GList* _tmp53_;
					GList* _tmp54_;
					const gchar* _tmp62_;
					gchar* _tmp63_;
					const gchar* _tmp64_;
					GoNamer* _tmp65_;
					gchar* _tmp66_;
					gchar* _tmp67_;
					gchar* _tmp68_;
					_tmp15_ = specializations;
					_tmp16_ = k;
					_tmp17_ = g_hash_table_lookup (_tmp15_, _tmp16_);
					v = (GList*) _tmp17_;
					_tmp18_ = k;
					_tmp19_ = g_strdup_printf ("specialization: %s", _tmp18_);
					_tmp20_ = _tmp19_;
					go_src_writer_debug (self, _tmp20_);
					_g_free0 (_tmp20_);
					go_src_writer_indent (self);
					_tmp21_ = go_namer_new ("");
					namer = _tmp21_;
					_tmp22_ = v;
					_tmp23_ = g_list_copy (_tmp22_);
					vv = _tmp23_;
					{
						ValaList* _t_list = NULL;
						ValaList* _tmp24_;
						gint _t_size = 0;
						ValaList* _tmp25_;
						gint _tmp26_;
						gint _tmp27_;
						gint _t_index = 0;
						_tmp24_ = vala_object_type_symbol_get_type_parameters ((ValaObjectTypeSymbol*) c);
						_t_list = _tmp24_;
						_tmp25_ = _t_list;
						_tmp26_ = vala_collection_get_size ((ValaCollection*) _tmp25_);
						_tmp27_ = _tmp26_;
						_t_size = _tmp27_;
						_t_index = -1;
						while (TRUE) {
							gint _tmp28_;
							gint _tmp29_;
							ValaTypeParameter* t = NULL;
							ValaList* _tmp30_;
							gpointer _tmp31_;
							ValaTypeParameter* _tmp32_;
							const gchar* _tmp33_;
							const gchar* _tmp34_;
							GList* _tmp35_;
							gconstpointer _tmp36_;
							gchar* _tmp37_;
							gchar* _tmp38_;
							gchar* _tmp39_;
							gchar* _tmp40_;
							GoNamer* _tmp41_;
							ValaTypeParameter* _tmp42_;
							GList* _tmp43_;
							gconstpointer _tmp44_;
							GList* _tmp45_;
							GList* _tmp46_;
							_t_index = _t_index + 1;
							_tmp28_ = _t_index;
							_tmp29_ = _t_size;
							if (!(_tmp28_ < _tmp29_)) {
								break;
							}
							_tmp30_ = _t_list;
							_tmp31_ = vala_list_get (_tmp30_, _t_index);
							t = (ValaTypeParameter*) _tmp31_;
							_tmp32_ = t;
							_tmp33_ = vala_symbol_get_name ((ValaSymbol*) _tmp32_);
							_tmp34_ = _tmp33_;
							_tmp35_ = vv;
							_tmp36_ = g_list_nth_data (_tmp35_, (guint) 0);
							_tmp37_ = vala_code_node_to_string ((ValaCodeNode*) ((ValaDataType*) _tmp36_));
							_tmp38_ = _tmp37_;
							_tmp39_ = g_strdup_printf ("%s -> %s", _tmp34_, _tmp38_);
							_tmp40_ = _tmp39_;
							go_src_writer_debug (self, _tmp40_);
							_g_free0 (_tmp40_);
							_g_free0 (_tmp38_);
							_tmp41_ = namer;
							_tmp42_ = t;
							_tmp43_ = vv;
							_tmp44_ = g_list_nth_data (_tmp43_, (guint) 0);
							go_namer_add_specialization (_tmp41_, _tmp42_, (ValaDataType*) _tmp44_);
							_tmp45_ = vv;
							_tmp46_ = g_list_nth (_tmp45_, (guint) 0);
							vv = g_list_delete_link (vv, _tmp46_);
							_vala_code_node_unref0 (t);
						}
					}
					_tmp47_ = ret;
					_tmp48_ = vala_symbol_get_name ((ValaSymbol*) c);
					_tmp49_ = _tmp48_;
					_tmp50_ = g_strdup_printf ("// %s<", _tmp49_);
					_tmp51_ = _tmp50_;
					_tmp52_ = g_strconcat (_tmp47_, _tmp51_, NULL);
					_g_free0 (ret);
					ret = _tmp52_;
					_g_free0 (_tmp51_);
					_tmp53_ = v;
					_tmp54_ = g_list_copy (_tmp53_);
					{
						GList* t_collection = NULL;
						GList* t_it = NULL;
						t_collection = _tmp54_;
						for (t_it = t_collection; t_it != NULL; t_it = t_it->next) {
							ValaDataType* t = NULL;
							t = (ValaDataType*) t_it->data;
							{
								const gchar* _tmp55_;
								ValaDataType* _tmp56_;
								gchar* _tmp57_;
								gchar* _tmp58_;
								gchar* _tmp59_;
								const gchar* _tmp60_;
								gchar* _tmp61_;
								_tmp55_ = ret;
								_tmp56_ = t;
								_tmp57_ = vala_code_node_to_string ((ValaCodeNode*) _tmp56_);
								_tmp58_ = _tmp57_;
								_tmp59_ = g_strconcat (_tmp55_, _tmp58_, NULL);
								_g_free0 (ret);
								ret = _tmp59_;
								_g_free0 (_tmp58_);
								_tmp60_ = ret;
								_tmp61_ = g_strconcat (_tmp60_, ", ", NULL);
								_g_free0 (ret);
								ret = _tmp61_;
							}
						}
						(t_collection == NULL) ? NULL : (t_collection = (g_list_free (t_collection), NULL));
					}
					_tmp62_ = ret;
					_tmp63_ = g_strconcat (_tmp62_, ">\n", NULL);
					_g_free0 (ret);
					ret = _tmp63_;
					_tmp64_ = ret;
					_tmp65_ = namer;
					_tmp66_ = go_src_writer_get_class_src (self, _tmp65_, c);
					_tmp67_ = _tmp66_;
					_tmp68_ = g_strconcat (_tmp64_, _tmp67_, NULL);
					_g_free0 (ret);
					ret = _tmp68_;
					_g_free0 (_tmp67_);
					go_src_writer_dedent (self);
					(vv == NULL) ? NULL : (vv = (g_list_free (vv), NULL));
					_go_namer_unref0 (namer);
				}
			}
		}
		go_src_writer_dedent (self);
		(keys == NULL) ? NULL : (keys = (g_list_free (keys), NULL));
	} else {
		GoNamer* namer = NULL;
		GoNamer* _tmp69_;
		const gchar* _tmp70_;
		GoNamer* _tmp71_;
		gchar* _tmp72_;
		gchar* _tmp73_;
		gchar* _tmp74_;
		_tmp69_ = go_namer_new ("");
		namer = _tmp69_;
		_tmp70_ = ret;
		_tmp71_ = namer;
		_tmp72_ = go_src_writer_get_class_src (self, _tmp71_, c);
		_tmp73_ = _tmp72_;
		_tmp74_ = g_strconcat (_tmp70_, _tmp73_, NULL);
		_g_free0 (ret);
		ret = _tmp74_;
		_g_free0 (_tmp73_);
		_go_namer_unref0 (namer);
	}
	go_src_writer_dedent (self);
	result = ret;
	return result;
}

static gpointer
_vala_source_reference_ref0 (gpointer self)
{
	return self ? vala_source_reference_ref (self) : NULL;
}

static void
go_src_writer_real_visit_namespace (ValaCodeVisitor* base,
                                    ValaNamespace* ns)
{
	GoSrcWriter * self;
	gchar* ret = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	ValaSourceReference* sr = NULL;
	ValaSourceReference* _tmp8_;
	ValaSourceReference* _tmp9_;
	ValaSourceReference* _tmp10_;
	gboolean _tmp11_ = FALSE;
	ValaSourceReference* _tmp12_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	ValaList* _tmp63_;
	gint _tmp64_;
	gint _tmp65_;
	ValaList* _tmp66_;
	gint _tmp67_;
	gint _tmp68_;
	const gchar* _tmp141_;
	const gchar* _tmp142_;
	gchar* _tmp143_;
	self = (GoSrcWriter*) base;
	g_return_if_fail (ns != NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) ns);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("walk_namespace(name: %s)", _tmp2_);
	_tmp4_ = _tmp3_;
	go_src_writer_debug (self, _tmp4_);
	_g_free0 (_tmp4_);
	go_src_writer_indent (self);
	_tmp5_ = vala_symbol_get_name ((ValaSymbol*) ns);
	_tmp6_ = _tmp5_;
	if (g_strcmp0 (_tmp6_, "") == 0) {
		_g_free0 (ret);
		return;
	}
	_tmp7_ = g_strdup ("");
	_g_free0 (self->priv->classname);
	self->priv->classname = _tmp7_;
	_tmp8_ = vala_code_node_get_source_reference ((ValaCodeNode*) ns);
	_tmp9_ = _tmp8_;
	_tmp10_ = _vala_source_reference_ref0 (_tmp9_);
	sr = _tmp10_;
	_tmp12_ = sr;
	if (_tmp12_ == NULL) {
		_tmp11_ = TRUE;
	} else {
		ValaSourceReference* _tmp13_;
		ValaSourceFile* _tmp14_;
		ValaSourceFile* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		_tmp13_ = sr;
		_tmp14_ = vala_source_reference_get_file (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = vala_source_file_get_filename (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp11_ = !go_src_writer_is_target_file (self, _tmp17_);
	}
	if (_tmp11_) {
		go_src_writer_dedent (self);
		_vala_source_reference_unref0 (sr);
		_g_free0 (ret);
		return;
	}
	_tmp18_ = vala_symbol_get_name ((ValaSymbol*) ns);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strdup (_tmp19_);
	_g_free0 (self->priv->nspace);
	self->priv->nspace = _tmp20_;
	go_src_writer_process_includes (self, (ValaSymbol*) ns);
	{
		ValaList* _e_list = NULL;
		ValaList* _tmp21_;
		gint _e_size = 0;
		ValaList* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		gint _e_index = 0;
		_tmp21_ = vala_namespace_get_enums (ns);
		_e_list = _tmp21_;
		_tmp22_ = _e_list;
		_tmp23_ = vala_collection_get_size ((ValaCollection*) _tmp22_);
		_tmp24_ = _tmp23_;
		_e_size = _tmp24_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp25_;
			gint _tmp26_;
			ValaEnum* e = NULL;
			ValaList* _tmp27_;
			gpointer _tmp28_;
			const gchar* _tmp29_ = NULL;
			const gchar* _tmp30_;
			const gchar* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp35_;
			GoNamer* _tmp36_;
			GoNamer* _tmp37_;
			ValaEnum* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			gchar* _tmp41_;
			_e_index = _e_index + 1;
			_tmp25_ = _e_index;
			_tmp26_ = _e_size;
			if (!(_tmp25_ < _tmp26_)) {
				break;
			}
			_tmp27_ = _e_list;
			_tmp28_ = vala_list_get (_tmp27_, _e_index);
			e = (ValaEnum*) _tmp28_;
			_tmp30_ = vala_symbol_get_name ((ValaSymbol*) ns);
			_tmp31_ = _tmp30_;
			_tmp32_ = ((ValabindWriter*) self)->modulename;
			if (g_strcmp0 (_tmp31_, _tmp32_) == 0) {
				const gchar* _tmp33_;
				const gchar* _tmp34_;
				_tmp33_ = vala_symbol_get_name ((ValaSymbol*) ns);
				_tmp34_ = _tmp33_;
				_tmp29_ = _tmp34_;
			} else {
				_tmp29_ = "";
			}
			_tmp35_ = ret;
			_tmp36_ = go_namer_new (_tmp29_);
			_tmp37_ = _tmp36_;
			_tmp38_ = e;
			_tmp39_ = go_src_writer_walk_enum (self, _tmp37_, _tmp38_);
			_tmp40_ = _tmp39_;
			_tmp41_ = g_strconcat (_tmp35_, _tmp40_, NULL);
			_g_free0 (ret);
			ret = _tmp41_;
			_g_free0 (_tmp40_);
			_go_namer_unref0 (_tmp37_);
			_vala_code_node_unref0 (e);
		}
	}
	{
		ValaList* _c_list = NULL;
		ValaList* _tmp42_;
		gint _c_size = 0;
		ValaList* _tmp43_;
		gint _tmp44_;
		gint _tmp45_;
		gint _c_index = 0;
		_tmp42_ = vala_namespace_get_structs (ns);
		_c_list = _tmp42_;
		_tmp43_ = _c_list;
		_tmp44_ = vala_collection_get_size ((ValaCollection*) _tmp43_);
		_tmp45_ = _tmp44_;
		_c_size = _tmp45_;
		_c_index = -1;
		while (TRUE) {
			gint _tmp46_;
			gint _tmp47_;
			ValaStruct* c = NULL;
			ValaList* _tmp48_;
			gpointer _tmp49_;
			const gchar* _tmp50_ = NULL;
			const gchar* _tmp51_;
			const gchar* _tmp52_;
			const gchar* _tmp53_;
			const gchar* _tmp56_;
			GoNamer* _tmp57_;
			GoNamer* _tmp58_;
			ValaStruct* _tmp59_;
			gchar* _tmp60_;
			gchar* _tmp61_;
			gchar* _tmp62_;
			_c_index = _c_index + 1;
			_tmp46_ = _c_index;
			_tmp47_ = _c_size;
			if (!(_tmp46_ < _tmp47_)) {
				break;
			}
			_tmp48_ = _c_list;
			_tmp49_ = vala_list_get (_tmp48_, _c_index);
			c = (ValaStruct*) _tmp49_;
			_tmp51_ = vala_symbol_get_name ((ValaSymbol*) ns);
			_tmp52_ = _tmp51_;
			_tmp53_ = ((ValabindWriter*) self)->modulename;
			if (g_strcmp0 (_tmp52_, _tmp53_) == 0) {
				const gchar* _tmp54_;
				const gchar* _tmp55_;
				_tmp54_ = vala_symbol_get_name ((ValaSymbol*) ns);
				_tmp55_ = _tmp54_;
				_tmp50_ = _tmp55_;
			} else {
				_tmp50_ = "";
			}
			_tmp56_ = ret;
			_tmp57_ = go_namer_new (_tmp50_);
			_tmp58_ = _tmp57_;
			_tmp59_ = c;
			_tmp60_ = go_src_writer_walk_struct (self, _tmp58_, _tmp59_);
			_tmp61_ = _tmp60_;
			_tmp62_ = g_strconcat (_tmp56_, _tmp61_, NULL);
			_g_free0 (ret);
			ret = _tmp62_;
			_g_free0 (_tmp61_);
			_go_namer_unref0 (_tmp58_);
			_vala_code_node_unref0 (c);
		}
	}
	_tmp63_ = vala_namespace_get_methods (ns);
	_tmp64_ = vala_collection_get_size ((ValaCollection*) _tmp63_);
	_tmp65_ = _tmp64_;
	_tmp66_ = vala_namespace_get_fields (ns);
	_tmp67_ = vala_collection_get_size ((ValaCollection*) _tmp66_);
	_tmp68_ = _tmp67_;
	if ((_tmp65_ + _tmp68_) > 0) {
		gchar* fake_ns_name = NULL;
		const gchar* _tmp69_;
		const gchar* _tmp70_;
		gchar* _tmp71_;
		const gchar* _tmp72_;
		const gchar* _tmp73_;
		gchar* _tmp74_;
		gchar* _tmp75_;
		gchar* _tmp76_;
		const gchar* _tmp119_;
		const gchar* _tmp120_;
		const gchar* _tmp121_;
		const gchar* _tmp122_;
		gchar* _tmp123_;
		gchar* _tmp124_;
		gchar* _tmp125_;
		const gchar* _tmp126_;
		gchar* _tmp127_;
		_tmp69_ = vala_symbol_get_name ((ValaSymbol*) ns);
		_tmp70_ = _tmp69_;
		_tmp71_ = g_strdup_printf ("nsimp%s", _tmp70_);
		fake_ns_name = _tmp71_;
		_tmp72_ = ret;
		_tmp73_ = fake_ns_name;
		_tmp74_ = g_strdup_printf ("type %s int\n", _tmp73_);
		_tmp75_ = _tmp74_;
		_tmp76_ = g_strconcat (_tmp72_, _tmp75_, NULL);
		_g_free0 (ret);
		ret = _tmp76_;
		_g_free0 (_tmp75_);
		{
			ValaList* _c_list = NULL;
			ValaList* _tmp77_;
			gint _c_size = 0;
			ValaList* _tmp78_;
			gint _tmp79_;
			gint _tmp80_;
			gint _c_index = 0;
			_tmp77_ = vala_namespace_get_fields (ns);
			_c_list = _tmp77_;
			_tmp78_ = _c_list;
			_tmp79_ = vala_collection_get_size ((ValaCollection*) _tmp78_);
			_tmp80_ = _tmp79_;
			_c_size = _tmp80_;
			_c_index = -1;
			while (TRUE) {
				gint _tmp81_;
				gint _tmp82_;
				ValaField* c = NULL;
				ValaList* _tmp83_;
				gpointer _tmp84_;
				const gchar* _tmp85_ = NULL;
				const gchar* _tmp86_;
				const gchar* _tmp87_;
				const gchar* _tmp88_;
				const gchar* _tmp91_;
				GoNamer* _tmp92_;
				GoNamer* _tmp93_;
				ValaField* _tmp94_;
				gchar* _tmp95_;
				gchar* _tmp96_;
				gchar* _tmp97_;
				_c_index = _c_index + 1;
				_tmp81_ = _c_index;
				_tmp82_ = _c_size;
				if (!(_tmp81_ < _tmp82_)) {
					break;
				}
				_tmp83_ = _c_list;
				_tmp84_ = vala_list_get (_tmp83_, _c_index);
				c = (ValaField*) _tmp84_;
				_tmp86_ = vala_symbol_get_name ((ValaSymbol*) ns);
				_tmp87_ = _tmp86_;
				_tmp88_ = ((ValabindWriter*) self)->modulename;
				if (g_strcmp0 (_tmp87_, _tmp88_) == 0) {
					const gchar* _tmp89_;
					const gchar* _tmp90_;
					_tmp89_ = vala_symbol_get_name ((ValaSymbol*) ns);
					_tmp90_ = _tmp89_;
					_tmp85_ = _tmp90_;
				} else {
					_tmp85_ = "";
				}
				_tmp91_ = ret;
				_tmp92_ = go_namer_new (_tmp85_);
				_tmp93_ = _tmp92_;
				_tmp94_ = c;
				_tmp95_ = go_src_writer_walk_namespace_field (self, _tmp93_, ns, _tmp94_);
				_tmp96_ = _tmp95_;
				_tmp97_ = g_strconcat (_tmp91_, _tmp96_, NULL);
				_g_free0 (ret);
				ret = _tmp97_;
				_g_free0 (_tmp96_);
				_go_namer_unref0 (_tmp93_);
				_vala_code_node_unref0 (c);
			}
		}
		{
			ValaList* _m_list = NULL;
			ValaList* _tmp98_;
			gint _m_size = 0;
			ValaList* _tmp99_;
			gint _tmp100_;
			gint _tmp101_;
			gint _m_index = 0;
			_tmp98_ = vala_namespace_get_methods (ns);
			_m_list = _tmp98_;
			_tmp99_ = _m_list;
			_tmp100_ = vala_collection_get_size ((ValaCollection*) _tmp99_);
			_tmp101_ = _tmp100_;
			_m_size = _tmp101_;
			_m_index = -1;
			while (TRUE) {
				gint _tmp102_;
				gint _tmp103_;
				ValaMethod* m = NULL;
				ValaList* _tmp104_;
				gpointer _tmp105_;
				const gchar* _tmp106_ = NULL;
				const gchar* _tmp107_;
				const gchar* _tmp108_;
				const gchar* _tmp109_;
				const gchar* _tmp112_;
				GoNamer* _tmp113_;
				GoNamer* _tmp114_;
				ValaMethod* _tmp115_;
				gchar* _tmp116_;
				gchar* _tmp117_;
				gchar* _tmp118_;
				_m_index = _m_index + 1;
				_tmp102_ = _m_index;
				_tmp103_ = _m_size;
				if (!(_tmp102_ < _tmp103_)) {
					break;
				}
				_tmp104_ = _m_list;
				_tmp105_ = vala_list_get (_tmp104_, _m_index);
				m = (ValaMethod*) _tmp105_;
				_tmp107_ = vala_symbol_get_name ((ValaSymbol*) ns);
				_tmp108_ = _tmp107_;
				_tmp109_ = ((ValabindWriter*) self)->modulename;
				if (g_strcmp0 (_tmp108_, _tmp109_) == 0) {
					const gchar* _tmp110_;
					const gchar* _tmp111_;
					_tmp110_ = vala_symbol_get_name ((ValaSymbol*) ns);
					_tmp111_ = _tmp110_;
					_tmp106_ = _tmp111_;
				} else {
					_tmp106_ = "";
				}
				_tmp112_ = ret;
				_tmp113_ = go_namer_new (_tmp106_);
				_tmp114_ = _tmp113_;
				_tmp115_ = m;
				_tmp116_ = go_src_writer_walk_function (self, _tmp114_, ns, _tmp115_);
				_tmp117_ = _tmp116_;
				_tmp118_ = g_strconcat (_tmp112_, _tmp117_, NULL);
				_g_free0 (ret);
				ret = _tmp118_;
				_g_free0 (_tmp117_);
				_go_namer_unref0 (_tmp114_);
				_vala_code_node_unref0 (m);
			}
		}
		_tmp119_ = ret;
		_tmp120_ = vala_symbol_get_name ((ValaSymbol*) ns);
		_tmp121_ = _tmp120_;
		_tmp122_ = fake_ns_name;
		_tmp123_ = g_strdup_printf ("var %s %s\n", _tmp121_, _tmp122_);
		_tmp124_ = _tmp123_;
		_tmp125_ = g_strconcat (_tmp119_, _tmp124_, NULL);
		_g_free0 (ret);
		ret = _tmp125_;
		_g_free0 (_tmp124_);
		_tmp126_ = ret;
		_tmp127_ = g_strconcat (_tmp126_, "\n", NULL);
		_g_free0 (ret);
		ret = _tmp127_;
		_g_free0 (fake_ns_name);
	}
	{
		ValaList* _c_list = NULL;
		ValaList* _tmp128_;
		gint _c_size = 0;
		ValaList* _tmp129_;
		gint _tmp130_;
		gint _tmp131_;
		gint _c_index = 0;
		_tmp128_ = vala_namespace_get_classes (ns);
		_c_list = _tmp128_;
		_tmp129_ = _c_list;
		_tmp130_ = vala_collection_get_size ((ValaCollection*) _tmp129_);
		_tmp131_ = _tmp130_;
		_c_size = _tmp131_;
		_c_index = -1;
		while (TRUE) {
			gint _tmp132_;
			gint _tmp133_;
			ValaClass* c = NULL;
			ValaList* _tmp134_;
			gpointer _tmp135_;
			const gchar* _tmp136_;
			ValaClass* _tmp137_;
			gchar* _tmp138_;
			gchar* _tmp139_;
			gchar* _tmp140_;
			_c_index = _c_index + 1;
			_tmp132_ = _c_index;
			_tmp133_ = _c_size;
			if (!(_tmp132_ < _tmp133_)) {
				break;
			}
			_tmp134_ = _c_list;
			_tmp135_ = vala_list_get (_tmp134_, _c_index);
			c = (ValaClass*) _tmp135_;
			_tmp136_ = ret;
			_tmp137_ = c;
			_tmp138_ = go_src_writer_walk_class (self, _tmp137_);
			_tmp139_ = _tmp138_;
			_tmp140_ = g_strconcat (_tmp136_, _tmp139_, NULL);
			_g_free0 (ret);
			ret = _tmp140_;
			_g_free0 (_tmp139_);
			_vala_code_node_unref0 (c);
		}
	}
	go_src_writer_dedent (self);
	_tmp141_ = self->priv->defs;
	_tmp142_ = ret;
	_tmp143_ = g_strconcat (_tmp141_, _tmp142_, NULL);
	_g_free0 (self->priv->defs);
	self->priv->defs = _tmp143_;
	_vala_source_reference_unref0 (sr);
	_g_free0 (ret);
}

static void
go_src_writer_real_write (ValabindWriter* base,
                          const gchar* file)
{
	GoSrcWriter * self;
	FILE* stream = NULL;
	FILE* _tmp0_;
	FILE* _tmp1_;
	ValaCodeContext* _tmp4_;
	gchar* pre = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GList* _tmp16_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gboolean _tmp25_ = FALSE;
	FILE* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	FILE* _tmp36_;
	const gchar* _tmp37_;
	FILE* _tmp38_;
	const gchar* _tmp39_;
	FILE* _tmp40_;
	const gchar* _tmp41_;
	FILE* _tmp42_;
	const gchar* _tmp43_;
	FILE* _tmp44_;
	const gchar* _tmp45_;
	self = (GoSrcWriter*) base;
	g_return_if_fail (file != NULL);
	_tmp0_ = g_fopen (file, "w");
	stream = _tmp0_;
	_tmp1_ = stream;
	if (_tmp1_ == NULL) {
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = g_strdup_printf ("Cannot open %s for writing", file);
		_tmp3_ = _tmp2_;
		error (_tmp3_);
		_g_free0 (_tmp3_);
	}
	_tmp4_ = ((ValabindWriter*) self)->context;
	vala_code_context_accept (_tmp4_, (ValaCodeVisitor*) self);
	_tmp5_ = ((ValabindWriter*) self)->modulename;
	_tmp6_ = g_strdup_printf ("package %s\n", _tmp5_);
	pre = _tmp6_;
	_tmp7_ = pre;
	_tmp8_ = g_strconcat (_tmp7_, "\n", NULL);
	_g_free0 (pre);
	pre = _tmp8_;
	_tmp9_ = pre;
	_tmp10_ = ((ValabindWriter*) self)->library;
	_tmp11_ = g_strdup_printf ("// #cgo LDFLAGS: -l%s\n", _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat (_tmp9_, _tmp12_, NULL);
	_g_free0 (pre);
	pre = _tmp13_;
	_g_free0 (_tmp12_);
	if (self->priv->needs_unsafe) {
		const gchar* _tmp14_;
		gchar* _tmp15_;
		_tmp14_ = pre;
		_tmp15_ = g_strconcat (_tmp14_, "// #include <stdlib.h>\n", NULL);
		_g_free0 (pre);
		pre = _tmp15_;
	}
	_tmp16_ = ((ValabindWriter*) self)->includefiles;
	{
		GList* inc_collection = NULL;
		GList* inc_it = NULL;
		inc_collection = _tmp16_;
		for (inc_it = inc_collection; inc_it != NULL; inc_it = inc_it->next) {
			gchar* _tmp17_;
			gchar* inc = NULL;
			_tmp17_ = g_strdup ((const gchar*) inc_it->data);
			inc = _tmp17_;
			{
				const gchar* _tmp18_;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				gchar* _tmp22_;
				_tmp18_ = pre;
				_tmp19_ = inc;
				_tmp20_ = g_strdup_printf ("// #include \"%s\"\n", _tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = g_strconcat (_tmp18_, _tmp21_, NULL);
				_g_free0 (pre);
				pre = _tmp22_;
				_g_free0 (_tmp21_);
				_g_free0 (inc);
			}
		}
	}
	_tmp23_ = pre;
	_tmp24_ = g_strconcat (_tmp23_, "import \"C\"\n", NULL);
	_g_free0 (pre);
	pre = _tmp24_;
	if (self->priv->needs_unsafe) {
		_tmp25_ = TRUE;
	} else {
		_tmp25_ = self->priv->needs_runtime;
	}
	if (_tmp25_) {
		const gchar* _tmp26_;
		gchar* _tmp27_;
		_tmp26_ = pre;
		_tmp27_ = g_strconcat (_tmp26_, "\n", NULL);
		_g_free0 (pre);
		pre = _tmp27_;
	}
	if (self->priv->needs_unsafe) {
		const gchar* _tmp28_;
		gchar* _tmp29_;
		_tmp28_ = pre;
		_tmp29_ = g_strconcat (_tmp28_, "import \"unsafe\"\n", NULL);
		_g_free0 (pre);
		pre = _tmp29_;
	}
	if (self->priv->needs_runtime) {
		const gchar* _tmp30_;
		gchar* _tmp31_;
		_tmp30_ = pre;
		_tmp31_ = g_strconcat (_tmp30_, "import \"runtime\"\n", NULL);
		_g_free0 (pre);
		pre = _tmp31_;
	}
	_tmp32_ = stream;
	_tmp33_ = ((ValabindWriter*) self)->modulename;
	_tmp34_ = g_strdup_printf ("/* valabind autogenerated Go bindings for %s */\n", _tmp33_);
	_tmp35_ = _tmp34_;
	fprintf (_tmp32_, "%s", _tmp35_);
	_g_free0 (_tmp35_);
	_tmp36_ = stream;
	_tmp37_ = pre;
	fprintf (_tmp36_, "%s\n", _tmp37_);
	_tmp38_ = stream;
	_tmp39_ = self->priv->enums;
	fprintf (_tmp38_, "%s\n", _tmp39_);
	_tmp40_ = stream;
	_tmp41_ = self->priv->statics;
	fprintf (_tmp40_, "%s\n", _tmp41_);
	_tmp42_ = stream;
	_tmp43_ = self->priv->defs;
	fprintf (_tmp42_, "%s\n", _tmp43_);
	_tmp44_ = stream;
	_tmp45_ = self->priv->extends;
	fprintf (_tmp44_, "%s\n", _tmp45_);
	_g_free0 (pre);
	_fclose0 (stream);
}

static void
go_src_writer_class_init (GoSrcWriterClass * klass,
                          gpointer klass_data)
{
	go_src_writer_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->finalize = go_src_writer_finalize;
	g_type_class_adjust_private_offset (klass, &GoSrcWriter_private_offset);
	((ValaCodeVisitorClass *) klass)->visit_source_file = (void (*) (ValaCodeVisitor*, ValaSourceFile*)) go_src_writer_real_visit_source_file;
	((ValaCodeVisitorClass *) klass)->visit_namespace = (void (*) (ValaCodeVisitor*, ValaNamespace*)) go_src_writer_real_visit_namespace;
	((ValabindWriterClass *) klass)->write = (void (*) (ValabindWriter*, const gchar*)) go_src_writer_real_write;
}

static void
go_src_writer_instance_init (GoSrcWriter * self,
                             gpointer klass)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashFunc _tmp3_;
	GEqualFunc _tmp4_;
	GHashTable* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	self->priv = go_src_writer_get_instance_private (self);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, NULL);
	self->priv->defined_classes = _tmp2_;
	_tmp3_ = g_str_hash;
	_tmp4_ = g_str_equal;
	_tmp5_ = g_hash_table_new_full (_tmp3_, _tmp4_, _g_free0_, _g_hash_table_unref0_);
	self->priv->generic_classes = _tmp5_;
	_tmp6_ = g_strdup ("");
	self->priv->classname = _tmp6_;
	_tmp7_ = g_strdup ("");
	self->priv->defs = _tmp7_;
	_tmp8_ = g_strdup ("");
	self->priv->statics = _tmp8_;
	_tmp9_ = g_strdup ("");
	self->priv->extends = _tmp9_;
	_tmp10_ = g_strdup ("");
	self->priv->enums = _tmp10_;
	self->priv->needs_unsafe = FALSE;
	self->priv->needs_runtime = FALSE;
	_tmp11_ = g_strdup ("");
	self->priv->_indent = _tmp11_;
}

static void
go_src_writer_finalize (ValaCodeVisitor * obj)
{
	GoSrcWriter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GO_SRC_WRITER, GoSrcWriter);
	_g_hash_table_unref0 (self->priv->defined_classes);
	_g_hash_table_unref0 (self->priv->generic_classes);
	_g_free0 (self->priv->classname);
	_g_free0 (self->priv->classcname);
	_g_free0 (self->priv->defs);
	_g_free0 (self->priv->statics);
	_g_free0 (self->priv->extends);
	_g_free0 (self->priv->enums);
	_g_free0 (self->priv->nspace);
	_g_free0 (self->priv->_indent);
	VALA_CODE_VISITOR_CLASS (go_src_writer_parent_class)->finalize (obj);
}

static GType
go_src_writer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GoSrcWriterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) go_src_writer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GoSrcWriter), 0, (GInstanceInitFunc) go_src_writer_instance_init, NULL };
	GType go_src_writer_type_id;
	go_src_writer_type_id = g_type_register_static (TYPE_VALABIND_WRITER, "GoSrcWriter", &g_define_type_info, 0);
	GoSrcWriter_private_offset = g_type_add_instance_private (go_src_writer_type_id, sizeof (GoSrcWriterPrivate));
	return go_src_writer_type_id;
}

GType
go_src_writer_get_type (void)
{
	static volatile gsize go_src_writer_type_id__once = 0;
	if (g_once_init_enter (&go_src_writer_type_id__once)) {
		GType go_src_writer_type_id;
		go_src_writer_type_id = go_src_writer_get_type_once ();
		g_once_init_leave (&go_src_writer_type_id__once, go_src_writer_type_id);
	}
	return go_src_writer_type_id__once;
}

GoWriter*
go_writer_construct (GType object_type)
{
	GoWriter* self = NULL;
	self = (GoWriter*) valabind_writer_construct (object_type);
	return self;
}

GoWriter*
go_writer_new (void)
{
	return go_writer_construct (TYPE_GO_WRITER);
}

static gchar*
go_writer_real_get_filename (ValabindWriter* base,
                             const gchar* base_name)
{
	GoWriter * self;
	gchar* _tmp0_;
	gchar* result;
	self = (GoWriter*) base;
	g_return_val_if_fail (base_name != NULL, NULL);
	_tmp0_ = g_strconcat (base_name, ".go", NULL);
	result = _tmp0_;
	return result;
}

static gchar**
_vala_array_dup3 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static gchar**
_vala_array_dup4 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
go_writer_clone_writer_config (GoWriter* self,
                               ValabindWriter* w)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	GList* _tmp9_;
	GList* _tmp12_;
	GList* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (w != NULL);
	_tmp0_ = ((ValabindWriter*) self)->modulename;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (w->modulename);
	w->modulename = _tmp1_;
	_tmp2_ = ((ValabindWriter*) self)->library;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (w->library);
	w->library = _tmp3_;
	_tmp4_ = ((ValabindWriter*) self)->include_dirs;
	_tmp4__length1 = _vala_array_length (((ValabindWriter*) self)->include_dirs);
	_tmp5_ = (_tmp4_ != NULL) ? _vala_array_dup3 (_tmp4_, _tmp4__length1) : _tmp4_;
	_tmp5__length1 = _tmp4__length1;
	w->include_dirs = (_vala_array_free (w->include_dirs, _vala_array_length (w->include_dirs), (GDestroyNotify) g_free), NULL);
	w->include_dirs = _tmp5_;
	_tmp6_ = ((ValabindWriter*) self)->namespaces;
	_tmp6__length1 = _vala_array_length (((ValabindWriter*) self)->namespaces);
	_tmp7_ = (_tmp6_ != NULL) ? _vala_array_dup4 (_tmp6_, _tmp6__length1) : _tmp6_;
	_tmp7__length1 = _tmp6__length1;
	w->namespaces = (_vala_array_free (w->namespaces, _vala_array_length (w->namespaces), (GDestroyNotify) g_free), NULL);
	w->namespaces = _tmp7_;
	_tmp8_ = ((ValabindWriter*) self)->vapidir;
	valabind_writer_init (w, _tmp8_, ((ValabindWriter*) self)->glibmode);
	_tmp9_ = ((ValabindWriter*) self)->packages;
	{
		GList* pkg_collection = NULL;
		GList* pkg_it = NULL;
		pkg_collection = _tmp9_;
		for (pkg_it = pkg_collection; pkg_it != NULL; pkg_it = pkg_it->next) {
			gchar* _tmp10_;
			gchar* pkg = NULL;
			_tmp10_ = g_strdup ((const gchar*) pkg_it->data);
			pkg = _tmp10_;
			{
				const gchar* _tmp11_;
				_tmp11_ = pkg;
				valabind_writer_add_external_package (w, _tmp11_);
				_g_free0 (pkg);
			}
		}
	}
	_tmp12_ = ((ValabindWriter*) self)->defines;
	{
		GList* def_collection = NULL;
		GList* def_it = NULL;
		def_collection = _tmp12_;
		for (def_it = def_collection; def_it != NULL; def_it = def_it->next) {
			gchar* _tmp13_;
			gchar* def = NULL;
			_tmp13_ = g_strdup ((const gchar*) def_it->data);
			def = _tmp13_;
			{
				const gchar* _tmp14_;
				_tmp14_ = def;
				valabind_writer_add_define (w, _tmp14_);
				_g_free0 (def);
			}
		}
	}
	_tmp15_ = ((ValabindWriter*) self)->source_files;
	{
		GList* f_collection = NULL;
		GList* f_it = NULL;
		f_collection = _tmp15_;
		for (f_it = f_collection; f_it != NULL; f_it = f_it->next) {
			gchar* _tmp16_;
			gchar* f = NULL;
			_tmp16_ = g_strdup ((const gchar*) f_it->data);
			f = _tmp16_;
			{
				const gchar* _tmp17_;
				_tmp17_ = f;
				valabind_writer_add_source_file (w, _tmp17_);
				_g_free0 (f);
			}
		}
	}
}

static void
go_writer_real_write (ValabindWriter* base,
                      const gchar* file)
{
	GoWriter * self;
	GenericClassFinder* f = NULL;
	GenericClassFinder* _tmp0_;
	GoSrcWriter* g = NULL;
	GoSrcWriter* _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	self = (GoWriter*) base;
	g_return_if_fail (file != NULL);
	_tmp0_ = generic_class_finder_new ();
	f = _tmp0_;
	go_writer_clone_writer_config (self, (ValabindWriter*) f);
	valabind_writer_parse ((ValabindWriter*) f);
	valabind_writer_write ((ValabindWriter*) f, file);
	_tmp1_ = go_src_writer_new ();
	g = _tmp1_;
	go_writer_clone_writer_config (self, (ValabindWriter*) g);
	_tmp2_ = generic_class_finder_get_generic_class_instances (f);
	_tmp3_ = _tmp2_;
	go_src_writer_set_generic_class_instances (g, _tmp3_);
	_g_hash_table_unref0 (_tmp3_);
	valabind_writer_parse ((ValabindWriter*) g);
	valabind_writer_write ((ValabindWriter*) g, file);
	_vala_code_visitor_unref0 (g);
	_vala_code_visitor_unref0 (f);
}

static void
go_writer_class_init (GoWriterClass * klass,
                      gpointer klass_data)
{
	go_writer_parent_class = g_type_class_peek_parent (klass);
	((ValabindWriterClass *) klass)->get_filename = (gchar* (*) (ValabindWriter*, const gchar*)) go_writer_real_get_filename;
	((ValabindWriterClass *) klass)->write = (void (*) (ValabindWriter*, const gchar*)) go_writer_real_write;
}

static void
go_writer_instance_init (GoWriter * self,
                         gpointer klass)
{
}

static GType
go_writer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GoWriterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) go_writer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GoWriter), 0, (GInstanceInitFunc) go_writer_instance_init, NULL };
	GType go_writer_type_id;
	go_writer_type_id = g_type_register_static (TYPE_VALABIND_WRITER, "GoWriter", &g_define_type_info, 0);
	return go_writer_type_id;
}

GType
go_writer_get_type (void)
{
	static volatile gsize go_writer_type_id__once = 0;
	if (g_once_init_enter (&go_writer_type_id__once)) {
		GType go_writer_type_id;
		go_writer_type_id = go_writer_get_type_once ();
		g_once_init_leave (&go_writer_type_id__once, go_writer_type_id);
	}
	return go_writer_type_id__once;
}

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

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

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

