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

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.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_PHP_TO_VALA_RUNTIME_METADATA (php_to_vala_runtime_metadata_get_type ())
#define PHP_TO_VALA_RUNTIME_METADATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHP_TO_VALA_RUNTIME_METADATA, PhpToValaRuntimeMetadata))
#define PHP_TO_VALA_RUNTIME_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHP_TO_VALA_RUNTIME_METADATA, PhpToValaRuntimeMetadataClass))
#define IS_PHP_TO_VALA_RUNTIME_METADATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHP_TO_VALA_RUNTIME_METADATA))
#define IS_PHP_TO_VALA_RUNTIME_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHP_TO_VALA_RUNTIME_METADATA))
#define PHP_TO_VALA_RUNTIME_METADATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHP_TO_VALA_RUNTIME_METADATA, PhpToValaRuntimeMetadataClass))

typedef struct _PhpToValaRuntimeMetadata PhpToValaRuntimeMetadata;
typedef struct _PhpToValaRuntimeMetadataClass PhpToValaRuntimeMetadataClass;
typedef struct _PhpToValaRuntimeMetadataPrivate PhpToValaRuntimeMetadataPrivate;
enum  {
	PHP_TO_VALA_RUNTIME_METADATA_0_PROPERTY,
	PHP_TO_VALA_RUNTIME_METADATA_NUM_PROPERTIES
};
static GParamSpec* php_to_vala_runtime_metadata_properties[PHP_TO_VALA_RUNTIME_METADATA_NUM_PROPERTIES];

#define TYPE_FUNCTION_BINDING (function_binding_get_type ())
#define FUNCTION_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FUNCTION_BINDING, FunctionBinding))
#define FUNCTION_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FUNCTION_BINDING, FunctionBindingClass))
#define IS_FUNCTION_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FUNCTION_BINDING))
#define IS_FUNCTION_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FUNCTION_BINDING))
#define FUNCTION_BINDING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FUNCTION_BINDING, FunctionBindingClass))

typedef struct _FunctionBinding FunctionBinding;
typedef struct _FunctionBindingClass FunctionBindingClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _FunctionBindingPrivate FunctionBindingPrivate;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

struct _PhpToValaRuntimeMetadata {
	GObject parent_instance;
	PhpToValaRuntimeMetadataPrivate * priv;
};

struct _PhpToValaRuntimeMetadataClass {
	GObjectClass parent_class;
};

struct _FunctionBinding {
	GObject parent_instance;
	FunctionBindingPrivate * priv;
	gchar* namespace_name;
	gchar* package_name;
	gchar* return_type;
	gboolean source_location_args;
	gchar* mapped_function_name;
};

struct _FunctionBindingClass {
	GObjectClass parent_class;
};

static gpointer php_to_vala_runtime_metadata_parent_class = NULL;

VALA_EXTERN GType php_to_vala_runtime_metadata_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhpToValaRuntimeMetadata, g_object_unref)
VALA_EXTERN GType function_binding_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FunctionBinding, g_object_unref)
VALA_EXTERN gchar* php_to_vala_runtime_metadata_build (const gchar* runtime_name,
                                           gboolean optimize_local_vars,
                                           GeeHashMap* function_bindings,
                                           GeeArrayList* used_function_names);
static GeeArrayList* php_to_vala_runtime_metadata_collect_used_dependency_names (GeeHashMap* function_bindings,
                                                                          GeeArrayList* used_function_names);
static gchar* php_to_vala_runtime_metadata_metadata_call_name (gboolean optimize_local_vars,
                                                        GeeHashMap* function_bindings,
                                                        const gchar* function_name,
                                                        FunctionBinding* binding);
static gchar* php_to_vala_runtime_metadata_runtime_module_name (const gchar* package_name);
VALA_EXTERN void php_to_vala_runtime_metadata_append_comment (GString* output,
                                                  const gchar* metadata);
VALA_EXTERN void php_to_vala_runtime_metadata_append_debug_constant (GString* output,
                                                         const gchar* metadata);
static gchar* php_to_vala_runtime_metadata_escape_vala_string (const gchar* value);
VALA_EXTERN gchar* function_binding_call_name (FunctionBinding* self,
                                   const gchar* function_name);
VALA_EXTERN PhpToValaRuntimeMetadata* php_to_vala_runtime_metadata_new (void);
VALA_EXTERN PhpToValaRuntimeMetadata* php_to_vala_runtime_metadata_construct (GType object_type);
static GType php_to_vala_runtime_metadata_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);

gchar*
php_to_vala_runtime_metadata_build (const gchar* runtime_name,
                                    gboolean optimize_local_vars,
                                    GeeHashMap* function_bindings,
                                    GeeArrayList* used_function_names)
{
	GString* metadata = NULL;
	GString* _tmp0_;
	GString* _tmp1_;
	GString* _tmp2_;
	GeeArrayList* dependency_names = NULL;
	GeeArrayList* _tmp3_;
	GeeArrayList* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	GString* _tmp18_;
	GString* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	GString* _tmp45_;
	const gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* result;
#line 4 "../src/runtime_metadata.vala"
	g_return_val_if_fail (runtime_name != NULL, NULL);
#line 4 "../src/runtime_metadata.vala"
	g_return_val_if_fail (function_bindings != NULL, NULL);
#line 4 "../src/runtime_metadata.vala"
	g_return_val_if_fail (used_function_names != NULL, NULL);
#line 10 "../src/runtime_metadata.vala"
	_tmp0_ = g_string_new ("");
#line 10 "../src/runtime_metadata.vala"
	metadata = _tmp0_;
#line 11 "../src/runtime_metadata.vala"
	_tmp1_ = metadata;
#line 11 "../src/runtime_metadata.vala"
	g_string_append_printf (_tmp1_, "php2vala runtime: %s\n\n", runtime_name);
#line 12 "../src/runtime_metadata.vala"
	_tmp2_ = metadata;
#line 12 "../src/runtime_metadata.vala"
	g_string_append (_tmp2_, "php2vala runtime dependencies:\n");
#line 14 "../src/runtime_metadata.vala"
	_tmp3_ = php_to_vala_runtime_metadata_collect_used_dependency_names (function_bindings, used_function_names);
#line 14 "../src/runtime_metadata.vala"
	dependency_names = _tmp3_;
#line 15 "../src/runtime_metadata.vala"
	_tmp4_ = dependency_names;
#line 15 "../src/runtime_metadata.vala"
	_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
#line 15 "../src/runtime_metadata.vala"
	_tmp6_ = _tmp5_;
#line 15 "../src/runtime_metadata.vala"
	if (_tmp6_ == 0) {
#line 171 "runtime_metadata.c"
		GString* _tmp7_;
#line 16 "../src/runtime_metadata.vala"
		_tmp7_ = metadata;
#line 16 "../src/runtime_metadata.vala"
		g_string_append (_tmp7_, "- none\n");
#line 177 "runtime_metadata.c"
	} else {
		{
			GeeArrayList* _dependency_name_list = NULL;
			GeeArrayList* _tmp8_;
			gint _dependency_name_size = 0;
			GeeArrayList* _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			gint _dependency_name_index = 0;
#line 18 "../src/runtime_metadata.vala"
			_tmp8_ = dependency_names;
#line 18 "../src/runtime_metadata.vala"
			_dependency_name_list = _tmp8_;
#line 18 "../src/runtime_metadata.vala"
			_tmp9_ = _dependency_name_list;
#line 18 "../src/runtime_metadata.vala"
			_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
#line 18 "../src/runtime_metadata.vala"
			_tmp11_ = _tmp10_;
#line 18 "../src/runtime_metadata.vala"
			_dependency_name_size = _tmp11_;
#line 18 "../src/runtime_metadata.vala"
			_dependency_name_index = -1;
#line 18 "../src/runtime_metadata.vala"
			while (TRUE) {
#line 203 "runtime_metadata.c"
				gint _tmp12_;
				gint _tmp13_;
				gchar* dependency_name = NULL;
				GeeArrayList* _tmp14_;
				gpointer _tmp15_;
				GString* _tmp16_;
				const gchar* _tmp17_;
#line 18 "../src/runtime_metadata.vala"
				_dependency_name_index = _dependency_name_index + 1;
#line 18 "../src/runtime_metadata.vala"
				_tmp12_ = _dependency_name_index;
#line 18 "../src/runtime_metadata.vala"
				_tmp13_ = _dependency_name_size;
#line 18 "../src/runtime_metadata.vala"
				if (!(_tmp12_ < _tmp13_)) {
#line 18 "../src/runtime_metadata.vala"
					break;
#line 221 "runtime_metadata.c"
				}
#line 18 "../src/runtime_metadata.vala"
				_tmp14_ = _dependency_name_list;
#line 18 "../src/runtime_metadata.vala"
				_tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, _dependency_name_index);
#line 18 "../src/runtime_metadata.vala"
				dependency_name = (gchar*) _tmp15_;
#line 19 "../src/runtime_metadata.vala"
				_tmp16_ = metadata;
#line 19 "../src/runtime_metadata.vala"
				_tmp17_ = dependency_name;
#line 19 "../src/runtime_metadata.vala"
				g_string_append_printf (_tmp16_, "- %s\n", _tmp17_);
#line 18 "../src/runtime_metadata.vala"
				_g_free0 (dependency_name);
#line 237 "runtime_metadata.c"
			}
		}
	}
#line 23 "../src/runtime_metadata.vala"
	_tmp18_ = metadata;
#line 23 "../src/runtime_metadata.vala"
	g_string_append (_tmp18_, "\n");
#line 24 "../src/runtime_metadata.vala"
	_tmp19_ = metadata;
#line 24 "../src/runtime_metadata.vala"
	g_string_append (_tmp19_, "php2vala function mapping:\n");
#line 25 "../src/runtime_metadata.vala"
	_tmp20_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) used_function_names);
#line 25 "../src/runtime_metadata.vala"
	_tmp21_ = _tmp20_;
#line 25 "../src/runtime_metadata.vala"
	if (_tmp21_ == 0) {
#line 255 "runtime_metadata.c"
		GString* _tmp22_;
#line 26 "../src/runtime_metadata.vala"
		_tmp22_ = metadata;
#line 26 "../src/runtime_metadata.vala"
		g_string_append (_tmp22_, "- none\n");
#line 261 "runtime_metadata.c"
	} else {
		{
			GeeArrayList* _function_name_list = NULL;
			gint _function_name_size = 0;
			GeeArrayList* _tmp23_;
			gint _tmp24_;
			gint _tmp25_;
			gint _function_name_index = 0;
#line 28 "../src/runtime_metadata.vala"
			_function_name_list = used_function_names;
#line 28 "../src/runtime_metadata.vala"
			_tmp23_ = _function_name_list;
#line 28 "../src/runtime_metadata.vala"
			_tmp24_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp23_);
#line 28 "../src/runtime_metadata.vala"
			_tmp25_ = _tmp24_;
#line 28 "../src/runtime_metadata.vala"
			_function_name_size = _tmp25_;
#line 28 "../src/runtime_metadata.vala"
			_function_name_index = -1;
#line 28 "../src/runtime_metadata.vala"
			while (TRUE) {
#line 284 "runtime_metadata.c"
				gint _tmp26_;
				gint _tmp27_;
				gchar* function_name = NULL;
				GeeArrayList* _tmp28_;
				gpointer _tmp29_;
				FunctionBinding* binding = NULL;
				const gchar* _tmp30_;
				gpointer _tmp31_;
				FunctionBinding* _tmp32_;
				GString* _tmp33_;
				const gchar* _tmp34_;
				const gchar* _tmp35_;
				FunctionBinding* _tmp36_;
				gchar* _tmp37_;
				gchar* _tmp38_;
				FunctionBinding* _tmp39_;
				const gchar* _tmp40_;
				gchar* _tmp41_;
				gchar* _tmp42_;
				FunctionBinding* _tmp43_;
				const gchar* _tmp44_;
#line 28 "../src/runtime_metadata.vala"
				_function_name_index = _function_name_index + 1;
#line 28 "../src/runtime_metadata.vala"
				_tmp26_ = _function_name_index;
#line 28 "../src/runtime_metadata.vala"
				_tmp27_ = _function_name_size;
#line 28 "../src/runtime_metadata.vala"
				if (!(_tmp26_ < _tmp27_)) {
#line 28 "../src/runtime_metadata.vala"
					break;
#line 316 "runtime_metadata.c"
				}
#line 28 "../src/runtime_metadata.vala"
				_tmp28_ = _function_name_list;
#line 28 "../src/runtime_metadata.vala"
				_tmp29_ = gee_abstract_list_get ((GeeAbstractList*) _tmp28_, _function_name_index);
#line 28 "../src/runtime_metadata.vala"
				function_name = (gchar*) _tmp29_;
#line 29 "../src/runtime_metadata.vala"
				_tmp30_ = function_name;
#line 29 "../src/runtime_metadata.vala"
				_tmp31_ = gee_abstract_map_get ((GeeAbstractMap*) function_bindings, _tmp30_);
#line 29 "../src/runtime_metadata.vala"
				binding = (FunctionBinding*) _tmp31_;
#line 30 "../src/runtime_metadata.vala"
				_tmp32_ = binding;
#line 30 "../src/runtime_metadata.vala"
				if (_tmp32_ == NULL) {
#line 31 "../src/runtime_metadata.vala"
					_g_object_unref0 (binding);
#line 31 "../src/runtime_metadata.vala"
					_g_free0 (function_name);
#line 31 "../src/runtime_metadata.vala"
					continue;
#line 340 "runtime_metadata.c"
				}
#line 34 "../src/runtime_metadata.vala"
				_tmp33_ = metadata;
#line 34 "../src/runtime_metadata.vala"
				_tmp34_ = function_name;
#line 34 "../src/runtime_metadata.vala"
				_tmp35_ = function_name;
#line 34 "../src/runtime_metadata.vala"
				_tmp36_ = binding;
#line 34 "../src/runtime_metadata.vala"
				_tmp37_ = php_to_vala_runtime_metadata_metadata_call_name (optimize_local_vars, function_bindings, _tmp35_, _tmp36_);
#line 34 "../src/runtime_metadata.vala"
				_tmp38_ = _tmp37_;
#line 34 "../src/runtime_metadata.vala"
				_tmp39_ = binding;
#line 34 "../src/runtime_metadata.vala"
				_tmp40_ = _tmp39_->package_name;
#line 34 "../src/runtime_metadata.vala"
				_tmp41_ = php_to_vala_runtime_metadata_runtime_module_name (_tmp40_);
#line 34 "../src/runtime_metadata.vala"
				_tmp42_ = _tmp41_;
#line 34 "../src/runtime_metadata.vala"
				_tmp43_ = binding;
#line 34 "../src/runtime_metadata.vala"
				_tmp44_ = _tmp43_->package_name;
#line 34 "../src/runtime_metadata.vala"
				g_string_append_printf (_tmp33_, "- %s -> %s (%s, %s)\n", _tmp34_, _tmp38_, _tmp42_, _tmp44_);
#line 34 "../src/runtime_metadata.vala"
				_g_free0 (_tmp42_);
#line 34 "../src/runtime_metadata.vala"
				_g_free0 (_tmp38_);
#line 28 "../src/runtime_metadata.vala"
				_g_object_unref0 (binding);
#line 28 "../src/runtime_metadata.vala"
				_g_free0 (function_name);
#line 376 "runtime_metadata.c"
			}
		}
	}
#line 44 "../src/runtime_metadata.vala"
	_tmp45_ = metadata;
#line 44 "../src/runtime_metadata.vala"
	_tmp46_ = _tmp45_->str;
#line 44 "../src/runtime_metadata.vala"
	_tmp47_ = g_strdup (_tmp46_);
#line 44 "../src/runtime_metadata.vala"
	result = _tmp47_;
#line 44 "../src/runtime_metadata.vala"
	_g_object_unref0 (dependency_names);
#line 44 "../src/runtime_metadata.vala"
	_g_string_free0 (metadata);
#line 44 "../src/runtime_metadata.vala"
	return result;
#line 394 "runtime_metadata.c"
}

void
php_to_vala_runtime_metadata_append_comment (GString* output,
                                             const gchar* metadata)
{
	gchar** _tmp0_;
	gchar** _tmp1_;
#line 47 "../src/runtime_metadata.vala"
	g_return_if_fail (output != NULL);
#line 47 "../src/runtime_metadata.vala"
	g_return_if_fail (metadata != NULL);
#line 48 "../src/runtime_metadata.vala"
	g_string_append (output, "/*\n");
#line 49 "../src/runtime_metadata.vala"
	_tmp1_ = _tmp0_ = g_strsplit (metadata, "\n", 0);
#line 411 "runtime_metadata.c"
	{
		gchar** line_collection = NULL;
		gint line_collection_length1 = 0;
		gint _line_collection_size_ = 0;
		gint line_it = 0;
#line 49 "../src/runtime_metadata.vala"
		line_collection = _tmp1_;
#line 49 "../src/runtime_metadata.vala"
		line_collection_length1 = _vala_array_length (_tmp0_);
#line 49 "../src/runtime_metadata.vala"
		for (line_it = 0; line_it < line_collection_length1; line_it = line_it + 1) {
#line 423 "runtime_metadata.c"
			gchar* _tmp2_;
			gchar* line = NULL;
#line 49 "../src/runtime_metadata.vala"
			_tmp2_ = g_strdup (line_collection[line_it]);
#line 49 "../src/runtime_metadata.vala"
			line = _tmp2_;
#line 430 "runtime_metadata.c"
			{
				const gchar* _tmp3_;
#line 50 "../src/runtime_metadata.vala"
				_tmp3_ = line;
#line 50 "../src/runtime_metadata.vala"
				if (g_strcmp0 (_tmp3_, "") == 0) {
#line 51 "../src/runtime_metadata.vala"
					g_string_append (output, " *\n");
#line 439 "runtime_metadata.c"
				} else {
					const gchar* _tmp4_;
#line 53 "../src/runtime_metadata.vala"
					_tmp4_ = line;
#line 53 "../src/runtime_metadata.vala"
					g_string_append_printf (output, " * %s\n", _tmp4_);
#line 446 "runtime_metadata.c"
				}
#line 49 "../src/runtime_metadata.vala"
				_g_free0 (line);
#line 450 "runtime_metadata.c"
			}
		}
#line 49 "../src/runtime_metadata.vala"
		line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
#line 455 "runtime_metadata.c"
	}
#line 56 "../src/runtime_metadata.vala"
	g_string_append (output, " */\n");
#line 459 "runtime_metadata.c"
}

void
php_to_vala_runtime_metadata_append_debug_constant (GString* output,
                                                    const gchar* metadata)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
#line 59 "../src/runtime_metadata.vala"
	g_return_if_fail (output != NULL);
#line 59 "../src/runtime_metadata.vala"
	g_return_if_fail (metadata != NULL);
#line 60 "../src/runtime_metadata.vala"
	_tmp0_ = php_to_vala_runtime_metadata_escape_vala_string (metadata);
#line 60 "../src/runtime_metadata.vala"
	_tmp1_ = _tmp0_;
#line 60 "../src/runtime_metadata.vala"
	g_string_append_printf (output, "private const string PHP2VALA_DEBUG_INFO = \"%s\";\n\n", _tmp1_);
#line 60 "../src/runtime_metadata.vala"
	_g_free0 (_tmp1_);
#line 480 "runtime_metadata.c"
}

static GeeArrayList*
php_to_vala_runtime_metadata_collect_used_dependency_names (GeeHashMap* function_bindings,
                                                            GeeArrayList* used_function_names)
{
	GeeArrayList* dependency_names = NULL;
	GeeArrayList* _tmp0_;
	gboolean needs_core = FALSE;
	GeeArrayList* result;
#line 66 "../src/runtime_metadata.vala"
	g_return_val_if_fail (function_bindings != NULL, NULL);
#line 66 "../src/runtime_metadata.vala"
	g_return_val_if_fail (used_function_names != NULL, NULL);
#line 70 "../src/runtime_metadata.vala"
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
#line 70 "../src/runtime_metadata.vala"
	dependency_names = _tmp0_;
#line 71 "../src/runtime_metadata.vala"
	needs_core = FALSE;
#line 501 "runtime_metadata.c"
	{
		GeeArrayList* _function_name_list = NULL;
		gint _function_name_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _function_name_index = 0;
#line 72 "../src/runtime_metadata.vala"
		_function_name_list = used_function_names;
#line 72 "../src/runtime_metadata.vala"
		_tmp1_ = _function_name_list;
#line 72 "../src/runtime_metadata.vala"
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
#line 72 "../src/runtime_metadata.vala"
		_tmp3_ = _tmp2_;
#line 72 "../src/runtime_metadata.vala"
		_function_name_size = _tmp3_;
#line 72 "../src/runtime_metadata.vala"
		_function_name_index = -1;
#line 72 "../src/runtime_metadata.vala"
		while (TRUE) {
#line 523 "runtime_metadata.c"
			gint _tmp4_;
			gint _tmp5_;
			gchar* function_name = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			FunctionBinding* binding = NULL;
			const gchar* _tmp8_;
			gpointer _tmp9_;
			FunctionBinding* _tmp10_;
			gboolean _tmp11_ = FALSE;
			gboolean _tmp12_ = FALSE;
			FunctionBinding* _tmp13_;
			const gchar* _tmp14_;
			GeeArrayList* _tmp18_;
			FunctionBinding* _tmp19_;
			const gchar* _tmp20_;
#line 72 "../src/runtime_metadata.vala"
			_function_name_index = _function_name_index + 1;
#line 72 "../src/runtime_metadata.vala"
			_tmp4_ = _function_name_index;
#line 72 "../src/runtime_metadata.vala"
			_tmp5_ = _function_name_size;
#line 72 "../src/runtime_metadata.vala"
			if (!(_tmp4_ < _tmp5_)) {
#line 72 "../src/runtime_metadata.vala"
				break;
#line 550 "runtime_metadata.c"
			}
#line 72 "../src/runtime_metadata.vala"
			_tmp6_ = _function_name_list;
#line 72 "../src/runtime_metadata.vala"
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _function_name_index);
#line 72 "../src/runtime_metadata.vala"
			function_name = (gchar*) _tmp7_;
#line 73 "../src/runtime_metadata.vala"
			_tmp8_ = function_name;
#line 73 "../src/runtime_metadata.vala"
			_tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) function_bindings, _tmp8_);
#line 73 "../src/runtime_metadata.vala"
			binding = (FunctionBinding*) _tmp9_;
#line 74 "../src/runtime_metadata.vala"
			_tmp10_ = binding;
#line 74 "../src/runtime_metadata.vala"
			if (_tmp10_ == NULL) {
#line 75 "../src/runtime_metadata.vala"
				_g_object_unref0 (binding);
#line 75 "../src/runtime_metadata.vala"
				_g_free0 (function_name);
#line 75 "../src/runtime_metadata.vala"
				continue;
#line 574 "runtime_metadata.c"
			}
#line 78 "../src/runtime_metadata.vala"
			_tmp13_ = binding;
#line 78 "../src/runtime_metadata.vala"
			_tmp14_ = _tmp13_->package_name;
#line 78 "../src/runtime_metadata.vala"
			if (g_strcmp0 (_tmp14_, "valaphp-runtime-core-0.01") == 0) {
#line 78 "../src/runtime_metadata.vala"
				_tmp12_ = TRUE;
#line 584 "runtime_metadata.c"
			} else {
				FunctionBinding* _tmp15_;
				const gchar* _tmp16_;
#line 79 "../src/runtime_metadata.vala"
				_tmp15_ = binding;
#line 79 "../src/runtime_metadata.vala"
				_tmp16_ = _tmp15_->return_type;
#line 79 "../src/runtime_metadata.vala"
				_tmp12_ = g_str_has_prefix (_tmp16_, "Php.");
#line 594 "runtime_metadata.c"
			}
#line 78 "../src/runtime_metadata.vala"
			if (_tmp12_) {
#line 78 "../src/runtime_metadata.vala"
				_tmp11_ = TRUE;
#line 600 "runtime_metadata.c"
			} else {
				FunctionBinding* _tmp17_;
#line 80 "../src/runtime_metadata.vala"
				_tmp17_ = binding;
#line 80 "../src/runtime_metadata.vala"
				_tmp11_ = _tmp17_->source_location_args;
#line 607 "runtime_metadata.c"
			}
#line 78 "../src/runtime_metadata.vala"
			if (_tmp11_) {
#line 81 "../src/runtime_metadata.vala"
				needs_core = TRUE;
#line 613 "runtime_metadata.c"
			}
#line 84 "../src/runtime_metadata.vala"
			_tmp18_ = dependency_names;
#line 84 "../src/runtime_metadata.vala"
			_tmp19_ = binding;
#line 84 "../src/runtime_metadata.vala"
			_tmp20_ = _tmp19_->package_name;
#line 84 "../src/runtime_metadata.vala"
			if (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp18_, _tmp20_)) {
#line 623 "runtime_metadata.c"
				GeeArrayList* _tmp21_;
				FunctionBinding* _tmp22_;
				const gchar* _tmp23_;
#line 85 "../src/runtime_metadata.vala"
				_tmp21_ = dependency_names;
#line 85 "../src/runtime_metadata.vala"
				_tmp22_ = binding;
#line 85 "../src/runtime_metadata.vala"
				_tmp23_ = _tmp22_->package_name;
#line 85 "../src/runtime_metadata.vala"
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp21_, _tmp23_);
#line 635 "runtime_metadata.c"
			}
#line 72 "../src/runtime_metadata.vala"
			_g_object_unref0 (binding);
#line 72 "../src/runtime_metadata.vala"
			_g_free0 (function_name);
#line 641 "runtime_metadata.c"
		}
	}
#line 89 "../src/runtime_metadata.vala"
	if (needs_core) {
#line 646 "runtime_metadata.c"
		GeeArrayList* _tmp24_;
		GeeArrayList* _tmp25_;
#line 90 "../src/runtime_metadata.vala"
		_tmp24_ = dependency_names;
#line 90 "../src/runtime_metadata.vala"
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp24_, "valaphp-runtime-core-0.01");
#line 91 "../src/runtime_metadata.vala"
		_tmp25_ = dependency_names;
#line 91 "../src/runtime_metadata.vala"
		gee_abstract_list_insert ((GeeAbstractList*) _tmp25_, 0, "valaphp-runtime-core-0.01");
#line 657 "runtime_metadata.c"
	}
#line 94 "../src/runtime_metadata.vala"
	result = dependency_names;
#line 94 "../src/runtime_metadata.vala"
	return result;
#line 663 "runtime_metadata.c"
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
#line 1501 "glib-2.0.vapi"
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
#line 1501 "glib-2.0.vapi"
	end = _tmp0_;
#line 1502 "glib-2.0.vapi"
	_tmp1_ = end;
#line 1502 "glib-2.0.vapi"
	if (_tmp1_ == NULL) {
#line 1503 "glib-2.0.vapi"
		result = maxlen;
#line 1503 "glib-2.0.vapi"
		return result;
#line 686 "runtime_metadata.c"
	} else {
		gchar* _tmp2_;
#line 1505 "glib-2.0.vapi"
		_tmp2_ = end;
#line 1505 "glib-2.0.vapi"
		result = (glong) (_tmp2_ - str);
#line 1505 "glib-2.0.vapi"
		return result;
#line 695 "runtime_metadata.c"
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
#line 1512 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1514 "glib-2.0.vapi"
	if (offset >= ((glong) 0)) {
#line 1514 "glib-2.0.vapi"
		_tmp0_ = len >= ((glong) 0);
#line 714 "runtime_metadata.c"
	} else {
#line 1514 "glib-2.0.vapi"
		_tmp0_ = FALSE;
#line 718 "runtime_metadata.c"
	}
#line 1514 "glib-2.0.vapi"
	if (_tmp0_) {
#line 1516 "glib-2.0.vapi"
		string_length = string_strnlen ((gchar*) self, offset + len);
#line 724 "runtime_metadata.c"
	} else {
		gint _tmp1_;
		gint _tmp2_;
#line 1518 "glib-2.0.vapi"
		_tmp1_ = strlen (self);
#line 1518 "glib-2.0.vapi"
		_tmp2_ = _tmp1_;
#line 1518 "glib-2.0.vapi"
		string_length = (glong) _tmp2_;
#line 734 "runtime_metadata.c"
	}
#line 1521 "glib-2.0.vapi"
	if (offset < ((glong) 0)) {
#line 1522 "glib-2.0.vapi"
		offset = string_length + offset;
#line 1523 "glib-2.0.vapi"
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
#line 742 "runtime_metadata.c"
	} else {
#line 1525 "glib-2.0.vapi"
		g_return_val_if_fail (offset <= string_length, NULL);
#line 746 "runtime_metadata.c"
	}
#line 1527 "glib-2.0.vapi"
	if (len < ((glong) 0)) {
#line 1528 "glib-2.0.vapi"
		len = string_length - offset;
#line 752 "runtime_metadata.c"
	}
#line 1530 "glib-2.0.vapi"
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
#line 1531 "glib-2.0.vapi"
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
#line 1531 "glib-2.0.vapi"
	result = _tmp3_;
#line 1531 "glib-2.0.vapi"
	return result;
#line 762 "runtime_metadata.c"
}

static gchar*
php_to_vala_runtime_metadata_metadata_call_name (gboolean optimize_local_vars,
                                                 GeeHashMap* function_bindings,
                                                 const gchar* function_name,
                                                 FunctionBinding* binding)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
	gchar* _tmp60_;
	gchar* result;
#line 97 "../src/runtime_metadata.vala"
	g_return_val_if_fail (function_bindings != NULL, NULL);
#line 97 "../src/runtime_metadata.vala"
	g_return_val_if_fail (function_name != NULL, NULL);
#line 97 "../src/runtime_metadata.vala"
	g_return_val_if_fail (binding != NULL, NULL);
#line 103 "../src/runtime_metadata.vala"
	if (optimize_local_vars) {
#line 789 "runtime_metadata.c"
		const gchar* _tmp3_;
#line 104 "../src/runtime_metadata.vala"
		_tmp3_ = binding->namespace_name;
#line 104 "../src/runtime_metadata.vala"
		_tmp2_ = g_strcmp0 (_tmp3_, "PhpEmbed") == 0;
#line 795 "runtime_metadata.c"
	} else {
#line 103 "../src/runtime_metadata.vala"
		_tmp2_ = FALSE;
#line 799 "runtime_metadata.c"
	}
#line 103 "../src/runtime_metadata.vala"
	if (_tmp2_) {
#line 803 "runtime_metadata.c"
		const gchar* _tmp4_;
#line 105 "../src/runtime_metadata.vala"
		_tmp4_ = binding->package_name;
#line 105 "../src/runtime_metadata.vala"
		_tmp1_ = g_strcmp0 (_tmp4_, "valaphp-runtime-embed-0.01") == 0;
#line 809 "runtime_metadata.c"
	} else {
#line 103 "../src/runtime_metadata.vala"
		_tmp1_ = FALSE;
#line 813 "runtime_metadata.c"
	}
#line 103 "../src/runtime_metadata.vala"
	if (_tmp1_) {
#line 106 "../src/runtime_metadata.vala"
		_tmp0_ = g_strcmp0 (function_name, "echo") == 0;
#line 819 "runtime_metadata.c"
	} else {
#line 103 "../src/runtime_metadata.vala"
		_tmp0_ = FALSE;
#line 823 "runtime_metadata.c"
	}
#line 103 "../src/runtime_metadata.vala"
	if (_tmp0_) {
#line 827 "runtime_metadata.c"
		gchar* _tmp5_;
#line 107 "../src/runtime_metadata.vala"
		_tmp5_ = g_strdup ("PhpEmbed.echo_static");
#line 107 "../src/runtime_metadata.vala"
		result = _tmp5_;
#line 107 "../src/runtime_metadata.vala"
		return result;
#line 835 "runtime_metadata.c"
	}
#line 109 "../src/runtime_metadata.vala"
	if (optimize_local_vars) {
#line 839 "runtime_metadata.c"
		const gchar* _tmp9_;
#line 110 "../src/runtime_metadata.vala"
		_tmp9_ = binding->namespace_name;
#line 110 "../src/runtime_metadata.vala"
		_tmp8_ = g_strcmp0 (_tmp9_, "PhpEmbed") == 0;
#line 845 "runtime_metadata.c"
	} else {
#line 109 "../src/runtime_metadata.vala"
		_tmp8_ = FALSE;
#line 849 "runtime_metadata.c"
	}
#line 109 "../src/runtime_metadata.vala"
	if (_tmp8_) {
#line 853 "runtime_metadata.c"
		const gchar* _tmp10_;
#line 111 "../src/runtime_metadata.vala"
		_tmp10_ = binding->package_name;
#line 111 "../src/runtime_metadata.vala"
		_tmp7_ = g_strcmp0 (_tmp10_, "valaphp-runtime-embed-0.01") == 0;
#line 859 "runtime_metadata.c"
	} else {
#line 109 "../src/runtime_metadata.vala"
		_tmp7_ = FALSE;
#line 863 "runtime_metadata.c"
	}
#line 109 "../src/runtime_metadata.vala"
	if (_tmp7_) {
#line 867 "runtime_metadata.c"
		gboolean _tmp11_ = FALSE;
#line 112 "../src/runtime_metadata.vala"
		if (g_strcmp0 (function_name, "die") == 0) {
#line 112 "../src/runtime_metadata.vala"
			_tmp11_ = TRUE;
#line 873 "runtime_metadata.c"
		} else {
#line 112 "../src/runtime_metadata.vala"
			_tmp11_ = g_strcmp0 (function_name, "exit") == 0;
#line 877 "runtime_metadata.c"
		}
#line 112 "../src/runtime_metadata.vala"
		_tmp6_ = _tmp11_;
#line 881 "runtime_metadata.c"
	} else {
#line 109 "../src/runtime_metadata.vala"
		_tmp6_ = FALSE;
#line 885 "runtime_metadata.c"
	}
#line 109 "../src/runtime_metadata.vala"
	if (_tmp6_) {
#line 889 "runtime_metadata.c"
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
#line 113 "../src/runtime_metadata.vala"
		_tmp12_ = g_strconcat ("PhpEmbed.", function_name, NULL);
#line 113 "../src/runtime_metadata.vala"
		_tmp13_ = _tmp12_;
#line 113 "../src/runtime_metadata.vala"
		_tmp14_ = g_strconcat (_tmp13_, "_*_static", NULL);
#line 113 "../src/runtime_metadata.vala"
		_tmp15_ = _tmp14_;
#line 113 "../src/runtime_metadata.vala"
		_g_free0 (_tmp13_);
#line 113 "../src/runtime_metadata.vala"
		result = _tmp15_;
#line 113 "../src/runtime_metadata.vala"
		return result;
#line 908 "runtime_metadata.c"
	}
#line 116 "../src/runtime_metadata.vala"
	if (!optimize_local_vars) {
#line 912 "runtime_metadata.c"
		const gchar* _tmp18_;
#line 117 "../src/runtime_metadata.vala"
		_tmp18_ = binding->namespace_name;
#line 117 "../src/runtime_metadata.vala"
		_tmp17_ = g_strcmp0 (_tmp18_, "PhpEmbed") == 0;
#line 918 "runtime_metadata.c"
	} else {
#line 116 "../src/runtime_metadata.vala"
		_tmp17_ = FALSE;
#line 922 "runtime_metadata.c"
	}
#line 116 "../src/runtime_metadata.vala"
	if (_tmp17_) {
#line 926 "runtime_metadata.c"
		const gchar* _tmp19_;
#line 118 "../src/runtime_metadata.vala"
		_tmp19_ = binding->package_name;
#line 118 "../src/runtime_metadata.vala"
		_tmp16_ = g_strcmp0 (_tmp19_, "valaphp-runtime-embed-0.01") == 0;
#line 932 "runtime_metadata.c"
	} else {
#line 116 "../src/runtime_metadata.vala"
		_tmp16_ = FALSE;
#line 936 "runtime_metadata.c"
	}
#line 116 "../src/runtime_metadata.vala"
	if (_tmp16_) {
#line 940 "runtime_metadata.c"
		const gchar* _tmp20_ = NULL;
		const gchar* _tmp21_;
		gchar* mapped = NULL;
		gchar* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp31_;
		const gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		const gchar* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
#line 119 "../src/runtime_metadata.vala"
		_tmp21_ = binding->mapped_function_name;
#line 119 "../src/runtime_metadata.vala"
		_tmp20_ = _tmp21_;
#line 119 "../src/runtime_metadata.vala"
		if (_tmp20_ == NULL) {
#line 119 "../src/runtime_metadata.vala"
			_tmp20_ = function_name;
#line 961 "runtime_metadata.c"
		}
#line 119 "../src/runtime_metadata.vala"
		_tmp22_ = g_strdup (_tmp20_);
#line 119 "../src/runtime_metadata.vala"
		mapped = _tmp22_;
#line 120 "../src/runtime_metadata.vala"
		_tmp23_ = mapped;
#line 120 "../src/runtime_metadata.vala"
		if (g_str_has_suffix (_tmp23_, "_static")) {
#line 971 "runtime_metadata.c"
			const gchar* _tmp24_;
			const gchar* _tmp25_;
			gint _tmp26_;
			gint _tmp27_;
			gint _tmp28_;
			gint _tmp29_;
			gchar* _tmp30_;
#line 121 "../src/runtime_metadata.vala"
			_tmp24_ = mapped;
#line 121 "../src/runtime_metadata.vala"
			_tmp25_ = mapped;
#line 121 "../src/runtime_metadata.vala"
			_tmp26_ = strlen (_tmp25_);
#line 121 "../src/runtime_metadata.vala"
			_tmp27_ = _tmp26_;
#line 121 "../src/runtime_metadata.vala"
			_tmp28_ = strlen ("_static");
#line 121 "../src/runtime_metadata.vala"
			_tmp29_ = _tmp28_;
#line 121 "../src/runtime_metadata.vala"
			_tmp30_ = string_substring (_tmp24_, (glong) 0, (glong) (_tmp27_ - _tmp29_));
#line 121 "../src/runtime_metadata.vala"
			_g_free0 (mapped);
#line 121 "../src/runtime_metadata.vala"
			mapped = _tmp30_;
#line 997 "runtime_metadata.c"
		}
#line 123 "../src/runtime_metadata.vala"
		_tmp31_ = mapped;
#line 123 "../src/runtime_metadata.vala"
		if (!g_str_has_suffix (_tmp31_, "_zval")) {
#line 1003 "runtime_metadata.c"
			const gchar* _tmp32_;
			gchar* _tmp33_;
#line 124 "../src/runtime_metadata.vala"
			_tmp32_ = mapped;
#line 124 "../src/runtime_metadata.vala"
			_tmp33_ = g_strconcat (_tmp32_, "_zval", NULL);
#line 124 "../src/runtime_metadata.vala"
			_g_free0 (mapped);
#line 124 "../src/runtime_metadata.vala"
			mapped = _tmp33_;
#line 1014 "runtime_metadata.c"
		}
#line 126 "../src/runtime_metadata.vala"
		_tmp34_ = binding->namespace_name;
#line 126 "../src/runtime_metadata.vala"
		_tmp35_ = g_strconcat (_tmp34_, ".", NULL);
#line 126 "../src/runtime_metadata.vala"
		_tmp36_ = _tmp35_;
#line 126 "../src/runtime_metadata.vala"
		_tmp37_ = mapped;
#line 126 "../src/runtime_metadata.vala"
		_tmp38_ = g_strconcat (_tmp36_, _tmp37_, NULL);
#line 126 "../src/runtime_metadata.vala"
		_tmp39_ = _tmp38_;
#line 126 "../src/runtime_metadata.vala"
		_g_free0 (_tmp36_);
#line 126 "../src/runtime_metadata.vala"
		result = _tmp39_;
#line 126 "../src/runtime_metadata.vala"
		_g_free0 (mapped);
#line 126 "../src/runtime_metadata.vala"
		return result;
#line 1036 "runtime_metadata.c"
	}
#line 129 "../src/runtime_metadata.vala"
	if (!optimize_local_vars) {
#line 1040 "runtime_metadata.c"
		const gchar* _tmp40_ = NULL;
		const gchar* _tmp41_;
		gchar* mapped = NULL;
		gchar* _tmp42_;
		const gchar* _tmp43_;
#line 130 "../src/runtime_metadata.vala"
		_tmp41_ = binding->mapped_function_name;
#line 130 "../src/runtime_metadata.vala"
		_tmp40_ = _tmp41_;
#line 130 "../src/runtime_metadata.vala"
		if (_tmp40_ == NULL) {
#line 130 "../src/runtime_metadata.vala"
			_tmp40_ = function_name;
#line 1054 "runtime_metadata.c"
		}
#line 130 "../src/runtime_metadata.vala"
		_tmp42_ = g_strdup (_tmp40_);
#line 130 "../src/runtime_metadata.vala"
		mapped = _tmp42_;
#line 131 "../src/runtime_metadata.vala"
		_tmp43_ = mapped;
#line 131 "../src/runtime_metadata.vala"
		if (g_str_has_suffix (_tmp43_, "_static")) {
#line 1064 "runtime_metadata.c"
			gchar* zval_name = NULL;
			const gchar* _tmp44_;
			const gchar* _tmp45_;
			gint _tmp46_;
			gint _tmp47_;
			gint _tmp48_;
			gint _tmp49_;
			gchar* _tmp50_;
			gchar* _tmp51_;
			gchar* _tmp52_;
			gchar* _tmp53_;
			FunctionBinding* zval_binding = NULL;
			const gchar* _tmp54_;
			gpointer _tmp55_;
			FunctionBinding* _tmp56_;
#line 132 "../src/runtime_metadata.vala"
			_tmp44_ = mapped;
#line 132 "../src/runtime_metadata.vala"
			_tmp45_ = mapped;
#line 132 "../src/runtime_metadata.vala"
			_tmp46_ = strlen (_tmp45_);
#line 132 "../src/runtime_metadata.vala"
			_tmp47_ = _tmp46_;
#line 132 "../src/runtime_metadata.vala"
			_tmp48_ = strlen ("_static");
#line 132 "../src/runtime_metadata.vala"
			_tmp49_ = _tmp48_;
#line 132 "../src/runtime_metadata.vala"
			_tmp50_ = string_substring (_tmp44_, (glong) 0, (glong) (_tmp47_ - _tmp49_));
#line 132 "../src/runtime_metadata.vala"
			_tmp51_ = _tmp50_;
#line 132 "../src/runtime_metadata.vala"
			_tmp52_ = g_strconcat (_tmp51_, "_zval", NULL);
#line 132 "../src/runtime_metadata.vala"
			_tmp53_ = _tmp52_;
#line 132 "../src/runtime_metadata.vala"
			_g_free0 (_tmp51_);
#line 132 "../src/runtime_metadata.vala"
			zval_name = _tmp53_;
#line 133 "../src/runtime_metadata.vala"
			_tmp54_ = zval_name;
#line 133 "../src/runtime_metadata.vala"
			_tmp55_ = gee_abstract_map_get ((GeeAbstractMap*) function_bindings, _tmp54_);
#line 133 "../src/runtime_metadata.vala"
			zval_binding = (FunctionBinding*) _tmp55_;
#line 134 "../src/runtime_metadata.vala"
			_tmp56_ = zval_binding;
#line 134 "../src/runtime_metadata.vala"
			if (_tmp56_ != NULL) {
#line 1114 "runtime_metadata.c"
				FunctionBinding* _tmp57_;
				const gchar* _tmp58_;
				gchar* _tmp59_;
#line 135 "../src/runtime_metadata.vala"
				_tmp57_ = zval_binding;
#line 135 "../src/runtime_metadata.vala"
				_tmp58_ = zval_name;
#line 135 "../src/runtime_metadata.vala"
				_tmp59_ = function_binding_call_name (_tmp57_, _tmp58_);
#line 135 "../src/runtime_metadata.vala"
				result = _tmp59_;
#line 135 "../src/runtime_metadata.vala"
				_g_object_unref0 (zval_binding);
#line 135 "../src/runtime_metadata.vala"
				_g_free0 (zval_name);
#line 135 "../src/runtime_metadata.vala"
				_g_free0 (mapped);
#line 135 "../src/runtime_metadata.vala"
				return result;
#line 1134 "runtime_metadata.c"
			}
#line 131 "../src/runtime_metadata.vala"
			_g_object_unref0 (zval_binding);
#line 131 "../src/runtime_metadata.vala"
			_g_free0 (zval_name);
#line 1140 "runtime_metadata.c"
		}
#line 129 "../src/runtime_metadata.vala"
		_g_free0 (mapped);
#line 1144 "runtime_metadata.c"
	}
#line 140 "../src/runtime_metadata.vala"
	_tmp60_ = function_binding_call_name (binding, function_name);
#line 140 "../src/runtime_metadata.vala"
	result = _tmp60_;
#line 140 "../src/runtime_metadata.vala"
	return result;
#line 1152 "runtime_metadata.c"
}

static gchar*
php_to_vala_runtime_metadata_runtime_module_name (const gchar* package_name)
{
	gchar* module_name = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp6_;
	gchar* result;
#line 143 "../src/runtime_metadata.vala"
	g_return_val_if_fail (package_name != NULL, NULL);
#line 144 "../src/runtime_metadata.vala"
	_tmp0_ = g_strdup (package_name);
#line 144 "../src/runtime_metadata.vala"
	module_name = _tmp0_;
#line 145 "../src/runtime_metadata.vala"
	_tmp1_ = module_name;
#line 145 "../src/runtime_metadata.vala"
	if (g_str_has_prefix (_tmp1_, "valaphp-runtime-")) {
#line 1173 "runtime_metadata.c"
		const gchar* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gchar* _tmp5_;
#line 146 "../src/runtime_metadata.vala"
		_tmp2_ = module_name;
#line 146 "../src/runtime_metadata.vala"
		_tmp3_ = strlen ("valaphp-runtime-");
#line 146 "../src/runtime_metadata.vala"
		_tmp4_ = _tmp3_;
#line 146 "../src/runtime_metadata.vala"
		_tmp5_ = string_substring (_tmp2_, (glong) _tmp4_, (glong) -1);
#line 146 "../src/runtime_metadata.vala"
		_g_free0 (module_name);
#line 146 "../src/runtime_metadata.vala"
		module_name = _tmp5_;
#line 1190 "runtime_metadata.c"
	}
#line 148 "../src/runtime_metadata.vala"
	_tmp6_ = module_name;
#line 148 "../src/runtime_metadata.vala"
	if (g_str_has_suffix (_tmp6_, "-0.01")) {
#line 1196 "runtime_metadata.c"
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gchar* _tmp13_;
#line 149 "../src/runtime_metadata.vala"
		_tmp7_ = module_name;
#line 149 "../src/runtime_metadata.vala"
		_tmp8_ = module_name;
#line 149 "../src/runtime_metadata.vala"
		_tmp9_ = strlen (_tmp8_);
#line 149 "../src/runtime_metadata.vala"
		_tmp10_ = _tmp9_;
#line 149 "../src/runtime_metadata.vala"
		_tmp11_ = strlen ("-0.01");
#line 149 "../src/runtime_metadata.vala"
		_tmp12_ = _tmp11_;
#line 149 "../src/runtime_metadata.vala"
		_tmp13_ = string_substring (_tmp7_, (glong) 0, (glong) (_tmp10_ - _tmp12_));
#line 149 "../src/runtime_metadata.vala"
		_g_free0 (module_name);
#line 149 "../src/runtime_metadata.vala"
		module_name = _tmp13_;
#line 1222 "runtime_metadata.c"
	}
#line 151 "../src/runtime_metadata.vala"
	result = module_name;
#line 151 "../src/runtime_metadata.vala"
	return result;
#line 1228 "runtime_metadata.c"
}

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;
#line 1588 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1588 "glib-2.0.vapi"
	g_return_val_if_fail (old != NULL, NULL);
#line 1588 "glib-2.0.vapi"
	g_return_val_if_fail (replacement != NULL, NULL);
#line 1589 "glib-2.0.vapi"
	if ((*((gchar*) self)) == '\0') {
#line 1589 "glib-2.0.vapi"
		_tmp1_ = TRUE;
#line 1250 "runtime_metadata.c"
	} else {
#line 1589 "glib-2.0.vapi"
		_tmp1_ = (*((gchar*) old)) == '\0';
#line 1254 "runtime_metadata.c"
	}
#line 1589 "glib-2.0.vapi"
	if (_tmp1_) {
#line 1589 "glib-2.0.vapi"
		_tmp0_ = TRUE;
#line 1260 "runtime_metadata.c"
	} else {
#line 1589 "glib-2.0.vapi"
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
#line 1264 "runtime_metadata.c"
	}
#line 1589 "glib-2.0.vapi"
	if (_tmp0_) {
#line 1268 "runtime_metadata.c"
		gchar* _tmp2_;
#line 1590 "glib-2.0.vapi"
		_tmp2_ = g_strdup (self);
#line 1590 "glib-2.0.vapi"
		result = _tmp2_;
#line 1590 "glib-2.0.vapi"
		return result;
#line 1276 "runtime_metadata.c"
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
#line 1593 "glib-2.0.vapi"
		_tmp3_ = g_regex_escape_string (old, -1);
#line 1593 "glib-2.0.vapi"
		_tmp4_ = _tmp3_;
#line 1593 "glib-2.0.vapi"
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
#line 1593 "glib-2.0.vapi"
		_tmp6_ = _tmp5_;
#line 1593 "glib-2.0.vapi"
		_g_free0 (_tmp4_);
#line 1593 "glib-2.0.vapi"
		regex = _tmp6_;
#line 1593 "glib-2.0.vapi"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 1593 "glib-2.0.vapi"
			if (_inner_error0_->domain == G_REGEX_ERROR) {
#line 1304 "runtime_metadata.c"
				goto __catch0_g_regex_error;
			}
#line 1593 "glib-2.0.vapi"
			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);
#line 1593 "glib-2.0.vapi"
			g_clear_error (&_inner_error0_);
#line 1593 "glib-2.0.vapi"
			return NULL;
#line 1313 "runtime_metadata.c"
		}
#line 1594 "glib-2.0.vapi"
		_tmp8_ = regex;
#line 1594 "glib-2.0.vapi"
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
#line 1594 "glib-2.0.vapi"
		_tmp7_ = _tmp9_;
#line 1594 "glib-2.0.vapi"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 1594 "glib-2.0.vapi"
			_g_regex_unref0 (regex);
#line 1594 "glib-2.0.vapi"
			if (_inner_error0_->domain == G_REGEX_ERROR) {
#line 1327 "runtime_metadata.c"
				goto __catch0_g_regex_error;
			}
#line 1594 "glib-2.0.vapi"
			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);
#line 1594 "glib-2.0.vapi"
			g_clear_error (&_inner_error0_);
#line 1594 "glib-2.0.vapi"
			return NULL;
#line 1336 "runtime_metadata.c"
		}
#line 1594 "glib-2.0.vapi"
		_tmp10_ = _tmp7_;
#line 1594 "glib-2.0.vapi"
		_tmp7_ = NULL;
#line 1594 "glib-2.0.vapi"
		result = _tmp10_;
#line 1594 "glib-2.0.vapi"
		_g_free0 (_tmp7_);
#line 1594 "glib-2.0.vapi"
		_g_regex_unref0 (regex);
#line 1594 "glib-2.0.vapi"
		return result;
#line 1350 "runtime_metadata.c"
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
#line 1592 "glib-2.0.vapi"
		g_clear_error (&_inner_error0_);
#line 1596 "glib-2.0.vapi"
		g_assert_not_reached ();
#line 1359 "runtime_metadata.c"
	}
	__finally0:
#line 1592 "glib-2.0.vapi"
	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);
#line 1592 "glib-2.0.vapi"
	g_clear_error (&_inner_error0_);
#line 1592 "glib-2.0.vapi"
	return NULL;
#line 1368 "runtime_metadata.c"
}

static gchar*
php_to_vala_runtime_metadata_escape_vala_string (const gchar* value)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* result;
#line 154 "../src/runtime_metadata.vala"
	g_return_val_if_fail (value != NULL, NULL);
#line 155 "../src/runtime_metadata.vala"
	_tmp0_ = string_replace (value, "\\", "\\\\");
#line 155 "../src/runtime_metadata.vala"
	_tmp1_ = _tmp0_;
#line 155 "../src/runtime_metadata.vala"
	_tmp2_ = string_replace (_tmp1_, "\"", "\\\"");
#line 155 "../src/runtime_metadata.vala"
	_tmp3_ = _tmp2_;
#line 155 "../src/runtime_metadata.vala"
	_tmp4_ = string_replace (_tmp3_, "\n", "\\n");
#line 155 "../src/runtime_metadata.vala"
	_tmp5_ = _tmp4_;
#line 155 "../src/runtime_metadata.vala"
	_g_free0 (_tmp3_);
#line 155 "../src/runtime_metadata.vala"
	_g_free0 (_tmp1_);
#line 155 "../src/runtime_metadata.vala"
	result = _tmp5_;
#line 155 "../src/runtime_metadata.vala"
	return result;
#line 1403 "runtime_metadata.c"
}

PhpToValaRuntimeMetadata*
php_to_vala_runtime_metadata_construct (GType object_type)
{
	PhpToValaRuntimeMetadata * self = NULL;
#line 3 "../src/runtime_metadata.vala"
	self = (PhpToValaRuntimeMetadata*) g_object_new (object_type, NULL);
#line 3 "../src/runtime_metadata.vala"
	return self;
#line 1414 "runtime_metadata.c"
}

PhpToValaRuntimeMetadata*
php_to_vala_runtime_metadata_new (void)
{
#line 3 "../src/runtime_metadata.vala"
	return php_to_vala_runtime_metadata_construct (TYPE_PHP_TO_VALA_RUNTIME_METADATA);
#line 1422 "runtime_metadata.c"
}

static void
php_to_vala_runtime_metadata_class_init (PhpToValaRuntimeMetadataClass * klass,
                                         gpointer klass_data)
{
#line 3 "../src/runtime_metadata.vala"
	php_to_vala_runtime_metadata_parent_class = g_type_class_peek_parent (klass);
#line 1431 "runtime_metadata.c"
}

static void
php_to_vala_runtime_metadata_instance_init (PhpToValaRuntimeMetadata * self,
                                            gpointer klass)
{
}

static GType
php_to_vala_runtime_metadata_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PhpToValaRuntimeMetadataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) php_to_vala_runtime_metadata_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhpToValaRuntimeMetadata), 0, (GInstanceInitFunc) php_to_vala_runtime_metadata_instance_init, NULL };
	GType php_to_vala_runtime_metadata_type_id;
	php_to_vala_runtime_metadata_type_id = g_type_register_static (G_TYPE_OBJECT, "PhpToValaRuntimeMetadata", &g_define_type_info, 0);
	return php_to_vala_runtime_metadata_type_id;
}

GType
php_to_vala_runtime_metadata_get_type (void)
{
	static volatile gsize php_to_vala_runtime_metadata_type_id__once = 0;
	if (g_once_init_enter (&php_to_vala_runtime_metadata_type_id__once)) {
		GType php_to_vala_runtime_metadata_type_id;
		php_to_vala_runtime_metadata_type_id = php_to_vala_runtime_metadata_get_type_once ();
		g_once_init_leave (&php_to_vala_runtime_metadata_type_id__once, php_to_vala_runtime_metadata_type_id);
	}
	return php_to_vala_runtime_metadata_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;
}

