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

#include <glib-object.h>
#include <glib.h>
#include <gio/gio.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_XYZZY (xyzzy_get_type ())
#define XYZZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_XYZZY, Xyzzy))
#define XYZZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_XYZZY, XyzzyClass))
#define IS_XYZZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_XYZZY))
#define IS_XYZZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XYZZY))
#define XYZZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XYZZY, XyzzyClass))

typedef struct _Xyzzy Xyzzy;
typedef struct _XyzzyClass XyzzyClass;
typedef struct _XyzzyPrivate XyzzyPrivate;
enum  {
	XYZZY_0_PROPERTY,
	XYZZY_B_PROPERTY,
	XYZZY_NUM_PROPERTIES
};
static GParamSpec* xyzzy_properties[XYZZY_NUM_PROPERTIES];
typedef struct _GoAsyncData GoAsyncData;

struct _Xyzzy {
	GObject parent_instance;
	XyzzyPrivate * priv;
};

struct _XyzzyClass {
	GObjectClass parent_class;
};

struct _XyzzyPrivate {
	gboolean _b;
};

struct _GoAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Xyzzy* _tmp0_;
	guint _tmp1_;
	GQuark _tmp2_;
};

static gint Xyzzy_private_offset;
static gpointer xyzzy_parent_class = NULL;
VALA_EXTERN Xyzzy* xyzzy;
Xyzzy* xyzzy = NULL;

VALA_EXTERN GType xyzzy_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Xyzzy, g_object_unref)
VALA_EXTERN Xyzzy* xyzzy_new (void);
VALA_EXTERN Xyzzy* xyzzy_construct (GType object_type);
VALA_EXTERN gboolean xyzzy_get_b (Xyzzy* self);
VALA_EXTERN void xyzzy_set_b (Xyzzy* self,
                  gboolean value);
static void xyzzy_finalize (GObject * obj);
static GType xyzzy_get_type_once (void);
static void _vala_xyzzy_get_property (GObject * object,
                               guint property_id,
                               GValue * value,
                               GParamSpec * pspec);
static void _vala_xyzzy_set_property (GObject * object,
                               guint property_id,
                               const GValue * value,
                               GParamSpec * pspec);
VALA_EXTERN void on_b (void);
static void go_async_data_free (gpointer _data);
VALA_EXTERN void go_async (GAsyncReadyCallback _callback_,
               gpointer _user_data_);
VALA_EXTERN void go_finish (GAsyncResult* _res_,
                GError** error);
static gboolean go_async_co (GoAsyncData* _data_);
static void _on_b_g_object_notify (GObject* _sender,
                            GParamSpec* pspec,
                            gpointer self);
static void _vala_main (void);

static inline gpointer
xyzzy_get_instance_private (Xyzzy* self)
{
	return G_STRUCT_MEMBER_P (self, Xyzzy_private_offset);
}

Xyzzy*
xyzzy_construct (GType object_type)
{
	Xyzzy * self = NULL;
	self = (Xyzzy*) g_object_new (object_type, NULL);
	return self;
}

Xyzzy*
xyzzy_new (void)
{
	return xyzzy_construct (TYPE_XYZZY);
}

gboolean
xyzzy_get_b (Xyzzy* self)
{
	gboolean result;
	g_return_val_if_fail (IS_XYZZY (self), FALSE);
	result = self->priv->_b;
	return result;
}

void
xyzzy_set_b (Xyzzy* self,
             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (IS_XYZZY (self));
	old_value = xyzzy_get_b (self);
	if (old_value != value) {
		self->priv->_b = value;
		g_object_notify_by_pspec ((GObject *) self, xyzzy_properties[XYZZY_B_PROPERTY]);
	}
}

static void
xyzzy_class_init (XyzzyClass * klass,
                  gpointer klass_data)
{
	xyzzy_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &Xyzzy_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xyzzy_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xyzzy_set_property;
	G_OBJECT_CLASS (klass)->finalize = xyzzy_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XYZZY_B_PROPERTY, xyzzy_properties[XYZZY_B_PROPERTY] = g_param_spec_boolean ("b", "b", "b", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
xyzzy_instance_init (Xyzzy * self,
                     gpointer klass)
{
	self->priv = xyzzy_get_instance_private (self);
}

static void
xyzzy_finalize (GObject * obj)
{
	Xyzzy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_XYZZY, Xyzzy);
	G_OBJECT_CLASS (xyzzy_parent_class)->finalize (obj);
}

static GType
xyzzy_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XyzzyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xyzzy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Xyzzy), 0, (GInstanceInitFunc) xyzzy_instance_init, NULL };
	GType xyzzy_type_id;
	xyzzy_type_id = g_type_register_static (G_TYPE_OBJECT, "Xyzzy", &g_define_type_info, 0);
	Xyzzy_private_offset = g_type_add_instance_private (xyzzy_type_id, sizeof (XyzzyPrivate));
	return xyzzy_type_id;
}

GType
xyzzy_get_type (void)
{
	static volatile gsize xyzzy_type_id__once = 0;
	if (g_once_init_enter (&xyzzy_type_id__once)) {
		GType xyzzy_type_id;
		xyzzy_type_id = xyzzy_get_type_once ();
		g_once_init_leave (&xyzzy_type_id__once, xyzzy_type_id);
	}
	return xyzzy_type_id__once;
}

static void
_vala_xyzzy_get_property (GObject * object,
                          guint property_id,
                          GValue * value,
                          GParamSpec * pspec)
{
	Xyzzy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_XYZZY, Xyzzy);
	switch (property_id) {
		case XYZZY_B_PROPERTY:
		g_value_set_boolean (value, xyzzy_get_b (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xyzzy_set_property (GObject * object,
                          guint property_id,
                          const GValue * value,
                          GParamSpec * pspec)
{
	Xyzzy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_XYZZY, Xyzzy);
	switch (property_id) {
		case XYZZY_B_PROPERTY:
		xyzzy_set_b (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
on_b (void)
{
}

static void
go_async_data_free (gpointer _data)
{
	GoAsyncData* _data_;
	_data_ = _data;
	g_slice_free (GoAsyncData, _data_);
}

void
go_async (GAsyncReadyCallback _callback_,
          gpointer _user_data_)
{
	GoAsyncData* _data_;
	_data_ = g_slice_new0 (GoAsyncData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, go_async_data_free);
	go_async_co (_data_);
}

void
go_finish (GAsyncResult* _res_,
           GError** error)
{
	GoAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_on_b_g_object_notify (GObject* _sender,
                       GParamSpec* pspec,
                       gpointer self)
{
	on_b ();
}

static gboolean
go_async_co (GoAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xyzzy;
	g_signal_parse_name ("notify::b", G_TYPE_OBJECT, &_data_->_tmp1_, &_data_->_tmp2_, TRUE);
	g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp0_, G_TYPE_OBJECT, GObject), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp1_, _data_->_tmp2_, NULL, (GCallback) _on_b_g_object_notify, NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_vala_main (void)
{
}

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

