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

#include <glib.h>
#include <float.h>
#include <math.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _g_free0(var) ((var == NULL) ? NULL : (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);

static void _vala_main (void);
static gdouble* _double_dup (gdouble* self);
static gboolean _double_equal (const gdouble * s1,
                        const gdouble * s2);
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 gdouble*
_double_dup (gdouble* self)
{
	gdouble* dup;
	dup = g_new0 (gdouble, 1);
	memcpy (dup, self, sizeof (gdouble));
	return dup;
}

static gpointer
__double_dup0 (gpointer self)
{
	return self ? _double_dup (self) : NULL;
}

static gboolean
_double_equal (const gdouble * s1,
               const gdouble * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static void
_vala_main (void)
{
	gdouble** array = NULL;
	gdouble _tmp0_;
	gdouble* _tmp1_;
	gdouble _tmp2_;
	gdouble* _tmp3_;
	gdouble _tmp4_;
	gdouble* _tmp5_;
	gdouble** _tmp6_;
	gint array_length1;
	gint _array_size_;
	gdouble** _tmp7_;
	gint _tmp7__length1;
	_tmp0_ = (gdouble) 3;
	_tmp1_ = __double_dup0 (&_tmp0_);
	_tmp2_ = (gdouble) 3;
	_tmp3_ = __double_dup0 (&_tmp2_);
	_tmp4_ = (gdouble) 3;
	_tmp5_ = __double_dup0 (&_tmp4_);
	_tmp6_ = g_new0 (gdouble*, 3);
	_tmp6_[0] = _tmp1_;
	_tmp6_[1] = _tmp3_;
	_tmp6_[2] = _tmp5_;
	array = _tmp6_;
	array_length1 = 3;
	_array_size_ = array_length1;
	_tmp7_ = array;
	_tmp7__length1 = array_length1;
	{
		gdouble** i_collection = NULL;
		gint i_collection_length1 = 0;
		gint _i_collection_size_ = 0;
		gint i_it = 0;
		i_collection = _tmp7_;
		i_collection_length1 = _tmp7__length1;
		for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
			gdouble* _tmp8_;
			gdouble* i = NULL;
			_tmp8_ = __double_dup0 (i_collection[i_it]);
			i = _tmp8_;
			{
				gdouble* _tmp9_;
				gdouble _tmp10_;
				_tmp9_ = i;
				_tmp10_ = (gdouble) 3;
				_vala_assert (_double_equal (_tmp9_, &_tmp10_) == TRUE, "i == 3");
				_g_free0 (i);
			}
		}
	}
	array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
}

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

