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

#include <stdlib.h>
#include <string.h>
#include <glib.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 _g_free0(var) (var = (g_free (var), NULL))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

VALA_EXTERN gchar** test (gint* result_length1,
              GError** error);
static void _vala_main (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);

gchar**
test (gint* result_length1,
      GError** error)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** result;
	_tmp0_ = g_strdup ("1");
	_tmp1_ = g_new0 (gchar*, 2 + 1);
	_tmp1_[0] = NULL;
	_tmp1_[1] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 2;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static void
_vala_main (void)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* t = NULL;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_ = NULL;
	const gchar* _tmp13_ = NULL;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar** _tmp16_ = NULL;
	gint _tmp17_ = 0;
	gchar** _tmp18_;
	gint _tmp16__length1;
	gint __tmp16__size_;
	const gchar* _tmp19_ = NULL;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar** _tmp23_ = NULL;
	gint _tmp24_ = 0;
	gchar** _tmp25_;
	gint _tmp23__length1;
	gint __tmp23__size_;
	const gchar* _tmp26_ = NULL;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	const gchar* _tmp29_;
	GError* _inner_error0_ = NULL;
	if (TRUE) {
		_tmp0_ = "1";
	} else {
		_tmp0_ = "2";
	}
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		_tmp1_ = "3";
	}
	_tmp2_ = g_strdup (_tmp1_);
	t = _tmp2_;
	_tmp3_ = t;
	_vala_assert (g_strcmp0 (_tmp3_, "1") == 0, "t == \"1\"");
	if (FALSE) {
		_tmp4_ = "1";
	} else {
		_tmp4_ = "2";
	}
	_tmp5_ = _tmp4_;
	if (_tmp5_ == NULL) {
		_tmp5_ = "3";
	}
	_tmp6_ = g_strdup (_tmp5_);
	_g_free0 (t);
	t = _tmp6_;
	_tmp7_ = t;
	_vala_assert (g_strcmp0 (_tmp7_, "2") == 0, "t == \"2\"");
	if (TRUE) {
		_tmp8_ = NULL;
	} else {
		_tmp8_ = "2";
	}
	_tmp9_ = _tmp8_;
	if (_tmp9_ == NULL) {
		_tmp9_ = "3";
	}
	_tmp10_ = g_strdup (_tmp9_);
	_g_free0 (t);
	t = _tmp10_;
	_tmp11_ = t;
	_vala_assert (g_strcmp0 (_tmp11_, "3") == 0, "t == \"3\"");
	if (FALSE) {
		_tmp12_ = "1";
	} else {
		_tmp12_ = NULL;
	}
	_tmp13_ = _tmp12_;
	if (_tmp13_ == NULL) {
		_tmp13_ = "3";
	}
	_tmp14_ = g_strdup (_tmp13_);
	_g_free0 (t);
	t = _tmp14_;
	_tmp15_ = t;
	_vala_assert (g_strcmp0 (_tmp15_, "3") == 0, "t == \"3\"");
	_tmp18_ = test (&_tmp17_, &_inner_error0_);
	_tmp16_ = _tmp18_;
	_tmp16__length1 = _tmp17_;
	__tmp16__size_ = _tmp16__length1;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (t);
		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;
	}
	_tmp20_ = _tmp16_[0];
	_tmp19_ = _tmp20_;
	if (_tmp19_ == NULL) {
		_tmp19_ = "2";
	}
	_tmp21_ = g_strdup (_tmp19_);
	_g_free0 (t);
	t = _tmp21_;
	_tmp22_ = t;
	_vala_assert (g_strcmp0 (_tmp22_, "2") == 0, "t == \"2\"");
	_tmp25_ = test (&_tmp24_, &_inner_error0_);
	_tmp23_ = _tmp25_;
	_tmp23__length1 = _tmp24_;
	__tmp23__size_ = _tmp23__length1;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (t);
		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;
	}
	_tmp27_ = _tmp23_[1];
	_tmp26_ = _tmp27_;
	if (_tmp26_ == NULL) {
		_tmp26_ = "2";
	}
	_tmp28_ = g_strdup (_tmp26_);
	_g_free0 (t);
	t = _tmp28_;
	_tmp29_ = t;
	_vala_assert (g_strcmp0 (_tmp29_, "1") == 0, "t == \"1\"");
	_tmp23_ = (_vala_array_free (_tmp23_, _tmp23__length1, (GDestroyNotify) g_free), NULL);
	_tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (t);
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}

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);
}

