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

#include "xmpp-vala.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.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

enum  {
	XMPP_XEP_IN_BAND_REGISTRATION_MODULE_0_PROPERTY,
	XMPP_XEP_IN_BAND_REGISTRATION_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_in_band_registration_module_properties[XMPP_XEP_IN_BAND_REGISTRATION_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _xmpp_xep_data_forms_data_form_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_data_forms_data_form_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppXepInBandRegistrationModuleGetFromServerData XmppXepInBandRegistrationModuleGetFromServerData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_error_stanza_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_error_stanza_unref (var), NULL)))
typedef struct _XmppXepInBandRegistrationModuleSubmitToServerData XmppXepInBandRegistrationModuleSubmitToServerData;
typedef struct _XmppXepInBandRegistrationModuleChangePasswordData XmppXepInBandRegistrationModuleChangePasswordData;

struct _XmppXepInBandRegistrationModuleGetFromServerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepInBandRegistrationModule* self;
	XmppXmppStream* stream;
	XmppJid* jid;
	XmppXepInBandRegistrationForm* result;
	XmppStanzaNode* query_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppIqStanza* request_form_iq;
	XmppJid* _tmp4_;
	XmppIqStanza* _tmp5_;
	XmppIqStanza* iq_result;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppIqModule* _tmp8_;
	XmppIqStanza* _tmp9_;
	XmppIqStanza* _tmp10_;
	XmppXepInBandRegistrationForm* _tmp11_;
	GError* _inner_error0_;
};

struct _XmppXepInBandRegistrationModuleSubmitToServerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepInBandRegistrationModule* self;
	XmppXmppStream* stream;
	XmppJid* jid;
	XmppXepInBandRegistrationForm* form;
	gchar* result;
	XmppStanzaNode* query_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppIqStanza* iq;
	XmppJid* _tmp8_;
	XmppIqStanza* _tmp9_;
	XmppIqStanza* iq_result;
	XmppModuleIdentity* _tmp10_;
	gpointer _tmp11_;
	XmppIqModule* _tmp12_;
	XmppIqStanza* _tmp13_;
	XmppIqStanza* _tmp14_;
	XmppErrorStanza* error_stanza;
	XmppErrorStanza* _tmp15_;
	const gchar* _tmp16_;
	XmppErrorStanza* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	GError* _inner_error0_;
};

struct _XmppXepInBandRegistrationModuleChangePasswordData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepInBandRegistrationModule* self;
	XmppXmppStream* stream;
	XmppJid* jid;
	gchar* new_pw;
	XmppErrorStanza* result;
	XmppStanzaNode* pw_change_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* username_node;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* pw_node;
	XmppStanzaNode* _tmp5_;
	const gchar* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	XmppStanzaNode* _tmp15_;
	XmppStanzaNode* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppIqStanza* set_password_iq;
	XmppJid* _tmp19_;
	XmppJid* _tmp20_;
	XmppJid* _tmp21_;
	XmppJid* _tmp22_;
	XmppJid* _tmp23_;
	XmppIqStanza* _tmp24_;
	XmppIqStanza* _tmp25_;
	XmppIqStanza* chpw_result;
	XmppModuleIdentity* _tmp26_;
	gpointer _tmp27_;
	XmppIqModule* _tmp28_;
	XmppIqStanza* _tmp29_;
	XmppIqStanza* _tmp30_;
	XmppErrorStanza* _tmp31_;
	GError* _inner_error0_;
};

static gpointer xmpp_xep_in_band_registration_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_in_band_registration_module_IDENTITY = NULL;
static gpointer xmpp_xep_in_band_registration_form_parent_class = NULL;

static void xmpp_xep_in_band_registration_module_get_from_server_data_free (gpointer _data);
static gboolean xmpp_xep_in_band_registration_module_get_from_server_co (XmppXepInBandRegistrationModuleGetFromServerData* _data_);
static void xmpp_xep_in_band_registration_module_get_from_server_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_);
VALA_EXTERN XmppXepInBandRegistrationForm* xmpp_xep_in_band_registration_form_new_from_node (XmppXmppStream* stream,
                                                                                 XmppIqStanza* iq);
VALA_EXTERN XmppXepInBandRegistrationForm* xmpp_xep_in_band_registration_form_construct_from_node (GType object_type,
                                                                                       XmppXmppStream* stream,
                                                                                       XmppIqStanza* iq);
static void xmpp_xep_in_band_registration_module_submit_to_server_data_free (gpointer _data);
static gboolean xmpp_xep_in_band_registration_module_submit_to_server_co (XmppXepInBandRegistrationModuleSubmitToServerData* _data_);
static void xmpp_xep_in_band_registration_module_submit_to_server_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
static void xmpp_xep_in_band_registration_module_change_password_data_free (gpointer _data);
static gboolean xmpp_xep_in_band_registration_module_change_password_co (XmppXepInBandRegistrationModuleChangePasswordData* _data_);
static void xmpp_xep_in_band_registration_module_change_password_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_);
static gboolean xmpp_xep_in_band_registration_module_real_mandatory_outstanding (XmppXmppStreamNegotiationModule* base,
                                                                          XmppXmppStream* stream);
static gboolean xmpp_xep_in_band_registration_module_real_negotiation_active (XmppXmppStreamNegotiationModule* base,
                                                                       XmppXmppStream* stream);
static void xmpp_xep_in_band_registration_module_real_attach (XmppXmppStreamModule* base,
                                                       XmppXmppStream* stream);
static void xmpp_xep_in_band_registration_module_real_detach (XmppXmppStreamModule* base,
                                                       XmppXmppStream* stream);
static gchar* xmpp_xep_in_band_registration_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_in_band_registration_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_in_band_registration_module_finalize (GObject * obj);
static GType xmpp_xep_in_band_registration_module_get_type_once (void);
VALA_EXTERN XmppXepDataFormsDataForm* xmpp_xep_data_forms_data_form_new_from_node (XmppStanzaNode* node);
VALA_EXTERN XmppXepDataFormsDataForm* xmpp_xep_data_forms_data_form_construct_from_node (GType object_type,
                                                                             XmppStanzaNode* node);
VALA_EXTERN XmppXepDataFormsDataForm* xmpp_xep_data_forms_data_form_new (void);
VALA_EXTERN XmppXepDataFormsDataForm* xmpp_xep_data_forms_data_form_construct (GType object_type);
static void xmpp_xep_in_band_registration_form_finalize (XmppXepDataFormsDataForm * obj);
static GType xmpp_xep_in_band_registration_form_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
xmpp_xep_in_band_registration_module_get_from_server_data_free (gpointer _data)
{
	XmppXepInBandRegistrationModuleGetFromServerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->jid);
	_xmpp_xep_data_forms_data_form_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepInBandRegistrationModuleGetFromServerData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

void
xmpp_xep_in_band_registration_module_get_from_server (XmppXepInBandRegistrationModule* self,
                                                      XmppXmppStream* stream,
                                                      XmppJid* jid,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_)
{
	XmppXepInBandRegistrationModuleGetFromServerData* _data_;
	XmppXepInBandRegistrationModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	_data_ = g_slice_new0 (XmppXepInBandRegistrationModuleGetFromServerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_in_band_registration_module_get_from_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (_data_->jid);
	_data_->jid = _tmp2_;
	xmpp_xep_in_band_registration_module_get_from_server_co (_data_);
}

XmppXepInBandRegistrationForm*
xmpp_xep_in_band_registration_module_get_from_server_finish (XmppXepInBandRegistrationModule* self,
                                                             GAsyncResult* _res_)
{
	XmppXepInBandRegistrationForm* result;
	XmppXepInBandRegistrationModuleGetFromServerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
xmpp_xep_in_band_registration_module_get_from_server_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_)
{
	XmppXepInBandRegistrationModuleGetFromServerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_in_band_registration_module_get_from_server_co (_data_);
}

static gboolean
xmpp_xep_in_band_registration_module_get_from_server_co (XmppXepInBandRegistrationModuleGetFromServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_stanza_node_new_build ("query", XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, NULL, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp1_);
	_data_->query_node = _data_->_tmp3_;
	_data_->_tmp4_ = _xmpp_jid_ref0 (_data_->jid);
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = xmpp_iq_stanza_new_get (_data_->query_node, NULL);
	xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp5_, _data_->_tmp4_);
	_xmpp_jid_unref0 (_data_->_tmp4_);
	_data_->request_form_iq = _data_->_tmp5_;
	xmpp_stanza_set_to ((XmppStanza*) _data_->request_form_iq, _data_->jid);
	_data_->_tmp6_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp7_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp6_);
	_data_->_tmp8_ = (XmppIqModule*) _data_->_tmp7_;
	_data_->_state_ = 1;
	xmpp_iq_module_send_iq_async (_data_->_tmp8_, _data_->stream, _data_->request_form_iq, G_PRIORITY_DEFAULT, NULL, xmpp_xep_in_band_registration_module_get_from_server_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = xmpp_iq_module_send_iq_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_g_object_unref0 (_data_->_tmp8_);
	_data_->iq_result = _data_->_tmp10_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->request_form_iq);
		_xmpp_stanza_entry_unref0 (_data_->query_node);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = xmpp_xep_in_band_registration_form_new_from_node (_data_->stream, _data_->iq_result);
	_data_->result = _data_->_tmp11_;
	_g_object_unref0 (_data_->iq_result);
	_g_object_unref0 (_data_->request_form_iq);
	_xmpp_stanza_entry_unref0 (_data_->query_node);
	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
xmpp_xep_in_band_registration_module_submit_to_server_data_free (gpointer _data)
{
	XmppXepInBandRegistrationModuleSubmitToServerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->jid);
	_xmpp_xep_data_forms_data_form_unref0 (_data_->form);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepInBandRegistrationModuleSubmitToServerData, _data_);
}

static gpointer
_xmpp_xep_data_forms_data_form_ref0 (gpointer self)
{
	return self ? xmpp_xep_data_forms_data_form_ref (self) : NULL;
}

void
xmpp_xep_in_band_registration_module_submit_to_server (XmppXepInBandRegistrationModule* self,
                                                       XmppXmppStream* stream,
                                                       XmppJid* jid,
                                                       XmppXepInBandRegistrationForm* form,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	XmppXepInBandRegistrationModuleSubmitToServerData* _data_;
	XmppXepInBandRegistrationModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	XmppXepInBandRegistrationForm* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (form != NULL);
	_data_ = g_slice_new0 (XmppXepInBandRegistrationModuleSubmitToServerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_in_band_registration_module_submit_to_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (_data_->jid);
	_data_->jid = _tmp2_;
	_tmp3_ = _xmpp_xep_data_forms_data_form_ref0 (form);
	_xmpp_xep_data_forms_data_form_unref0 (_data_->form);
	_data_->form = _tmp3_;
	xmpp_xep_in_band_registration_module_submit_to_server_co (_data_);
}

gchar*
xmpp_xep_in_band_registration_module_submit_to_server_finish (XmppXepInBandRegistrationModule* self,
                                                              GAsyncResult* _res_)
{
	gchar* result;
	XmppXepInBandRegistrationModuleSubmitToServerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
xmpp_xep_in_band_registration_module_submit_to_server_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	XmppXepInBandRegistrationModuleSubmitToServerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_in_band_registration_module_submit_to_server_co (_data_);
}

static gboolean
xmpp_xep_in_band_registration_module_submit_to_server_co (XmppXepInBandRegistrationModuleSubmitToServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_stanza_node_new_build ("query", XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, NULL, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp1_);
	_data_->query_node = _data_->_tmp3_;
	_data_->_tmp4_ = xmpp_xep_data_forms_data_form_get_submit_node ((XmppXepDataFormsDataForm*) _data_->form);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = xmpp_stanza_node_put_node (_data_->query_node, _data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp7_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp5_);
	_data_->_tmp8_ = _xmpp_jid_ref0 (_data_->jid);
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = xmpp_iq_stanza_new_set (_data_->query_node, NULL);
	xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp9_, _data_->_tmp8_);
	_xmpp_jid_unref0 (_data_->_tmp8_);
	_data_->iq = _data_->_tmp9_;
	_data_->_tmp10_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp11_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp10_);
	_data_->_tmp12_ = (XmppIqModule*) _data_->_tmp11_;
	_data_->_state_ = 1;
	xmpp_iq_module_send_iq_async (_data_->_tmp12_, _data_->stream, _data_->iq, G_PRIORITY_DEFAULT, NULL, xmpp_xep_in_band_registration_module_submit_to_server_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp13_ = xmpp_iq_module_send_iq_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_g_object_unref0 (_data_->_tmp12_);
	_data_->iq_result = _data_->_tmp14_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->iq);
		_xmpp_stanza_entry_unref0 (_data_->query_node);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (xmpp_stanza_is_error ((XmppStanza*) _data_->iq_result)) {
		_data_->_tmp15_ = xmpp_stanza_get_error ((XmppStanza*) _data_->iq_result);
		_data_->error_stanza = _data_->_tmp15_;
		_data_->_tmp17_ = _data_->error_stanza;
		_data_->_tmp18_ = xmpp_error_stanza_get_text (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp16_ = _data_->_tmp19_;
		if (_data_->_tmp16_ == NULL) {
			_data_->_tmp16_ = "Error";
		}
		_data_->_tmp20_ = g_strdup (_data_->_tmp16_);
		_data_->result = _data_->_tmp20_;
		_xmpp_error_stanza_unref0 (_data_->error_stanza);
		_g_object_unref0 (_data_->iq_result);
		_g_object_unref0 (_data_->iq);
		_xmpp_stanza_entry_unref0 (_data_->query_node);
		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;
	}
	_data_->result = NULL;
	_g_object_unref0 (_data_->iq_result);
	_g_object_unref0 (_data_->iq);
	_xmpp_stanza_entry_unref0 (_data_->query_node);
	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
xmpp_xep_in_band_registration_module_change_password_data_free (gpointer _data)
{
	XmppXepInBandRegistrationModuleChangePasswordData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->jid);
	_g_free0 (_data_->new_pw);
	_xmpp_error_stanza_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepInBandRegistrationModuleChangePasswordData, _data_);
}

void
xmpp_xep_in_band_registration_module_change_password (XmppXepInBandRegistrationModule* self,
                                                      XmppXmppStream* stream,
                                                      XmppJid* jid,
                                                      const gchar* new_pw,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_)
{
	XmppXepInBandRegistrationModuleChangePasswordData* _data_;
	XmppXepInBandRegistrationModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (new_pw != NULL);
	_data_ = g_slice_new0 (XmppXepInBandRegistrationModuleChangePasswordData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_in_band_registration_module_change_password_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (_data_->jid);
	_data_->jid = _tmp2_;
	_tmp3_ = g_strdup (new_pw);
	_g_free0 (_data_->new_pw);
	_data_->new_pw = _tmp3_;
	xmpp_xep_in_band_registration_module_change_password_co (_data_);
}

XmppErrorStanza*
xmpp_xep_in_band_registration_module_change_password_finish (XmppXepInBandRegistrationModule* self,
                                                             GAsyncResult* _res_)
{
	XmppErrorStanza* result;
	XmppXepInBandRegistrationModuleChangePasswordData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
xmpp_xep_in_band_registration_module_change_password_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_)
{
	XmppXepInBandRegistrationModuleChangePasswordData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_in_band_registration_module_change_password_co (_data_);
}

static gboolean
xmpp_xep_in_band_registration_module_change_password_co (XmppXepInBandRegistrationModuleChangePasswordData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_stanza_node_new_build ("query", XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, NULL, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp1_);
	_data_->pw_change_node = _data_->_tmp3_;
	_data_->_tmp4_ = xmpp_stanza_node_new_build ("username", XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, NULL, NULL);
	_data_->username_node = _data_->_tmp4_;
	_data_->_tmp5_ = xmpp_stanza_node_new_build ("password", XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, NULL, NULL);
	_data_->pw_node = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->jid->localpart;
	_data_->_tmp7_ = xmpp_stanza_node_new_text (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = xmpp_stanza_node_put_node (_data_->username_node, _data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp10_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp8_);
	_data_->_tmp11_ = xmpp_stanza_node_new_text (_data_->new_pw);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = xmpp_stanza_node_put_node (_data_->pw_node, _data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp14_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp12_);
	_data_->_tmp15_ = xmpp_stanza_node_put_node (_data_->pw_change_node, _data_->username_node);
	_data_->_tmp16_ = _data_->_tmp15_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp16_);
	_data_->_tmp17_ = xmpp_stanza_node_put_node (_data_->pw_change_node, _data_->pw_node);
	_data_->_tmp18_ = _data_->_tmp17_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp18_);
	_data_->_tmp19_ = xmpp_jid_get_bare_jid (_data_->jid);
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = xmpp_jid_get_domain_jid (_data_->_tmp21_);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = NULL;
	_data_->_tmp24_ = xmpp_iq_stanza_new_set (_data_->pw_change_node, NULL);
	xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp24_, _data_->_tmp23_);
	_xmpp_jid_unref0 (_data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	_xmpp_jid_unref0 (_data_->_tmp21_);
	_data_->set_password_iq = _data_->_tmp25_;
	_data_->_tmp26_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp27_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp26_);
	_data_->_tmp28_ = (XmppIqModule*) _data_->_tmp27_;
	_data_->_state_ = 1;
	xmpp_iq_module_send_iq_async (_data_->_tmp28_, _data_->stream, _data_->set_password_iq, G_PRIORITY_DEFAULT, NULL, xmpp_xep_in_band_registration_module_change_password_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp29_ = xmpp_iq_module_send_iq_finish (_data_->_tmp28_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp30_ = _data_->_tmp29_;
	_g_object_unref0 (_data_->_tmp28_);
	_data_->chpw_result = _data_->_tmp30_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->set_password_iq);
		_xmpp_stanza_entry_unref0 (_data_->pw_node);
		_xmpp_stanza_entry_unref0 (_data_->username_node);
		_xmpp_stanza_entry_unref0 (_data_->pw_change_node);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (xmpp_stanza_is_error ((XmppStanza*) _data_->chpw_result)) {
		_data_->_tmp31_ = xmpp_stanza_get_error ((XmppStanza*) _data_->chpw_result);
		_data_->result = _data_->_tmp31_;
		_g_object_unref0 (_data_->chpw_result);
		_g_object_unref0 (_data_->set_password_iq);
		_xmpp_stanza_entry_unref0 (_data_->pw_node);
		_xmpp_stanza_entry_unref0 (_data_->username_node);
		_xmpp_stanza_entry_unref0 (_data_->pw_change_node);
		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;
	}
	_data_->result = NULL;
	_g_object_unref0 (_data_->chpw_result);
	_g_object_unref0 (_data_->set_password_iq);
	_xmpp_stanza_entry_unref0 (_data_->pw_node);
	_xmpp_stanza_entry_unref0 (_data_->username_node);
	_xmpp_stanza_entry_unref0 (_data_->pw_change_node);
	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 gboolean
xmpp_xep_in_band_registration_module_real_mandatory_outstanding (XmppXmppStreamNegotiationModule* base,
                                                                 XmppXmppStream* stream)
{
	XmppXepInBandRegistrationModule * self;
	gboolean result;
	self = (XmppXepInBandRegistrationModule*) base;
	g_return_val_if_fail (stream != NULL, FALSE);
	result = FALSE;
	return result;
}

static gboolean
xmpp_xep_in_band_registration_module_real_negotiation_active (XmppXmppStreamNegotiationModule* base,
                                                              XmppXmppStream* stream)
{
	XmppXepInBandRegistrationModule * self;
	gboolean result;
	self = (XmppXepInBandRegistrationModule*) base;
	g_return_val_if_fail (stream != NULL, FALSE);
	result = FALSE;
	return result;
}

static void
xmpp_xep_in_band_registration_module_real_attach (XmppXmppStreamModule* base,
                                                  XmppXmppStream* stream)
{
	XmppXepInBandRegistrationModule * self;
	self = (XmppXepInBandRegistrationModule*) base;
	g_return_if_fail (stream != NULL);
}

static void
xmpp_xep_in_band_registration_module_real_detach (XmppXmppStreamModule* base,
                                                  XmppXmppStream* stream)
{
	XmppXepInBandRegistrationModule * self;
	self = (XmppXepInBandRegistrationModule*) base;
	g_return_if_fail (stream != NULL);
}

static gchar*
xmpp_xep_in_band_registration_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepInBandRegistrationModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepInBandRegistrationModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_IN_BAND_REGISTRATION_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_in_band_registration_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepInBandRegistrationModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepInBandRegistrationModule*) base;
	_tmp0_ = xmpp_xep_in_band_registration_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepInBandRegistrationModule*
xmpp_xep_in_band_registration_module_construct (GType object_type)
{
	XmppXepInBandRegistrationModule * self = NULL;
	self = (XmppXepInBandRegistrationModule*) xmpp_xmpp_stream_negotiation_module_construct (object_type);
	return self;
}

XmppXepInBandRegistrationModule*
xmpp_xep_in_band_registration_module_new (void)
{
	return xmpp_xep_in_band_registration_module_construct (XMPP_XEP_IN_BAND_REGISTRATION_TYPE_MODULE);
}

static void
xmpp_xep_in_band_registration_module_class_init (XmppXepInBandRegistrationModuleClass * klass,
                                                 gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_in_band_registration_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamNegotiationModuleClass *) klass)->mandatory_outstanding = (gboolean (*) (XmppXmppStreamNegotiationModule*, XmppXmppStream*)) xmpp_xep_in_band_registration_module_real_mandatory_outstanding;
	((XmppXmppStreamNegotiationModuleClass *) klass)->negotiation_active = (gboolean (*) (XmppXmppStreamNegotiationModule*, XmppXmppStream*)) xmpp_xep_in_band_registration_module_real_negotiation_active;
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_in_band_registration_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_in_band_registration_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_in_band_registration_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_in_band_registration_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_in_band_registration_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_IN_BAND_REGISTRATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, "0077_in_band_registration");
	xmpp_xep_in_band_registration_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_in_band_registration_module_instance_init (XmppXepInBandRegistrationModule * self,
                                                    gpointer klass)
{
}

static void
xmpp_xep_in_band_registration_module_finalize (GObject * obj)
{
	XmppXepInBandRegistrationModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_IN_BAND_REGISTRATION_TYPE_MODULE, XmppXepInBandRegistrationModule);
	G_OBJECT_CLASS (xmpp_xep_in_band_registration_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_in_band_registration_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepInBandRegistrationModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_in_band_registration_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepInBandRegistrationModule), 0, (GInstanceInitFunc) xmpp_xep_in_band_registration_module_instance_init, NULL };
	GType xmpp_xep_in_band_registration_module_type_id;
	xmpp_xep_in_band_registration_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_NEGOTIATION_MODULE, "XmppXepInBandRegistrationModule", &g_define_type_info, 0);
	return xmpp_xep_in_band_registration_module_type_id;
}

GType
xmpp_xep_in_band_registration_module_get_type (void)
{
	static volatile gsize xmpp_xep_in_band_registration_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_in_band_registration_module_type_id__once)) {
		GType xmpp_xep_in_band_registration_module_type_id;
		xmpp_xep_in_band_registration_module_type_id = xmpp_xep_in_band_registration_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_in_band_registration_module_type_id__once, xmpp_xep_in_band_registration_module_type_id);
	}
	return xmpp_xep_in_band_registration_module_type_id__once;
}

static gpointer
_xmpp_stanza_entry_ref0 (gpointer self)
{
	return self ? xmpp_stanza_entry_ref (self) : NULL;
}

XmppXepInBandRegistrationForm*
xmpp_xep_in_band_registration_form_construct_from_node (GType object_type,
                                                        XmppXmppStream* stream,
                                                        XmppIqStanza* iq)
{
	XmppXepInBandRegistrationForm* self = NULL;
	XmppStanzaNode* x_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_ = NULL;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	g_return_val_if_fail (stream != NULL, NULL);
	g_return_val_if_fail (iq != NULL, NULL);
	_tmp0_ = ((XmppStanza*) iq)->stanza;
	_tmp1_ = xmpp_stanza_node_get_deep_subnode (_tmp0_, XMPP_XEP_IN_BAND_REGISTRATION_NS_URI ":query", XMPP_XEP_DATA_FORMS_NS_URI ":x", NULL);
	x_node = _tmp1_;
	_tmp3_ = x_node;
	_tmp4_ = _xmpp_stanza_entry_ref0 (_tmp3_);
	_tmp2_ = _tmp4_;
	if (_tmp2_ == NULL) {
		XmppStanzaNode* _tmp5_;
		XmppStanzaNode* _tmp6_;
		XmppStanzaNode* _tmp7_;
		_tmp5_ = xmpp_stanza_node_new_build ("x", XMPP_XEP_IN_BAND_REGISTRATION_NS_URI, NULL, NULL);
		_tmp6_ = _tmp5_;
		_tmp7_ = xmpp_stanza_node_add_self_xmlns (_tmp6_);
		_xmpp_stanza_entry_unref0 (_tmp2_);
		_tmp2_ = _tmp7_;
		_xmpp_stanza_entry_unref0 (_tmp6_);
	}
	self = (XmppXepInBandRegistrationForm*) xmpp_xep_data_forms_data_form_construct_from_node (object_type, _tmp2_);
	_tmp8_ = ((XmppStanza*) iq)->stanza;
	_tmp9_ = xmpp_stanza_node_get_deep_string_content (_tmp8_, XMPP_XEP_IN_BAND_REGISTRATION_NS_URI ":query", "jabber:x:oob:x", "url", NULL);
	_tmp10_ = g_strdup (_tmp9_);
	_g_free0 (self->oob);
	self->oob = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp2_);
	_xmpp_stanza_entry_unref0 (x_node);
	return self;
}

XmppXepInBandRegistrationForm*
xmpp_xep_in_band_registration_form_new_from_node (XmppXmppStream* stream,
                                                  XmppIqStanza* iq)
{
	return xmpp_xep_in_band_registration_form_construct_from_node (XMPP_XEP_IN_BAND_REGISTRATION_TYPE_FORM, stream, iq);
}

XmppXepInBandRegistrationForm*
xmpp_xep_in_band_registration_form_construct (GType object_type)
{
	XmppXepInBandRegistrationForm* self = NULL;
	self = (XmppXepInBandRegistrationForm*) xmpp_xep_data_forms_data_form_construct (object_type);
	return self;
}

XmppXepInBandRegistrationForm*
xmpp_xep_in_band_registration_form_new (void)
{
	return xmpp_xep_in_band_registration_form_construct (XMPP_XEP_IN_BAND_REGISTRATION_TYPE_FORM);
}

static void
xmpp_xep_in_band_registration_form_class_init (XmppXepInBandRegistrationFormClass * klass,
                                               gpointer klass_data)
{
	xmpp_xep_in_band_registration_form_parent_class = g_type_class_peek_parent (klass);
	((XmppXepDataFormsDataFormClass *) klass)->finalize = xmpp_xep_in_band_registration_form_finalize;
}

static void
xmpp_xep_in_band_registration_form_instance_init (XmppXepInBandRegistrationForm * self,
                                                  gpointer klass)
{
	self->oob = NULL;
}

static void
xmpp_xep_in_band_registration_form_finalize (XmppXepDataFormsDataForm * obj)
{
	XmppXepInBandRegistrationForm * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_IN_BAND_REGISTRATION_TYPE_FORM, XmppXepInBandRegistrationForm);
	_g_free0 (self->oob);
	XMPP_XEP_DATA_FORMS_DATA_FORM_CLASS (xmpp_xep_in_band_registration_form_parent_class)->finalize (obj);
}

static GType
xmpp_xep_in_band_registration_form_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepInBandRegistrationFormClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_in_band_registration_form_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepInBandRegistrationForm), 0, (GInstanceInitFunc) xmpp_xep_in_band_registration_form_instance_init, NULL };
	GType xmpp_xep_in_band_registration_form_type_id;
	xmpp_xep_in_band_registration_form_type_id = g_type_register_static (XMPP_XEP_DATA_FORMS_TYPE_DATA_FORM, "XmppXepInBandRegistrationForm", &g_define_type_info, 0);
	return xmpp_xep_in_band_registration_form_type_id;
}

GType
xmpp_xep_in_band_registration_form_get_type (void)
{
	static volatile gsize xmpp_xep_in_band_registration_form_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_in_band_registration_form_type_id__once)) {
		GType xmpp_xep_in_band_registration_form_type_id;
		xmpp_xep_in_band_registration_form_type_id = xmpp_xep_in_band_registration_form_get_type_once ();
		g_once_init_leave (&xmpp_xep_in_band_registration_form_type_id__once, xmpp_xep_in_band_registration_form_type_id);
	}
	return xmpp_xep_in_band_registration_form_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

