/* standard-archive-workflow.c generated by valac 0.56.19, the Vala compiler
 * generated from standard-archive-workflow.vala, do not modify */

#include "protonplus_core.h"
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.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

#define PROTON_PLUS_SERVICES_TYPE_ARCHIVE_WORKFLOW_SUPPORT (proton_plus_services_archive_workflow_support_get_type ())
#define PROTON_PLUS_SERVICES_ARCHIVE_WORKFLOW_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_WORKFLOW_SUPPORT, ProtonPlusServicesArchiveWorkflowSupport))
#define PROTON_PLUS_SERVICES_ARCHIVE_WORKFLOW_SUPPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_WORKFLOW_SUPPORT, ProtonPlusServicesArchiveWorkflowSupportClass))
#define PROTON_PLUS_SERVICES_IS_ARCHIVE_WORKFLOW_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_WORKFLOW_SUPPORT))
#define PROTON_PLUS_SERVICES_IS_ARCHIVE_WORKFLOW_SUPPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_WORKFLOW_SUPPORT))
#define PROTON_PLUS_SERVICES_ARCHIVE_WORKFLOW_SUPPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_WORKFLOW_SUPPORT, ProtonPlusServicesArchiveWorkflowSupportClass))

typedef struct _ProtonPlusServicesArchiveWorkflowSupport ProtonPlusServicesArchiveWorkflowSupport;
typedef struct _ProtonPlusServicesArchiveWorkflowSupportClass ProtonPlusServicesArchiveWorkflowSupportClass;
enum  {
	PROTON_PLUS_SERVICES_STANDARD_ARCHIVE_WORKFLOW_0_PROPERTY,
	PROTON_PLUS_SERVICES_STANDARD_ARCHIVE_WORKFLOW_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_standard_archive_workflow_properties[PROTON_PLUS_SERVICES_STANDARD_ARCHIVE_WORKFLOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION (proton_plus_services_archive_operation_get_type ())
#define PROTON_PLUS_SERVICES_ARCHIVE_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION, ProtonPlusServicesArchiveOperation))
#define PROTON_PLUS_SERVICES_ARCHIVE_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION, ProtonPlusServicesArchiveOperationClass))
#define PROTON_PLUS_SERVICES_IS_ARCHIVE_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION))
#define PROTON_PLUS_SERVICES_IS_ARCHIVE_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION))
#define PROTON_PLUS_SERVICES_ARCHIVE_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION, ProtonPlusServicesArchiveOperationClass))

typedef struct _ProtonPlusServicesArchiveOperation ProtonPlusServicesArchiveOperation;
typedef struct _ProtonPlusServicesArchiveOperationClass ProtonPlusServicesArchiveOperationClass;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowInstallData ProtonPlusServicesStandardArchiveWorkflowInstallData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowUpdateData ProtonPlusServicesStandardArchiveWorkflowUpdateData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowRemoveData ProtonPlusServicesStandardArchiveWorkflowRemoveData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData;
typedef struct _ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData;

struct _ProtonPlusServicesStandardArchiveWorkflowPrivate {
	ProtonPlusServicesArchiveWorkflowSupport* archive_support;
};

struct _ProtonPlusServicesStandardArchiveWorkflowInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusServicesInstallJob* job;
	gboolean replace_existing;
	ProtonPlusReturnCode result;
	ProtonPlusServicesArchiveOperation* operation;
	ProtonPlusReturnCode prepare_code;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp0_;
	ProtonPlusServicesArchiveOperation* _tmp1_;
	ProtonPlusReturnCode _tmp2_;
	gboolean _tmp3_;
	ProtonPlusServicesArchiveOperation* _tmp4_;
	ProtonPlusServicesArchiveOperation* archive;
	ProtonPlusServicesArchiveOperation* _tmp5_;
	ProtonPlusServicesArchiveOperation* _tmp6_;
	gchar* source_path;
	ProtonPlusServicesArchiveOperation* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	ProtonPlusServicesArchiveOperation* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	GCancellable* _tmp13_;
	GCancellable* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gboolean _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gboolean _tmp20_;
	gboolean _tmp21_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp22_;
	ProtonPlusServicesArchiveOperation* _tmp23_;
	gboolean _tmp24_;
	gboolean _tmp25_;
	const gchar* _tmp26_;
	ProtonPlusServicesArchiveOperation* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gboolean _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gboolean _tmp34_;
	gboolean _tmp35_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp36_;
	ProtonPlusServicesArchiveOperation* _tmp37_;
	gboolean _tmp38_;
	gboolean _tmp39_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp40_;
	ProtonPlusServicesArchiveOperation* _tmp41_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp42_;
	ProtonPlusServicesArchiveOperation* _tmp43_;
	gchar* install_parent;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	const gchar* _tmp47_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp48_;
	ProtonPlusServicesArchiveOperation* _tmp49_;
	ProtonPlusServicesArchiveOperation* _tmp50_;
	const gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	ProtonPlusServicesArchiveOperation* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp57_;
	ProtonPlusServicesArchiveOperation* _tmp58_;
	gchar* staged_install_path;
	ProtonPlusServicesArchiveOperation* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	gchar* _tmp62_;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp65_;
	ProtonPlusServicesArchiveOperation* _tmp66_;
	ProtonPlusServicesInstallJobMode _tmp67_;
	ProtonPlusServicesInstallJobMode _tmp68_;
	ProtonPlusReturnCode manifest_code;
	const gchar* _tmp69_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp70_;
	ProtonPlusServicesArchiveOperation* _tmp71_;
	const gchar* _tmp72_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp73_;
	ProtonPlusServicesArchiveOperation* _tmp74_;
	gboolean _tmp75_;
	const gchar* _tmp76_;
	const gchar* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	gboolean destination_exists;
	gboolean _tmp80_;
	ProtonPlusServicesCompatibilityProcessOperationKind _tmp81_;
	ProtonPlusServicesInstallJobState _tmp82_;
	ProtonPlusServicesInstallJobState _tmp83_;
	ProtonPlusServicesCompatibilityProcessOperationKind operation_kind;
	ProtonPlusReturnCode guard_code;
	ProtonPlusServicesInstallationService* _tmp84_;
	ProtonPlusServicesInstallationService* _tmp85_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp86_;
	ProtonPlusServicesArchiveOperation* _tmp87_;
	const gchar* _tmp88_;
	const gchar* _tmp89_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp90_;
	ProtonPlusServicesArchiveOperation* _tmp91_;
	gchar* backup_path;
	const gchar* _tmp92_;
	ProtonPlusServicesArchiveOperation* _tmp93_;
	const gchar* _tmp94_;
	const gchar* _tmp95_;
	gchar* _tmp96_;
	gchar* _tmp97_;
	gchar* _tmp98_;
	gchar* _tmp99_;
	gchar* _tmp100_;
	gchar* _tmp101_;
	const gchar* _tmp102_;
	const gchar* _tmp103_;
	const gchar* _tmp104_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp105_;
	ProtonPlusServicesArchiveOperation* _tmp106_;
	const gchar* _tmp107_;
	const gchar* _tmp108_;
	const gchar* _tmp109_;
	const gchar* _tmp110_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp111_;
	ProtonPlusServicesArchiveOperation* _tmp112_;
	const gchar* _tmp113_;
	const gchar* _tmp114_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp115_;
	ProtonPlusServicesArchiveOperation* _tmp116_;
	ProtonPlusServicesArchiveWorkflowSupport* _tmp117_;
	ProtonPlusServicesArchiveOperation* _tmp118_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusServicesInstallationOperationCoordinator* coordinator;
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallJobMode _tmp0_;
	ProtonPlusServicesInstallJobMode _tmp1_;
	ProtonPlusModelsToolsProviderTool* runner;
	ProtonPlusModelsTool* _tmp2_;
	ProtonPlusModelsTool* _tmp3_;
	ProtonPlusModelsToolsProviderTool* _tmp4_;
	gboolean _tmp5_;
	ProtonPlusModelsToolsProviderTool* _tmp6_;
	ProtonPlusModelsToolsProviderTool* _tmp7_;
	ProtonPlusModelsReleaseCatalog* _tmp8_;
	ProtonPlusModelsReleaseCatalog* _tmp9_;
	ProtonPlusModelsReleaseLookupResult* lookup;
	ProtonPlusModelsToolsProviderTool* _tmp10_;
	ProtonPlusModelsReleaseCatalog* _tmp11_;
	ProtonPlusModelsReleaseCatalog* _tmp12_;
	ProtonPlusModelsReleaseLookupResult* _tmp13_;
	ProtonPlusModelsReleaseLookupResult* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	ProtonPlusModelsReleaseLookupResult* _tmp17_;
	ProtonPlusReturnCode _tmp18_;
	ProtonPlusReturnCode _tmp19_;
	ProtonPlusModelsReleaseLookupResult* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	ProtonPlusModelsReleaseLookupResult* _tmp23_;
	ProtonPlusModelsRelease* _tmp24_;
	ProtonPlusModelsRelease* _tmp25_;
	gboolean missing_explicit_selection;
	ProtonPlusReturnCode compatibility;
	ProtonPlusServicesInstallationService* _tmp26_;
	ProtonPlusServicesInstallationService* _tmp27_;
	gboolean _tmp28_;
	ProtonPlusReturnCode _tmp29_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowRemoveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusReturnCode result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ProtonPlusReturnCode guard_code;
	ProtonPlusServicesInstallationService* _tmp2_;
	ProtonPlusServicesInstallationService* _tmp3_;
	ProtonPlusReturnCode _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusModelsToolsProviderTool* runner;
	ProtonPlusServicesInstallationOperationCoordinator* coordinator;
	gchar* installation_location;
	ProtonPlusReturnCode result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	ProtonPlusModelsGroup* _tmp2_;
	ProtonPlusModelsGroup* _tmp3_;
	ProtonPlusModelsLauncher* _tmp4_;
	ProtonPlusModelsLauncher* _tmp5_;
	ProtonPlusModelsGroup* _tmp6_;
	ProtonPlusModelsGroup* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* directory;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	ProtonPlusUtilsMetadata* metadata;
	const gchar* _tmp17_;
	ProtonPlusUtilsMetadata* _tmp18_;
	ProtonPlusModelsReleaseCatalog* _tmp19_;
	ProtonPlusModelsReleaseCatalog* _tmp20_;
	ProtonPlusModelsReleaseLookupResult* lookup;
	ProtonPlusModelsReleaseCatalog* _tmp21_;
	ProtonPlusModelsReleaseCatalog* _tmp22_;
	ProtonPlusModelsReleaseLookupResult* _tmp23_;
	ProtonPlusModelsReleaseLookupResult* _tmp24_;
	gboolean _tmp25_;
	gboolean _tmp26_;
	ProtonPlusModelsReleaseLookupResult* _tmp27_;
	ProtonPlusReturnCode _tmp28_;
	ProtonPlusReturnCode _tmp29_;
	ProtonPlusModelsReleaseLookupResult* _tmp30_;
	gboolean _tmp31_;
	gboolean _tmp32_;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusModelsReleaseLookupResult* _tmp33_;
	ProtonPlusModelsRelease* _tmp34_;
	ProtonPlusModelsRelease* _tmp35_;
	const gchar* _tmp36_;
	ProtonPlusServicesInstallJob* _tmp37_;
	ProtonPlusServicesInstallJob* _tmp38_;
	ProtonPlusReturnCode restored_variant;
	ProtonPlusServicesInstallJob* _tmp39_;
	ProtonPlusUtilsMetadata* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	gboolean missing_explicit_selection;
	ProtonPlusReturnCode compatibility;
	ProtonPlusServicesInstallationService* _tmp43_;
	ProtonPlusServicesInstallationService* _tmp44_;
	ProtonPlusServicesInstallJob* _tmp45_;
	gboolean _tmp46_;
	ProtonPlusReturnCode _tmp47_;
	ProtonPlusServicesInstallJob* _tmp48_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusModelsToolsProviderTool* runner;
	ProtonPlusReturnCode result;
	gchar* directory;
	ProtonPlusModelsGroup* _tmp0_;
	ProtonPlusModelsGroup* _tmp1_;
	ProtonPlusModelsLauncher* _tmp2_;
	ProtonPlusModelsLauncher* _tmp3_;
	ProtonPlusModelsGroup* _tmp4_;
	ProtonPlusModelsGroup* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* backup;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	ProtonPlusReturnCode _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	gchar* directory;
	gchar* backup;
	gboolean migrate_prefix;
	ProtonPlusReturnCode result;
	gchar* backup_settings;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* settings;
	gchar* _tmp2_;
	gboolean copied;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* backup_prefix;
	gchar* _tmp8_;
	gboolean _tmp9_;
	const gchar* _tmp10_;
	gchar* prefix;
	gchar* _tmp11_;
	gboolean _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	ProtonPlusReturnCode _tmp17_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusServicesInstallationOperationCoordinator* coordinator;
	ProtonPlusReturnCode result;
	ProtonPlusModelsToolsProviderTool* runner;
	ProtonPlusModelsTool* _tmp0_;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsToolsProviderTool* _tmp2_;
	gboolean _tmp3_;
	ProtonPlusModelsToolsProviderTool* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	ProtonPlusUtilsMetadata* metadata;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	ProtonPlusUtilsMetadata* _tmp9_;
	ProtonPlusModelsRelease* release;
	ProtonPlusModelsRelease* _tmp10_;
	ProtonPlusModelsRelease* _tmp11_;
	ProtonPlusModelsRelease* _tmp12_;
	gboolean _tmp13_;
	ProtonPlusModelsRelease* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	ProtonPlusUtilsMetadata* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	ProtonPlusModelsRelease* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar* version_path;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* proton_path;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* version_content;
	gchar* _tmp34_;
	gchar* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* proton_content;
	gchar* _tmp40_;
	gboolean _tmp41_;
	gboolean _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	ProtonPlusModelsRelease* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	ProtonPlusModelsRelease* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	ProtonPlusModelsRelease* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	ProtonPlusModelsRelease* _tmp55_;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	ProtonPlusUtilsMetadata* _tmp58_;
	ProtonPlusModelsToolsProviderTool* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	ProtonPlusModelsRelease* _tmp62_;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	ProtonPlusModelsAssetsAsset* _tmp65_;
	ProtonPlusModelsAssetsAsset* _tmp66_;
	ProtonPlusReturnCode install_code;
	gchar* backup;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	gchar* _tmp69_;
	gboolean _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	gboolean _tmp73_;
	GSettings* _tmp74_;
	GSettings* _tmp75_;
	gboolean migrate_prefix;
	ProtonPlusReturnCode code;
	const gchar* _tmp76_;
	const gchar* _tmp77_;
	const gchar* _tmp78_;
	ProtonPlusServicesInstallationLifecycleRecorder* lifecycle;
	ProtonPlusServicesInstallationLifecycleRecorder* _tmp79_;
	ProtonPlusServicesInstallationLifecycleRecorder* _tmp80_;
	ProtonPlusServicesInstallationLifecycleRecorder* _tmp81_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	ProtonPlusServicesInstallJob* job;
	gchar* source_path;
	gchar* extract_path;
	gchar* result;
	gchar* extension;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* archive_name;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GCancellable* _tmp14_;
	GCancellable* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
};

struct _ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesStandardArchiveWorkflow* self;
	gchar* directory;
	gchar* backup;
	gboolean result;
	gchar* failed;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
};

static gint ProtonPlusServicesStandardArchiveWorkflow_private_offset;
static gpointer proton_plus_services_standard_archive_workflow_parent_class = NULL;

VALA_EXTERN GType proton_plus_services_archive_workflow_support_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ProtonPlusServicesArchiveWorkflowSupport* proton_plus_services_archive_workflow_support_new (void);
VALA_EXTERN ProtonPlusServicesArchiveWorkflowSupport* proton_plus_services_archive_workflow_support_construct (GType object_type);
static ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_real_validate_install (ProtonPlusServicesInstallationWorkflow* base,
                                                                                           ProtonPlusServicesInstallJob* job,
                                                                                           gboolean replace_existing);
VALA_EXTERN void proton_plus_services_install_job_set_error_message (ProtonPlusServicesInstallJob* self,
                                                         const gchar* value);
static void proton_plus_services_standard_archive_workflow_real_install_data_free (gpointer _data);
static void proton_plus_services_standard_archive_workflow_real_install (ProtonPlusServicesInstallationWorkflow* base,
                                                                  ProtonPlusServicesInstallJob* job,
                                                                  gboolean replace_existing,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_);
static gboolean proton_plus_services_standard_archive_workflow_real_install_co (ProtonPlusServicesStandardArchiveWorkflowInstallData* _data_);
VALA_EXTERN GType proton_plus_services_archive_operation_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void proton_plus_services_archive_workflow_support_prepare_archive (ProtonPlusServicesArchiveWorkflowSupport* self,
                                                                    ProtonPlusServicesInstallJob* job,
                                                                    const gchar* operation_prefix,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_archive_workflow_support_prepare_archive_finish (ProtonPlusServicesArchiveWorkflowSupport* self,
                                                                                           GAsyncResult* _res_,
                                                                                           ProtonPlusServicesArchiveOperation** operation);
static void proton_plus_services_standard_archive_workflow_install_ready (GObject* source_object,
                                                                   GAsyncResult* _res_,
                                                                   gpointer _user_data_);
VALA_EXTERN void proton_plus_services_install_job_set_step (ProtonPlusServicesInstallJob* self,
                                                ProtonPlusServicesInstallJobStep value);
VALA_EXTERN const gchar* proton_plus_services_archive_operation_get_operation_path (ProtonPlusServicesArchiveOperation* self);
VALA_EXTERN const gchar* proton_plus_services_archive_operation_get_extension (ProtonPlusServicesArchiveOperation* self);
VALA_EXTERN GCancellable* proton_plus_services_install_job_get_cancellable (ProtonPlusServicesInstallJob* self);
VALA_EXTERN void proton_plus_services_archive_workflow_support_complete_attempt (ProtonPlusServicesArchiveWorkflowSupport* self,
                                                                     ProtonPlusReturnCode code,
                                                                     ProtonPlusServicesArchiveOperation* operation,
                                                                     gboolean discard_cached_archive,
                                                                     GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_archive_workflow_support_complete_attempt_finish (ProtonPlusServicesArchiveWorkflowSupport* self,
                                                                                            GAsyncResult* _res_);
static gboolean proton_plus_services_standard_archive_workflow_requires_nested_archive (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                 ProtonPlusServicesInstallJob* job);
static void proton_plus_services_standard_archive_workflow_extract_nested_archive (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                            ProtonPlusServicesInstallJob* job,
                                                                            const gchar* source_path,
                                                                            const gchar* extract_path,
                                                                            GAsyncReadyCallback _callback_,
                                                                            gpointer _user_data_);
static gchar* proton_plus_services_standard_archive_workflow_extract_nested_archive_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                     GAsyncResult* _res_);
VALA_EXTERN void proton_plus_services_archive_workflow_support_publish_archive (ProtonPlusServicesArchiveWorkflowSupport* self,
                                                                    ProtonPlusServicesArchiveOperation* operation,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_services_archive_workflow_support_publish_archive_finish (ProtonPlusServicesArchiveWorkflowSupport* self,
                                                                               GAsyncResult* _res_);
VALA_EXTERN void proton_plus_services_archive_operation_set_staging_root (ProtonPlusServicesArchiveOperation* self,
                                                              const gchar* value);
VALA_EXTERN const gchar* proton_plus_services_archive_operation_get_staging_root (ProtonPlusServicesArchiveOperation* self);
static ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_rewrite_compatibility_tool_vdf (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                                    ProtonPlusServicesInstallJob* job,
                                                                                                    const gchar* staged_install_path);
static gboolean proton_plus_services_standard_archive_workflow_persist_runner_install_metadata (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                         ProtonPlusServicesInstallJob* job,
                                                                                         const gchar* path);
VALA_EXTERN void proton_plus_services_installation_service_check_final_process_state (ProtonPlusServicesInstallationService* self,
                                                                          ProtonPlusServicesInstallJob* job,
                                                                          ProtonPlusServicesCompatibilityProcessOperationKind operation_kind,
                                                                          gboolean mutates_existing_destination,
                                                                          GAsyncReadyCallback _callback_,
                                                                          gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_installation_service_check_final_process_state_finish (ProtonPlusServicesInstallationService* self,
                                                                                                 GAsyncResult* _res_);
VALA_EXTERN void proton_plus_services_install_job_set_replacement_backup_path (ProtonPlusServicesInstallJob* self,
                                                                   const gchar* value);
static void proton_plus_services_standard_archive_workflow_real_update_data_free (gpointer _data);
static void proton_plus_services_standard_archive_workflow_real_update (ProtonPlusServicesInstallationWorkflow* base,
                                                                 ProtonPlusServicesInstallJob* job,
                                                                 ProtonPlusServicesInstallationOperationCoordinator* coordinator,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_);
static gboolean proton_plus_services_standard_archive_workflow_real_update_co (ProtonPlusServicesStandardArchiveWorkflowUpdateData* _data_);
static void proton_plus_services_standard_archive_workflow_update_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_installation_service_resolve_provider_install_variant (ProtonPlusServicesInstallationService* self,
                                                                                                 ProtonPlusServicesInstallJob* job,
                                                                                                 gboolean* missing_explicit_selection);
static void proton_plus_services_standard_archive_workflow_update_latest_job (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                       ProtonPlusServicesInstallJob* job,
                                                                       ProtonPlusServicesInstallationOperationCoordinator* coordinator,
                                                                       GAsyncReadyCallback _callback_,
                                                                       gpointer _user_data_);
static ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_update_latest_job_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                              GAsyncResult* _res_);
static void proton_plus_services_standard_archive_workflow_real_remove_data_free (gpointer _data);
static void proton_plus_services_standard_archive_workflow_real_remove (ProtonPlusServicesInstallationWorkflow* base,
                                                                 ProtonPlusServicesInstallJob* job,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_);
static gboolean proton_plus_services_standard_archive_workflow_real_remove_co (ProtonPlusServicesStandardArchiveWorkflowRemoveData* _data_);
static void proton_plus_services_standard_archive_workflow_remove_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
static void proton_plus_services_standard_archive_workflow_real_refresh_state (ProtonPlusServicesInstallationWorkflow* base,
                                                                        ProtonPlusServicesInstallJob* job);
VALA_EXTERN gchar* proton_plus_services_install_job_effective_directory_name_for_state (ProtonPlusServicesInstallJob* self);
VALA_EXTERN void proton_plus_services_install_job_set_state (ProtonPlusServicesInstallJob* self,
                                                 ProtonPlusServicesInstallJobState value);
static void proton_plus_services_standard_archive_workflow_real_finalize_install_success (ProtonPlusServicesInstallationWorkflow* base,
                                                                                   ProtonPlusServicesInstallJob* job);
static void proton_plus_services_standard_archive_workflow_real_finalize_removal_success (ProtonPlusServicesInstallationWorkflow* base,
                                                                                   ProtonPlusServicesInstallJob* job);
static void proton_plus_services_standard_archive_workflow_update_specific_runner_data_free (gpointer _data);
static gboolean proton_plus_services_standard_archive_workflow_update_specific_runner_co (ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData* _data_);
static void proton_plus_services_standard_archive_workflow_update_specific_runner_ready (GObject* source_object,
                                                                                  GAsyncResult* _res_,
                                                                                  gpointer _user_data_);
static ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_restore_installed_variant (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                               ProtonPlusServicesInstallJob* job,
                                                                                               const gchar* variant_id);
static void proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_data_free (gpointer _data);
VALA_EXTERN void proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                  ProtonPlusModelsToolsProviderTool* runner,
                                                                                  GAsyncReadyCallback _callback_,
                                                                                  gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                                         GAsyncResult* _res_);
static gboolean proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_co (ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData* _data_);
static void proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_ready (GObject* source_object,
                                                                                        GAsyncResult* _res_,
                                                                                        gpointer _user_data_);
static void proton_plus_services_standard_archive_workflow_finalize_replaced_runner_data_free (gpointer _data);
static gboolean proton_plus_services_standard_archive_workflow_finalize_replaced_runner_co (ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData* _data_);
static void proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready (GObject* source_object,
                                                                                    GAsyncResult* _res_,
                                                                                    gpointer _user_data_);
static void proton_plus_services_standard_archive_workflow_rollback_replaced_runner (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                              const gchar* directory,
                                                                              const gchar* backup,
                                                                              GAsyncReadyCallback _callback_,
                                                                              gpointer _user_data_);
static gboolean proton_plus_services_standard_archive_workflow_rollback_replaced_runner_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                         GAsyncResult* _res_);
static void proton_plus_services_standard_archive_workflow_update_latest_job_data_free (gpointer _data);
static gboolean proton_plus_services_standard_archive_workflow_update_latest_job_co (ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData* _data_);
static gboolean proton_plus_services_standard_archive_workflow_release_matches_installed_version (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                           ProtonPlusModelsRelease* release,
                                                                                           const gchar* version_content,
                                                                                           const gchar* proton_content);
static gboolean proton_plus_services_standard_archive_workflow_persist_runner_identity (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                 ProtonPlusUtilsMetadata* metadata,
                                                                                 ProtonPlusModelsToolsProviderTool* runner,
                                                                                 const gchar* directory,
                                                                                 const gchar* tag,
                                                                                 const gchar* release_id);
static void proton_plus_services_standard_archive_workflow_update_latest_job_ready (GObject* source_object,
                                                                             GAsyncResult* _res_,
                                                                             gpointer _user_data_);
VALA_EXTERN void proton_plus_services_install_job_finish_operation (ProtonPlusServicesInstallJob* self);
VALA_EXTERN const gchar* proton_plus_services_install_job_get_replacement_backup_path (ProtonPlusServicesInstallJob* self);
static void proton_plus_services_standard_archive_workflow_extract_nested_archive_data_free (gpointer _data);
static gboolean proton_plus_services_standard_archive_workflow_extract_nested_archive_co (ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData* _data_);
static void proton_plus_services_standard_archive_workflow_extract_nested_archive_ready (GObject* source_object,
                                                                                  GAsyncResult* _res_,
                                                                                  gpointer _user_data_);
static ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_manifest_failure (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                      ProtonPlusServicesInstallJob* job,
                                                                                      const gchar* path,
                                                                                      const gchar* reason);
static ProtonPlusUtilsVDFVdfEntry* proton_plus_services_standard_archive_workflow_find_compat_tools (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                              ProtonPlusUtilsVDFVdfDocument* document);
VALA_EXTERN gchar* proton_plus_services_install_job_selected_variant_identity (ProtonPlusServicesInstallJob* self);
static void proton_plus_services_standard_archive_workflow_rollback_replaced_runner_data_free (gpointer _data);
static gboolean proton_plus_services_standard_archive_workflow_rollback_replaced_runner_co (ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData* _data_);
static void proton_plus_services_standard_archive_workflow_rollback_replaced_runner_ready (GObject* source_object,
                                                                                    GAsyncResult* _res_,
                                                                                    gpointer _user_data_);
static void proton_plus_services_standard_archive_workflow_finalize (GObject * obj);
static GType proton_plus_services_standard_archive_workflow_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);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_services_standard_archive_workflow_get_instance_private (ProtonPlusServicesStandardArchiveWorkflow* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusServicesStandardArchiveWorkflow_private_offset);
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_real_validate_install (ProtonPlusServicesInstallationWorkflow* base,
                                                                      ProtonPlusServicesInstallJob* job,
                                                                      gboolean replace_existing)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	gchar* install_parent = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* target_error = NULL;
	ProtonPlusModelsTool* _tmp3_;
	ProtonPlusModelsTool* _tmp4_;
	ProtonPlusModelsGroup* _tmp5_;
	ProtonPlusModelsGroup* _tmp6_;
	ProtonPlusModelsLauncher* _tmp7_;
	ProtonPlusModelsLauncher* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gboolean _tmp13_ = FALSE;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	ProtonPlusReturnCode result;
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	g_return_val_if_fail (job != NULL, 0);
	_tmp0_ = proton_plus_services_install_job_get_install_location (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_path_get_dirname (_tmp1_);
	install_parent = _tmp2_;
	_tmp3_ = proton_plus_services_install_job_get_tool (job);
	_tmp4_ = _tmp3_;
	_tmp5_ = proton_plus_models_tool_get_group (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = proton_plus_models_group_get_launcher (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = install_parent;
	_tmp10_ = proton_plus_models_launcher_get_install_target_error (_tmp8_, _tmp9_);
	target_error = _tmp10_;
	_tmp11_ = target_error;
	if (_tmp11_ != NULL) {
		const gchar* _tmp12_;
		_tmp12_ = target_error;
		proton_plus_services_install_job_set_error_message (job, (const gchar*) _tmp12_);
		result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
		_g_free0 (target_error);
		_g_free0 (install_parent);
		return result;
	}
	_tmp14_ = proton_plus_services_install_job_get_install_location (job);
	_tmp15_ = _tmp14_;
	if (g_file_test (_tmp15_, G_FILE_TEST_EXISTS)) {
		_tmp13_ = !replace_existing;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		result = PROTON_PLUS_RETURN_CODE_RUNNER_ALREADY_INSTALLED;
		_g_free0 (target_error);
		_g_free0 (install_parent);
		return result;
	}
	result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
	_g_free0 (target_error);
	_g_free0 (install_parent);
	return result;
}

static void
proton_plus_services_standard_archive_workflow_real_install_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowInstallData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowInstallData, _data_);
}

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

static void
proton_plus_services_standard_archive_workflow_real_install (ProtonPlusServicesInstallationWorkflow* base,
                                                             ProtonPlusServicesInstallJob* job,
                                                             gboolean replace_existing,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	ProtonPlusServicesStandardArchiveWorkflowInstallData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (job != NULL);
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowInstallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_real_install_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_data_->replace_existing = replace_existing;
	proton_plus_services_standard_archive_workflow_real_install_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_install_finish (ProtonPlusServicesInstallationWorkflow* base,
                                                               GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_install_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_real_install_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_real_install_co (ProtonPlusServicesStandardArchiveWorkflowInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		case 7:
		goto _state_7;
		case 8:
		goto _state_8;
		case 9:
		goto _state_9;
		case 10:
		goto _state_10;
		case 11:
		goto _state_11;
		case 12:
		goto _state_12;
		case 13:
		goto _state_13;
		case 14:
		goto _state_14;
		case 15:
		goto _state_15;
		case 16:
		goto _state_16;
		case 17:
		goto _state_17;
		case 18:
		goto _state_18;
		case 19:
		goto _state_19;
		case 20:
		goto _state_20;
		case 21:
		goto _state_21;
		case 22:
		goto _state_22;
		case 23:
		goto _state_23;
		case 24:
		goto _state_24;
		case 25:
		goto _state_25;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->archive_support;
	_data_->_tmp1_ = NULL;
	_data_->_state_ = 1;
	proton_plus_services_archive_workflow_support_prepare_archive (_data_->_tmp0_, _data_->job, ".protonplus-install-", proton_plus_services_standard_archive_workflow_install_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = proton_plus_services_archive_workflow_support_prepare_archive_finish (_data_->_tmp0_, _data_->_res_, &_data_->_tmp1_);
	_g_object_unref0 (_data_->operation);
	_data_->operation = _data_->_tmp1_;
	_data_->prepare_code = _data_->_tmp2_;
	if (_data_->prepare_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->_tmp3_ = TRUE;
	} else {
		_data_->_tmp4_ = _data_->operation;
		_data_->_tmp3_ = _data_->_tmp4_ == NULL;
	}
	if (_data_->_tmp3_) {
		_data_->result = _data_->prepare_code;
		_g_object_unref0 (_data_->operation);
		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_->_tmp5_ = _data_->operation;
	_data_->_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, PROTON_PLUS_SERVICES_TYPE_ARCHIVE_OPERATION, ProtonPlusServicesArchiveOperation));
	_data_->archive = _data_->_tmp6_;
	proton_plus_services_install_job_set_step (_data_->job, PROTON_PLUS_SERVICES_INSTALL_JOB_STEP_EXTRACTING);
	_data_->_tmp7_ = _data_->archive;
	_data_->_tmp8_ = proton_plus_services_archive_operation_get_operation_path (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->archive;
	_data_->_tmp11_ = proton_plus_services_archive_operation_get_extension (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = proton_plus_services_install_job_get_cancellable (_data_->job);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_state_ = 2;
	proton_plus_utils_filesystem_extract (_data_->_tmp9_, "archive", _data_->_tmp12_, _data_->_tmp14_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp15_ = proton_plus_utils_filesystem_extract_finish (_data_->_res_);
	_data_->_tmp16_ = _data_->_tmp15_;
	_g_object_unref0 (_data_->_tmp14_);
	_data_->source_path = _data_->_tmp16_;
	_data_->_tmp18_ = _data_->source_path;
	if (_data_->_tmp18_ == NULL) {
		_data_->_tmp17_ = TRUE;
	} else {
		_data_->_tmp19_ = _data_->source_path;
		_data_->_tmp17_ = g_strcmp0 (_data_->_tmp19_, "") == 0;
	}
	if (_data_->_tmp17_) {
		_data_->_tmp20_ = proton_plus_services_install_job_get_canceled (_data_->job);
		_data_->_tmp21_ = _data_->_tmp20_;
		if (!_data_->_tmp21_) {
			proton_plus_services_install_job_set_error_message (_data_->job, _ ("Extraction failed"));
		}
		_data_->_tmp22_ = _data_->self->priv->archive_support;
		_data_->_tmp23_ = _data_->archive;
		_data_->_tmp24_ = proton_plus_services_install_job_get_canceled (_data_->job);
		_data_->_tmp25_ = _data_->_tmp24_;
		_data_->_state_ = 3;
		proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp22_, PROTON_PLUS_RETURN_CODE_EXTRACTION_FAILED, _data_->_tmp23_, !_data_->_tmp25_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_3:
		_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp22_, _data_->_res_);
		_g_free0 (_data_->source_path);
		_g_object_unref0 (_data_->archive);
		_g_object_unref0 (_data_->operation);
		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;
	}
	if (proton_plus_services_standard_archive_workflow_requires_nested_archive (_data_->self, _data_->job)) {
		_data_->_tmp26_ = _data_->source_path;
		_data_->_tmp27_ = _data_->archive;
		_data_->_tmp28_ = proton_plus_services_archive_operation_get_operation_path (_data_->_tmp27_);
		_data_->_tmp29_ = _data_->_tmp28_;
		_data_->_state_ = 4;
		proton_plus_services_standard_archive_workflow_extract_nested_archive (_data_->self, _data_->job, _data_->_tmp26_, _data_->_tmp29_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp30_ = proton_plus_services_standard_archive_workflow_extract_nested_archive_finish (_data_->self, _data_->_res_);
		_g_free0 (_data_->source_path);
		_data_->source_path = _data_->_tmp30_;
		_data_->_tmp32_ = _data_->source_path;
		if (_data_->_tmp32_ == NULL) {
			_data_->_tmp31_ = TRUE;
		} else {
			_data_->_tmp33_ = _data_->source_path;
			_data_->_tmp31_ = g_strcmp0 (_data_->_tmp33_, "") == 0;
		}
		if (_data_->_tmp31_) {
			_data_->_tmp34_ = proton_plus_services_install_job_get_canceled (_data_->job);
			_data_->_tmp35_ = _data_->_tmp34_;
			if (!_data_->_tmp35_) {
				proton_plus_services_install_job_set_error_message (_data_->job, _ ("Extraction failed"));
			}
			_data_->_tmp36_ = _data_->self->priv->archive_support;
			_data_->_tmp37_ = _data_->archive;
			_data_->_tmp38_ = proton_plus_services_install_job_get_canceled (_data_->job);
			_data_->_tmp39_ = _data_->_tmp38_;
			_data_->_state_ = 5;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp36_, PROTON_PLUS_RETURN_CODE_EXTRACTION_FAILED, _data_->_tmp37_, !_data_->_tmp39_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_5:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp36_, _data_->_res_);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp40_ = _data_->self->priv->archive_support;
	_data_->_tmp41_ = _data_->archive;
	_data_->_state_ = 6;
	proton_plus_services_archive_workflow_support_publish_archive (_data_->_tmp40_, _data_->_tmp41_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
	return FALSE;
	_state_6:
	if (!proton_plus_services_archive_workflow_support_publish_archive_finish (_data_->_tmp40_, _data_->_res_)) {
		_data_->_tmp42_ = _data_->self->priv->archive_support;
		_data_->_tmp43_ = _data_->archive;
		_data_->_state_ = 7;
		proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp42_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp43_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_7:
		_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp42_, _data_->_res_);
		_g_free0 (_data_->source_path);
		_g_object_unref0 (_data_->archive);
		_g_object_unref0 (_data_->operation);
		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;
	}
	proton_plus_services_install_job_set_step (_data_->job, PROTON_PLUS_SERVICES_INSTALL_JOB_STEP_MOVING);
	_data_->_tmp44_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp45_ = _data_->_tmp44_;
	_data_->_tmp46_ = g_path_get_dirname (_data_->_tmp45_);
	_data_->install_parent = _data_->_tmp46_;
	_data_->_tmp47_ = _data_->install_parent;
	_data_->_state_ = 8;
	proton_plus_utils_filesystem_create_directory_async (_data_->_tmp47_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
	return FALSE;
	_state_8:
	if (!proton_plus_utils_filesystem_create_directory_finish (_data_->_res_)) {
		_data_->_tmp48_ = _data_->self->priv->archive_support;
		_data_->_tmp49_ = _data_->archive;
		_data_->_state_ = 9;
		proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp48_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp49_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_9:
		_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp48_, _data_->_res_);
		_g_free0 (_data_->install_parent);
		_g_free0 (_data_->source_path);
		_g_object_unref0 (_data_->archive);
		_g_object_unref0 (_data_->operation);
		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_->_tmp50_ = _data_->archive;
	_data_->_tmp51_ = _data_->install_parent;
	_data_->_tmp52_ = proton_plus_utils_filesystem_create_temporary_directory (_data_->_tmp51_, ".protonplus-stage-");
	_data_->_tmp53_ = _data_->_tmp52_;
	proton_plus_services_archive_operation_set_staging_root (_data_->_tmp50_, _data_->_tmp53_);
	_g_free0 (_data_->_tmp53_);
	_data_->_tmp54_ = _data_->archive;
	_data_->_tmp55_ = proton_plus_services_archive_operation_get_staging_root (_data_->_tmp54_);
	_data_->_tmp56_ = _data_->_tmp55_;
	if (g_strcmp0 (_data_->_tmp56_, "") == 0) {
		_data_->_tmp57_ = _data_->self->priv->archive_support;
		_data_->_tmp58_ = _data_->archive;
		_data_->_state_ = 10;
		proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp57_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp58_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_10:
		_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp57_, _data_->_res_);
		_g_free0 (_data_->install_parent);
		_g_free0 (_data_->source_path);
		_g_object_unref0 (_data_->archive);
		_g_object_unref0 (_data_->operation);
		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_->_tmp59_ = _data_->archive;
	_data_->_tmp60_ = proton_plus_services_archive_operation_get_staging_root (_data_->_tmp59_);
	_data_->_tmp61_ = _data_->_tmp60_;
	_data_->_tmp62_ = g_build_filename (_data_->_tmp61_, "installation", NULL);
	_data_->staged_install_path = _data_->_tmp62_;
	_data_->_tmp63_ = _data_->source_path;
	_data_->_tmp64_ = _data_->staged_install_path;
	_data_->_state_ = 11;
	proton_plus_utils_filesystem_move_directory (_data_->_tmp63_, _data_->_tmp64_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
	return FALSE;
	_state_11:
	if (!proton_plus_utils_filesystem_move_directory_finish (_data_->_res_)) {
		proton_plus_services_install_job_set_error_message (_data_->job, _ ("Moving failed"));
		_data_->_tmp65_ = _data_->self->priv->archive_support;
		_data_->_tmp66_ = _data_->archive;
		_data_->_state_ = 12;
		proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp65_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp66_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_12:
		_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp65_, _data_->_res_);
		_g_free0 (_data_->staged_install_path);
		_g_free0 (_data_->install_parent);
		_g_free0 (_data_->source_path);
		_g_object_unref0 (_data_->archive);
		_g_object_unref0 (_data_->operation);
		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_->_tmp67_ = proton_plus_services_install_job_get_mode (_data_->job);
	_data_->_tmp68_ = _data_->_tmp67_;
	if (_data_->_tmp68_ == PROTON_PLUS_SERVICES_INSTALL_JOB_MODE_LATEST) {
		_data_->_tmp69_ = _data_->staged_install_path;
		_data_->manifest_code = proton_plus_services_standard_archive_workflow_rewrite_compatibility_tool_vdf (_data_->self, _data_->job, _data_->_tmp69_);
		if (_data_->manifest_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
			_data_->_tmp70_ = _data_->self->priv->archive_support;
			_data_->_tmp71_ = _data_->archive;
			_data_->_state_ = 13;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp70_, _data_->manifest_code, _data_->_tmp71_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_13:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp70_, _data_->_res_);
			_g_free0 (_data_->staged_install_path);
			_g_free0 (_data_->install_parent);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp72_ = _data_->staged_install_path;
	if (!proton_plus_services_standard_archive_workflow_persist_runner_install_metadata (_data_->self, _data_->job, _data_->_tmp72_)) {
		proton_plus_services_install_job_set_error_message (_data_->job, _ ("Failed to save compatibility tool metadata"));
		_data_->_tmp73_ = _data_->self->priv->archive_support;
		_data_->_tmp74_ = _data_->archive;
		_data_->_state_ = 14;
		proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp73_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp74_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_14:
		_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp73_, _data_->_res_);
		_g_free0 (_data_->staged_install_path);
		_g_free0 (_data_->install_parent);
		_g_free0 (_data_->source_path);
		_g_object_unref0 (_data_->archive);
		_g_object_unref0 (_data_->operation);
		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_->_tmp76_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp77_ = _data_->_tmp76_;
	if (g_file_test (_data_->_tmp77_, G_FILE_TEST_EXISTS)) {
		_data_->_tmp75_ = TRUE;
	} else {
		_data_->_tmp78_ = proton_plus_services_install_job_get_install_location (_data_->job);
		_data_->_tmp79_ = _data_->_tmp78_;
		_data_->_tmp75_ = g_file_test (_data_->_tmp79_, G_FILE_TEST_IS_SYMLINK);
	}
	_data_->destination_exists = _data_->_tmp75_;
	if (_data_->destination_exists) {
		_data_->_tmp80_ = _data_->replace_existing;
	} else {
		_data_->_tmp80_ = FALSE;
	}
	if (_data_->_tmp80_) {
		_data_->_tmp82_ = proton_plus_services_install_job_get_state (_data_->job);
		_data_->_tmp83_ = _data_->_tmp82_;
		if (_data_->_tmp83_ == PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_UPDATING) {
			_data_->_tmp81_ = PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_UPDATE;
		} else {
			_data_->_tmp81_ = PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_REPLACEMENT;
		}
		_data_->operation_kind = _data_->_tmp81_;
		_data_->_tmp84_ = proton_plus_services_installation_service_get_instance ();
		_data_->_tmp85_ = _data_->_tmp84_;
		_data_->_state_ = 15;
		proton_plus_services_installation_service_check_final_process_state (_data_->_tmp85_, _data_->job, _data_->operation_kind, TRUE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_15:
		_data_->guard_code = proton_plus_services_installation_service_check_final_process_state_finish (_data_->_tmp85_, _data_->_res_);
		if (_data_->guard_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
			_data_->_tmp86_ = _data_->self->priv->archive_support;
			_data_->_tmp87_ = _data_->archive;
			_data_->_state_ = 16;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp86_, _data_->guard_code, _data_->_tmp87_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_16:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp86_, _data_->_res_);
			_g_free0 (_data_->staged_install_path);
			_g_free0 (_data_->install_parent);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp88_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp89_ = _data_->_tmp88_;
	if (g_file_test (_data_->_tmp89_, G_FILE_TEST_EXISTS)) {
		if (!_data_->replace_existing) {
			_data_->_tmp90_ = _data_->self->priv->archive_support;
			_data_->_tmp91_ = _data_->archive;
			_data_->_state_ = 17;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp90_, PROTON_PLUS_RETURN_CODE_RUNNER_ALREADY_INSTALLED, _data_->_tmp91_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_17:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp90_, _data_->_res_);
			_g_free0 (_data_->staged_install_path);
			_g_free0 (_data_->install_parent);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp92_ = _data_->install_parent;
		_data_->_tmp93_ = _data_->archive;
		_data_->_tmp94_ = proton_plus_services_archive_operation_get_staging_root (_data_->_tmp93_);
		_data_->_tmp95_ = _data_->_tmp94_;
		_data_->_tmp96_ = g_path_get_basename (_data_->_tmp95_);
		_data_->_tmp97_ = _data_->_tmp96_;
		_data_->_tmp98_ = g_strdup_printf (".protonplus-previous-%s", _data_->_tmp97_);
		_data_->_tmp99_ = _data_->_tmp98_;
		_data_->_tmp100_ = g_build_filename (_data_->_tmp92_, _data_->_tmp99_, NULL);
		_data_->_tmp101_ = _data_->_tmp100_;
		_g_free0 (_data_->_tmp99_);
		_g_free0 (_data_->_tmp97_);
		_data_->backup_path = _data_->_tmp101_;
		_data_->_tmp102_ = proton_plus_services_install_job_get_install_location (_data_->job);
		_data_->_tmp103_ = _data_->_tmp102_;
		_data_->_tmp104_ = _data_->backup_path;
		_data_->_state_ = 18;
		proton_plus_utils_filesystem_move_directory_atomic (_data_->_tmp103_, _data_->_tmp104_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_18:
		if (!proton_plus_utils_filesystem_move_directory_atomic_finish (_data_->_res_)) {
			_data_->_tmp105_ = _data_->self->priv->archive_support;
			_data_->_tmp106_ = _data_->archive;
			_data_->_state_ = 19;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp105_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp106_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_19:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp105_, _data_->_res_);
			_g_free0 (_data_->backup_path);
			_g_free0 (_data_->staged_install_path);
			_g_free0 (_data_->install_parent);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp107_ = _data_->staged_install_path;
		_data_->_state_ = 20;
		proton_plus_services_install_job_promote_staged_installation (_data_->job, _data_->_tmp107_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_20:
		if (!proton_plus_services_install_job_promote_staged_installation_finish (_data_->job, _data_->_res_)) {
			_data_->_tmp108_ = _data_->backup_path;
			_data_->_tmp109_ = proton_plus_services_install_job_get_install_location (_data_->job);
			_data_->_tmp110_ = _data_->_tmp109_;
			_data_->_state_ = 21;
			proton_plus_utils_filesystem_move_directory_atomic (_data_->_tmp108_, _data_->_tmp110_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_21:
			proton_plus_utils_filesystem_move_directory_atomic_finish (_data_->_res_);
			_data_->_tmp111_ = _data_->self->priv->archive_support;
			_data_->_tmp112_ = _data_->archive;
			_data_->_state_ = 22;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp111_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp112_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_22:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp111_, _data_->_res_);
			_g_free0 (_data_->backup_path);
			_g_free0 (_data_->staged_install_path);
			_g_free0 (_data_->install_parent);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp113_ = _data_->backup_path;
		proton_plus_services_install_job_set_replacement_backup_path (_data_->job, _data_->_tmp113_);
		_g_free0 (_data_->backup_path);
	} else {
		_data_->_tmp114_ = _data_->staged_install_path;
		_data_->_state_ = 23;
		proton_plus_services_install_job_promote_staged_installation (_data_->job, _data_->_tmp114_, proton_plus_services_standard_archive_workflow_install_ready, _data_);
		return FALSE;
		_state_23:
		if (!proton_plus_services_install_job_promote_staged_installation_finish (_data_->job, _data_->_res_)) {
			proton_plus_services_install_job_set_error_message (_data_->job, _ ("Moving failed"));
			_data_->_tmp115_ = _data_->self->priv->archive_support;
			_data_->_tmp116_ = _data_->archive;
			_data_->_state_ = 24;
			proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp115_, PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR, _data_->_tmp116_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
			return FALSE;
			_state_24:
			_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp115_, _data_->_res_);
			_g_free0 (_data_->staged_install_path);
			_g_free0 (_data_->install_parent);
			_g_free0 (_data_->source_path);
			_g_object_unref0 (_data_->archive);
			_g_object_unref0 (_data_->operation);
			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_->_tmp117_ = _data_->self->priv->archive_support;
	_data_->_tmp118_ = _data_->archive;
	_data_->_state_ = 25;
	proton_plus_services_archive_workflow_support_complete_attempt (_data_->_tmp117_, PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED, _data_->_tmp118_, FALSE, proton_plus_services_standard_archive_workflow_install_ready, _data_);
	return FALSE;
	_state_25:
	_data_->result = proton_plus_services_archive_workflow_support_complete_attempt_finish (_data_->_tmp117_, _data_->_res_);
	_g_free0 (_data_->staged_install_path);
	_g_free0 (_data_->install_parent);
	_g_free0 (_data_->source_path);
	_g_object_unref0 (_data_->archive);
	_g_object_unref0 (_data_->operation);
	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
proton_plus_services_standard_archive_workflow_real_update_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->coordinator);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowUpdateData, _data_);
}

static void
proton_plus_services_standard_archive_workflow_real_update (ProtonPlusServicesInstallationWorkflow* base,
                                                            ProtonPlusServicesInstallJob* job,
                                                            ProtonPlusServicesInstallationOperationCoordinator* coordinator,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	ProtonPlusServicesStandardArchiveWorkflowUpdateData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	ProtonPlusServicesInstallationOperationCoordinator* _tmp2_;
	g_return_if_fail (job != NULL);
	g_return_if_fail (coordinator != NULL);
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowUpdateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_real_update_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_tmp2_ = _g_object_ref0 (coordinator);
	_g_object_unref0 (_data_->coordinator);
	_data_->coordinator = _tmp2_;
	proton_plus_services_standard_archive_workflow_real_update_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_update_finish (ProtonPlusServicesInstallationWorkflow* base,
                                                              GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowUpdateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_update_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_real_update_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_real_update_co (ProtonPlusServicesStandardArchiveWorkflowUpdateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_services_install_job_get_mode (_data_->job);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_ != PROTON_PLUS_SERVICES_INSTALL_JOB_MODE_LATEST) {
		_data_->result = PROTON_PLUS_RETURN_CODE_UNSUPPORTED_OPERATION;
		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_->_tmp2_ = proton_plus_services_install_job_get_tool (_data_->job);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_data_->_tmp3_) ? ((ProtonPlusModelsToolsProviderTool*) _data_->_tmp3_) : NULL);
	_data_->runner = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->runner;
	if (_data_->_tmp6_ == NULL) {
		_data_->_tmp5_ = TRUE;
	} else {
		_data_->_tmp7_ = _data_->runner;
		_data_->_tmp8_ = proton_plus_models_tool_get_release_catalog ((ProtonPlusModelsTool*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp5_ = _data_->_tmp9_ == NULL;
	}
	if (_data_->_tmp5_) {
		_data_->result = PROTON_PLUS_RETURN_CODE_INVALID_CONFIGURATION;
		_g_object_unref0 (_data_->runner);
		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_->_tmp10_ = _data_->runner;
	_data_->_tmp11_ = proton_plus_models_tool_get_release_catalog ((ProtonPlusModelsTool*) _data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_state_ = 1;
	proton_plus_models_release_catalog_fetch_latest_eligible_release (_data_->_tmp12_, proton_plus_services_standard_archive_workflow_update_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp13_ = proton_plus_models_release_catalog_fetch_latest_eligible_release_finish (_data_->_tmp12_, _data_->_res_);
	_data_->lookup = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->lookup;
	_data_->_tmp15_ = proton_plus_models_release_lookup_result_get_succeeded (_data_->_tmp14_);
	_data_->_tmp16_ = _data_->_tmp15_;
	if (!_data_->_tmp16_) {
		_data_->_tmp17_ = _data_->lookup;
		_data_->_tmp18_ = proton_plus_models_release_lookup_result_get_code (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->result = _data_->_tmp19_;
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->runner);
		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_->_tmp20_ = _data_->lookup;
	_data_->_tmp21_ = proton_plus_models_release_lookup_result_get_has_release (_data_->_tmp20_);
	_data_->_tmp22_ = _data_->_tmp21_;
	if (!_data_->_tmp22_) {
		_data_->result = PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE;
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->runner);
		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_->_tmp23_ = _data_->lookup;
	_data_->_tmp24_ = proton_plus_models_release_lookup_result_require_release (_data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	proton_plus_services_install_job_set_release_for_update (_data_->job, _data_->_tmp25_);
	_g_object_unref0 (_data_->_tmp25_);
	_data_->_tmp26_ = proton_plus_services_installation_service_get_instance ();
	_data_->_tmp27_ = _data_->_tmp26_;
	_data_->_tmp28_ = FALSE;
	_data_->_tmp29_ = proton_plus_services_installation_service_resolve_provider_install_variant (_data_->_tmp27_, _data_->job, &_data_->_tmp28_);
	_data_->missing_explicit_selection = _data_->_tmp28_;
	_data_->compatibility = _data_->_tmp29_;
	if (_data_->missing_explicit_selection) {
		_data_->result = PROTON_PLUS_RETURN_CODE_INVALID_DATA;
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->runner);
		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;
	}
	if (_data_->compatibility != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->result = _data_->compatibility;
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->runner);
		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_->_state_ = 2;
	proton_plus_services_standard_archive_workflow_update_latest_job (_data_->self, _data_->job, _data_->coordinator, proton_plus_services_standard_archive_workflow_update_ready, _data_);
	return FALSE;
	_state_2:
	_data_->result = proton_plus_services_standard_archive_workflow_update_latest_job_finish (_data_->self, _data_->_res_);
	_g_object_unref0 (_data_->lookup);
	_g_object_unref0 (_data_->runner);
	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
proton_plus_services_standard_archive_workflow_real_remove_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowRemoveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowRemoveData, _data_);
}

static void
proton_plus_services_standard_archive_workflow_real_remove (ProtonPlusServicesInstallationWorkflow* base,
                                                            ProtonPlusServicesInstallJob* job,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	ProtonPlusServicesStandardArchiveWorkflowRemoveData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (job != NULL);
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowRemoveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_real_remove_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	proton_plus_services_standard_archive_workflow_real_remove_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_remove_finish (ProtonPlusServicesInstallationWorkflow* base,
                                                              GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowRemoveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_remove_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowRemoveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_real_remove_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_real_remove_co (ProtonPlusServicesStandardArchiveWorkflowRemoveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	proton_plus_services_install_job_set_step (_data_->job, PROTON_PLUS_SERVICES_INSTALL_JOB_STEP_REMOVING);
	_data_->_tmp0_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (!g_file_test (_data_->_tmp1_, G_FILE_TEST_IS_DIR)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_RUNNER_REMOVED;
		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_->_tmp2_ = proton_plus_services_installation_service_get_instance ();
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 1;
	proton_plus_services_installation_service_check_final_process_state (_data_->_tmp3_, _data_->job, PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_REMOVAL, TRUE, proton_plus_services_standard_archive_workflow_remove_ready, _data_);
	return FALSE;
	_state_1:
	_data_->guard_code = proton_plus_services_installation_service_check_final_process_state_finish (_data_->_tmp3_, _data_->_res_);
	if (_data_->guard_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->result = _data_->guard_code;
		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_->_tmp5_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_state_ = 2;
	proton_plus_utils_filesystem_delete_directory (_data_->_tmp6_, proton_plus_services_standard_archive_workflow_remove_ready, _data_);
	return FALSE;
	_state_2:
	if (proton_plus_utils_filesystem_delete_directory_finish (_data_->_res_)) {
		_data_->_tmp4_ = PROTON_PLUS_RETURN_CODE_RUNNER_REMOVED;
	} else {
		_data_->_tmp4_ = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
	}
	_data_->result = _data_->_tmp4_;
	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
proton_plus_services_standard_archive_workflow_real_refresh_state (ProtonPlusServicesInstallationWorkflow* base,
                                                                   ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	ProtonPlusModelsToolsProviderTool* provider_tool = NULL;
	ProtonPlusModelsTool* _tmp0_;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsToolsProviderTool* _tmp2_;
	gboolean _tmp3_ = FALSE;
	ProtonPlusModelsToolsProviderTool* _tmp4_;
	gboolean directory_valid = FALSE;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gboolean installed = FALSE;
	gboolean _tmp12_ = FALSE;
	ProtonPlusServicesInstallJobMode _tmp13_;
	ProtonPlusServicesInstallJobMode _tmp14_;
	ProtonPlusServicesInstallJobState _tmp38_ = 0;
	gboolean _tmp39_ = FALSE;
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	g_return_if_fail (job != NULL);
	proton_plus_services_install_job_set_step (job, PROTON_PLUS_SERVICES_INSTALL_JOB_STEP_NOTHING);
	_tmp0_ = proton_plus_services_install_job_get_tool (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_tmp1_) ? ((ProtonPlusModelsToolsProviderTool*) _tmp1_) : NULL);
	provider_tool = _tmp2_;
	_tmp4_ = provider_tool;
	if (_tmp4_ != NULL) {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = proton_plus_services_install_job_effective_directory_name_for_state (job);
		_tmp6_ = _tmp5_;
		_tmp3_ = g_strcmp0 (_tmp6_, "") != 0;
		_g_free0 (_tmp6_);
	} else {
		_tmp3_ = FALSE;
	}
	directory_valid = _tmp3_;
	_tmp8_ = proton_plus_services_install_job_get_install_location (job);
	_tmp9_ = _tmp8_;
	if (g_strcmp0 (_tmp9_, "") != 0) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = proton_plus_services_install_job_get_install_location (job);
		_tmp11_ = _tmp10_;
		_tmp7_ = g_file_test (_tmp11_, G_FILE_TEST_IS_DIR);
	} else {
		_tmp7_ = FALSE;
	}
	installed = _tmp7_;
	_tmp13_ = proton_plus_services_install_job_get_mode (job);
	_tmp14_ = _tmp13_;
	if (_tmp14_ == PROTON_PLUS_SERVICES_INSTALL_JOB_MODE_LATEST) {
		ProtonPlusModelsToolsProviderTool* _tmp15_;
		_tmp15_ = provider_tool;
		_tmp12_ = _tmp15_ != NULL;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		gchar* backup = NULL;
		ProtonPlusModelsTool* _tmp16_;
		ProtonPlusModelsTool* _tmp17_;
		ProtonPlusModelsGroup* _tmp18_;
		ProtonPlusModelsGroup* _tmp19_;
		ProtonPlusModelsLauncher* _tmp20_;
		ProtonPlusModelsLauncher* _tmp21_;
		ProtonPlusModelsTool* _tmp22_;
		ProtonPlusModelsTool* _tmp23_;
		ProtonPlusModelsGroup* _tmp24_;
		ProtonPlusModelsGroup* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		ProtonPlusModelsTool* _tmp28_;
		ProtonPlusModelsTool* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gboolean _tmp36_ = FALSE;
		_tmp16_ = proton_plus_services_install_job_get_tool (job);
		_tmp17_ = _tmp16_;
		_tmp18_ = proton_plus_models_tool_get_group (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = proton_plus_models_group_get_launcher (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = proton_plus_services_install_job_get_tool (job);
		_tmp23_ = _tmp22_;
		_tmp24_ = proton_plus_models_tool_get_group (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = proton_plus_models_launcher_get_primary_managed_tool_directory (_tmp21_, _tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = proton_plus_services_install_job_get_tool (job);
		_tmp29_ = _tmp28_;
		_tmp30_ = proton_plus_models_tool_get_title (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = g_strdup_printf ("%s Latest Backup", _tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = g_build_filename (_tmp27_, _tmp33_, NULL);
		_tmp35_ = _tmp34_;
		_g_free0 (_tmp33_);
		_g_free0 (_tmp27_);
		backup = _tmp35_;
		if (installed) {
			_tmp36_ = TRUE;
		} else {
			const gchar* _tmp37_;
			_tmp37_ = backup;
			_tmp36_ = g_file_test (_tmp37_, G_FILE_TEST_IS_DIR);
		}
		installed = _tmp36_;
		_g_free0 (backup);
	}
	if (directory_valid) {
		_tmp39_ = installed;
	} else {
		_tmp39_ = FALSE;
	}
	if (_tmp39_) {
		_tmp38_ = PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_UP_TO_DATE;
	} else {
		_tmp38_ = PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_NOT_INSTALLED;
	}
	proton_plus_services_install_job_set_state (job, _tmp38_);
	_g_object_unref0 (provider_tool);
}

static void
proton_plus_services_standard_archive_workflow_real_finalize_install_success (ProtonPlusServicesInstallationWorkflow* base,
                                                                              ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	ProtonPlusModelsTool* _tmp0_;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsGroup* _tmp2_;
	ProtonPlusModelsGroup* _tmp3_;
	ProtonPlusModelsLauncher* _tmp4_;
	ProtonPlusModelsLauncher* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	g_return_if_fail (job != NULL);
	_tmp0_ = proton_plus_services_install_job_get_tool (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_tool_get_group (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_models_group_get_launcher (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = proton_plus_services_install_job_get_install_location (job);
	_tmp7_ = _tmp6_;
	proton_plus_models_launcher_register_compatibility_tool_from_path (_tmp5_, _tmp7_);
}

static void
proton_plus_services_standard_archive_workflow_real_finalize_removal_success (ProtonPlusServicesInstallationWorkflow* base,
                                                                              ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	ProtonPlusModelsTool* _tmp0_;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsGroup* _tmp2_;
	ProtonPlusModelsGroup* _tmp3_;
	ProtonPlusModelsLauncher* _tmp4_;
	ProtonPlusModelsLauncher* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	self = (ProtonPlusServicesStandardArchiveWorkflow*) base;
	g_return_if_fail (job != NULL);
	_tmp0_ = proton_plus_services_install_job_get_tool (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_tool_get_group (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_models_group_get_launcher (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = proton_plus_services_install_job_get_install_location (job);
	_tmp7_ = _tmp6_;
	proton_plus_models_launcher_unregister_compatibility_tool_by_path (_tmp5_, _tmp7_);
}

static void
proton_plus_services_standard_archive_workflow_update_specific_runner_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->runner);
	_g_object_unref0 (_data_->coordinator);
	_g_free0 (_data_->installation_location);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData, _data_);
}

void
proton_plus_services_standard_archive_workflow_update_specific_runner (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                       ProtonPlusModelsToolsProviderTool* runner,
                                                                       ProtonPlusServicesInstallationOperationCoordinator* coordinator,
                                                                       const gchar* installation_location,
                                                                       GAsyncReadyCallback _callback_,
                                                                       gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusModelsToolsProviderTool* _tmp1_;
	ProtonPlusServicesInstallationOperationCoordinator* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (runner != NULL);
	g_return_if_fail (coordinator != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_update_specific_runner_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (runner);
	_g_object_unref0 (_data_->runner);
	_data_->runner = _tmp1_;
	_tmp2_ = _g_object_ref0 (coordinator);
	_g_object_unref0 (_data_->coordinator);
	_data_->coordinator = _tmp2_;
	_tmp3_ = g_strdup (installation_location);
	_g_free0 (_data_->installation_location);
	_data_->installation_location = _tmp3_;
	proton_plus_services_standard_archive_workflow_update_specific_runner_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_update_specific_runner_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                              GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_update_specific_runner_ready (GObject* source_object,
                                                                             GAsyncResult* _res_,
                                                                             gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_update_specific_runner_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_update_specific_runner_co (ProtonPlusServicesStandardArchiveWorkflowUpdateSpecificRunnerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = g_strdup (_data_->installation_location);
	_data_->_tmp0_ = _data_->_tmp1_;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp2_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = proton_plus_models_group_get_launcher (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = proton_plus_models_launcher_get_primary_managed_tool_directory (_data_->_tmp5_, _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) _data_->runner);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp12_ = g_strdup_printf ("%s Latest", _data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = g_build_filename (_data_->_tmp9_, _data_->_tmp13_, NULL);
		_g_free0 (_data_->_tmp0_);
		_data_->_tmp0_ = _data_->_tmp14_;
		_g_free0 (_data_->_tmp13_);
		_g_free0 (_data_->_tmp9_);
	}
	_data_->_tmp15_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->directory = _data_->_tmp15_;
	_data_->_tmp16_ = _data_->directory;
	if (!g_file_test (_data_->_tmp16_, G_FILE_TEST_IS_DIR)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_RUNNER_NOT_INSTALLED;
		_g_free0 (_data_->directory);
		_g_free0 (_data_->_tmp0_);
		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_->_tmp17_ = _data_->directory;
	_data_->_tmp18_ = proton_plus_utils_metadata_load (_data_->_tmp17_);
	_data_->metadata = _data_->_tmp18_;
	_data_->_tmp19_ = proton_plus_models_tool_get_release_catalog ((ProtonPlusModelsTool*) _data_->runner);
	_data_->_tmp20_ = _data_->_tmp19_;
	if (_data_->_tmp20_ == NULL) {
		_data_->result = PROTON_PLUS_RETURN_CODE_INVALID_CONFIGURATION;
		_g_object_unref0 (_data_->metadata);
		_g_free0 (_data_->directory);
		_g_free0 (_data_->_tmp0_);
		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_->_tmp21_ = proton_plus_models_tool_get_release_catalog ((ProtonPlusModelsTool*) _data_->runner);
	_data_->_tmp22_ = _data_->_tmp21_;
	_data_->_state_ = 1;
	proton_plus_models_release_catalog_fetch_latest_eligible_release (_data_->_tmp22_, proton_plus_services_standard_archive_workflow_update_specific_runner_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp23_ = proton_plus_models_release_catalog_fetch_latest_eligible_release_finish (_data_->_tmp22_, _data_->_res_);
	_data_->lookup = _data_->_tmp23_;
	_data_->_tmp24_ = _data_->lookup;
	_data_->_tmp25_ = proton_plus_models_release_lookup_result_get_succeeded (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	if (!_data_->_tmp26_) {
		_data_->_tmp27_ = _data_->lookup;
		_data_->_tmp28_ = proton_plus_models_release_lookup_result_get_code (_data_->_tmp27_);
		_data_->_tmp29_ = _data_->_tmp28_;
		_data_->result = _data_->_tmp29_;
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->metadata);
		_g_free0 (_data_->directory);
		_g_free0 (_data_->_tmp0_);
		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_->_tmp30_ = _data_->lookup;
	_data_->_tmp31_ = proton_plus_models_release_lookup_result_get_has_release (_data_->_tmp30_);
	_data_->_tmp32_ = _data_->_tmp31_;
	if (!_data_->_tmp32_) {
		_data_->result = PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE;
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->metadata);
		_g_free0 (_data_->directory);
		_g_free0 (_data_->_tmp0_);
		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_->_tmp33_ = _data_->lookup;
	_data_->_tmp34_ = proton_plus_models_release_lookup_result_require_release (_data_->_tmp33_);
	_data_->_tmp35_ = _data_->_tmp34_;
	_data_->_tmp36_ = _data_->directory;
	_data_->_tmp37_ = proton_plus_services_install_job_new (_data_->_tmp35_, (ProtonPlusModelsTool*) _data_->runner, PROTON_PLUS_SERVICES_INSTALL_JOB_MODE_LATEST, _data_->_tmp36_, NULL);
	_data_->_tmp38_ = _data_->_tmp37_;
	_g_object_unref0 (_data_->_tmp35_);
	_data_->job = _data_->_tmp38_;
	_data_->_tmp39_ = _data_->job;
	_data_->_tmp40_ = _data_->metadata;
	_data_->_tmp41_ = proton_plus_utils_metadata_get_variant_id (_data_->_tmp40_);
	_data_->_tmp42_ = _data_->_tmp41_;
	_data_->restored_variant = proton_plus_services_standard_archive_workflow_restore_installed_variant (_data_->self, _data_->_tmp39_, _data_->_tmp42_);
	if (_data_->restored_variant != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->result = _data_->restored_variant;
		_g_object_unref0 (_data_->job);
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->metadata);
		_g_free0 (_data_->directory);
		_g_free0 (_data_->_tmp0_);
		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_->_tmp43_ = proton_plus_services_installation_service_get_instance ();
	_data_->_tmp44_ = _data_->_tmp43_;
	_data_->_tmp45_ = _data_->job;
	_data_->_tmp46_ = FALSE;
	_data_->_tmp47_ = proton_plus_services_installation_service_resolve_provider_install_variant (_data_->_tmp44_, _data_->_tmp45_, &_data_->_tmp46_);
	_data_->missing_explicit_selection = _data_->_tmp46_;
	_data_->compatibility = _data_->_tmp47_;
	if (_data_->compatibility != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->result = _data_->compatibility;
		_g_object_unref0 (_data_->job);
		_g_object_unref0 (_data_->lookup);
		_g_object_unref0 (_data_->metadata);
		_g_free0 (_data_->directory);
		_g_free0 (_data_->_tmp0_);
		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_->_tmp48_ = _data_->job;
	_data_->_state_ = 2;
	proton_plus_services_standard_archive_workflow_update_latest_job (_data_->self, _data_->_tmp48_, _data_->coordinator, proton_plus_services_standard_archive_workflow_update_specific_runner_ready, _data_);
	return FALSE;
	_state_2:
	_data_->result = proton_plus_services_standard_archive_workflow_update_latest_job_finish (_data_->self, _data_->_res_);
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->lookup);
	_g_object_unref0 (_data_->metadata);
	_g_free0 (_data_->directory);
	_g_free0 (_data_->_tmp0_);
	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
proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->runner);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData, _data_);
}

void
proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                             ProtonPlusModelsToolsProviderTool* runner,
                                                                             GAsyncReadyCallback _callback_,
                                                                             gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusModelsToolsProviderTool* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (runner != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (runner);
	_g_object_unref0 (_data_->runner);
	_data_->runner = _tmp1_;
	proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                    GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_ready (GObject* source_object,
                                                                                   GAsyncResult* _res_,
                                                                                   gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_co (ProtonPlusServicesStandardArchiveWorkflowRestoreLegacyLatestBackupData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = proton_plus_models_group_get_launcher (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = proton_plus_models_launcher_get_primary_managed_tool_directory (_data_->_tmp3_, _data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) _data_->runner);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = g_strdup_printf ("%s Latest", _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = g_build_filename (_data_->_tmp7_, _data_->_tmp11_, NULL);
	_data_->_tmp13_ = _data_->_tmp12_;
	_g_free0 (_data_->_tmp11_);
	_g_free0 (_data_->_tmp7_);
	_data_->directory = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->directory;
	_data_->_tmp15_ = g_strdup_printf ("%s Backup", _data_->_tmp14_);
	_data_->backup = _data_->_tmp15_;
	_data_->_tmp16_ = _data_->directory;
	if (g_file_test (_data_->_tmp16_, G_FILE_TEST_EXISTS)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_RUNNER_ALREADY_INSTALLED;
		_g_free0 (_data_->backup);
		_g_free0 (_data_->directory);
		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_->_tmp17_ = _data_->backup;
	if (!g_file_test (_data_->_tmp17_, G_FILE_TEST_IS_DIR)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_RUNNER_NOT_INSTALLED;
		_g_free0 (_data_->backup);
		_g_free0 (_data_->directory);
		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_->_tmp19_ = _data_->backup;
	_data_->_tmp20_ = _data_->directory;
	_data_->_state_ = 1;
	proton_plus_utils_filesystem_move_directory_atomic (_data_->_tmp19_, _data_->_tmp20_, proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_ready, _data_);
	return FALSE;
	_state_1:
	if (proton_plus_utils_filesystem_move_directory_atomic_finish (_data_->_res_)) {
		_data_->_tmp18_ = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
	} else {
		_data_->_tmp18_ = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
	}
	_data_->result = _data_->_tmp18_;
	_g_free0 (_data_->backup);
	_g_free0 (_data_->directory);
	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
proton_plus_services_standard_archive_workflow_finalize_replaced_runner_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData* _data_;
	_data_ = _data;
	_g_free0 (_data_->directory);
	_g_free0 (_data_->backup);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData, _data_);
}

void
proton_plus_services_standard_archive_workflow_finalize_replaced_runner (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                         const gchar* directory,
                                                                         const gchar* backup,
                                                                         gboolean migrate_prefix,
                                                                         GAsyncReadyCallback _callback_,
                                                                         gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (directory != NULL);
	g_return_if_fail (backup != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (directory);
	_g_free0 (_data_->directory);
	_data_->directory = _tmp1_;
	_tmp2_ = g_strdup (backup);
	_g_free0 (_data_->backup);
	_data_->backup = _tmp2_;
	_data_->migrate_prefix = migrate_prefix;
	proton_plus_services_standard_archive_workflow_finalize_replaced_runner_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_finalize_replaced_runner_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready (GObject* source_object,
                                                                               GAsyncResult* _res_,
                                                                               gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_finalize_replaced_runner_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_finalize_replaced_runner_co (ProtonPlusServicesStandardArchiveWorkflowFinalizeReplacedRunnerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		case 7:
		goto _state_7;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup_printf ("%s/user_settings.py", _data_->backup);
	_data_->backup_settings = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->backup_settings;
	if (g_file_test (_data_->_tmp1_, G_FILE_TEST_IS_REGULAR)) {
		_data_->_tmp2_ = g_strdup_printf ("%s/user_settings.py", _data_->directory);
		_data_->settings = _data_->_tmp2_;
		_data_->copied = TRUE;
		_data_->_tmp3_ = _data_->backup_settings;
		if (g_file_test (_data_->_tmp3_, G_FILE_TEST_IS_SYMLINK)) {
			_data_->_tmp4_ = _data_->backup_settings;
			_data_->_tmp5_ = _data_->settings;
			_data_->copied = proton_plus_utils_filesystem_copy_symlink (_data_->_tmp4_, _data_->_tmp5_);
		} else {
			_data_->_tmp6_ = _data_->backup_settings;
			_data_->_tmp7_ = _data_->settings;
			_data_->_state_ = 1;
			proton_plus_utils_filesystem_copy_file_verified (_data_->_tmp6_, _data_->_tmp7_, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
			return FALSE;
			_state_1:
			_data_->copied = proton_plus_utils_filesystem_copy_file_verified_finish (_data_->_res_);
		}
		if (!_data_->copied) {
			_data_->_state_ = 2;
			proton_plus_services_standard_archive_workflow_rollback_replaced_runner (_data_->self, _data_->directory, _data_->backup, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
			return FALSE;
			_state_2:
			proton_plus_services_standard_archive_workflow_rollback_replaced_runner_finish (_data_->self, _data_->_res_);
			_data_->result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
			_g_free0 (_data_->settings);
			_g_free0 (_data_->backup_settings);
			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;
		}
		_g_free0 (_data_->settings);
	}
	_data_->_tmp8_ = g_strdup_printf ("%s/files/share/default_pfx", _data_->backup);
	_data_->backup_prefix = _data_->_tmp8_;
	if (_data_->migrate_prefix) {
		_data_->_tmp10_ = _data_->backup_prefix;
		_data_->_tmp9_ = g_file_test (_data_->_tmp10_, G_FILE_TEST_IS_DIR);
	} else {
		_data_->_tmp9_ = FALSE;
	}
	if (_data_->_tmp9_) {
		_data_->_tmp11_ = g_strdup_printf ("%s/files/share/default_pfx", _data_->directory);
		_data_->prefix = _data_->_tmp11_;
		_data_->_tmp13_ = _data_->prefix;
		if (g_file_test (_data_->_tmp13_, G_FILE_TEST_IS_DIR)) {
			_data_->_tmp14_ = _data_->prefix;
			_data_->_state_ = 3;
			proton_plus_utils_filesystem_delete_directory (_data_->_tmp14_, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp12_ = !proton_plus_utils_filesystem_delete_directory_finish (_data_->_res_);
		} else {
			_data_->_tmp12_ = FALSE;
		}
		if (_data_->_tmp12_) {
			_data_->_state_ = 4;
			proton_plus_services_standard_archive_workflow_rollback_replaced_runner (_data_->self, _data_->directory, _data_->backup, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
			return FALSE;
			_state_4:
			proton_plus_services_standard_archive_workflow_rollback_replaced_runner_finish (_data_->self, _data_->_res_);
			_data_->result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
			_g_free0 (_data_->prefix);
			_g_free0 (_data_->backup_prefix);
			_g_free0 (_data_->backup_settings);
			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_->_tmp15_ = _data_->backup_prefix;
		_data_->_tmp16_ = _data_->prefix;
		_data_->_state_ = 5;
		proton_plus_utils_filesystem_copy_directory (_data_->_tmp15_, _data_->_tmp16_, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
		return FALSE;
		_state_5:
		if (!proton_plus_utils_filesystem_copy_directory_finish (_data_->_res_)) {
			_data_->_state_ = 6;
			proton_plus_services_standard_archive_workflow_rollback_replaced_runner (_data_->self, _data_->directory, _data_->backup, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
			return FALSE;
			_state_6:
			proton_plus_services_standard_archive_workflow_rollback_replaced_runner_finish (_data_->self, _data_->_res_);
			_data_->result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
			_g_free0 (_data_->prefix);
			_g_free0 (_data_->backup_prefix);
			_g_free0 (_data_->backup_settings);
			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;
		}
		_g_free0 (_data_->prefix);
	}
	_data_->_state_ = 7;
	proton_plus_utils_filesystem_delete_directory (_data_->backup, proton_plus_services_standard_archive_workflow_finalize_replaced_runner_ready, _data_);
	return FALSE;
	_state_7:
	if (proton_plus_utils_filesystem_delete_directory_finish (_data_->_res_)) {
		_data_->_tmp17_ = PROTON_PLUS_RETURN_CODE_RUNNER_UPDATED;
	} else {
		_data_->_tmp17_ = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
	}
	_data_->result = _data_->_tmp17_;
	_g_free0 (_data_->backup_prefix);
	_g_free0 (_data_->backup_settings);
	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
proton_plus_services_standard_archive_workflow_update_latest_job_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->coordinator);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData, _data_);
}

static void
proton_plus_services_standard_archive_workflow_update_latest_job (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                  ProtonPlusServicesInstallJob* job,
                                                                  ProtonPlusServicesInstallationOperationCoordinator* coordinator,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	ProtonPlusServicesInstallationOperationCoordinator* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	g_return_if_fail (coordinator != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_update_latest_job_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_tmp2_ = _g_object_ref0 (coordinator);
	_g_object_unref0 (_data_->coordinator);
	_data_->coordinator = _tmp2_;
	proton_plus_services_standard_archive_workflow_update_latest_job_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_update_latest_job_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                         GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_update_latest_job_ready (GObject* source_object,
                                                                        GAsyncResult* _res_,
                                                                        gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_update_latest_job_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_update_latest_job_co (ProtonPlusServicesStandardArchiveWorkflowUpdateLatestJobData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_services_install_job_get_tool (_data_->job);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_data_->_tmp1_) ? ((ProtonPlusModelsToolsProviderTool*) _data_->_tmp1_) : NULL);
	_data_->runner = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->runner;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp3_ = TRUE;
	} else {
		_data_->_tmp5_ = proton_plus_services_install_job_get_install_location (_data_->job);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp3_ = !g_file_test (_data_->_tmp6_, G_FILE_TEST_IS_DIR);
	}
	if (_data_->_tmp3_) {
		proton_plus_services_install_job_refresh_state (_data_->job);
		_data_->result = PROTON_PLUS_RETURN_CODE_RUNNER_NOT_INSTALLED;
		_g_object_unref0 (_data_->runner);
		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_->_tmp7_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = proton_plus_utils_metadata_load (_data_->_tmp8_);
	_data_->metadata = _data_->_tmp9_;
	_data_->_tmp10_ = proton_plus_services_install_job_get_release (_data_->job);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = _g_object_ref0 (_data_->_tmp11_);
	_data_->release = _data_->_tmp12_;
	_data_->_tmp14_ = _data_->release;
	_data_->_tmp15_ = proton_plus_models_release_get_source_tag (_data_->_tmp14_);
	_data_->_tmp16_ = _data_->_tmp15_;
	if (g_strcmp0 (_data_->_tmp16_, "") != 0) {
		_data_->_tmp17_ = _data_->metadata;
		_data_->_tmp18_ = proton_plus_utils_metadata_get_tag (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = _data_->release;
		_data_->_tmp21_ = proton_plus_models_release_get_source_tag (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp13_ = g_strcmp0 (_data_->_tmp19_, _data_->_tmp22_) == 0;
	} else {
		_data_->_tmp13_ = FALSE;
	}
	if (_data_->_tmp13_) {
		_data_->result = PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE;
		_g_object_unref0 (_data_->release);
		_g_object_unref0 (_data_->metadata);
		_g_object_unref0 (_data_->runner);
		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_->_tmp23_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = g_strdup_printf ("%s/version", _data_->_tmp24_);
	_data_->version_path = _data_->_tmp25_;
	_data_->_tmp26_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp27_ = _data_->_tmp26_;
	_data_->_tmp28_ = g_strdup_printf ("%s/proton", _data_->_tmp27_);
	_data_->proton_path = _data_->_tmp28_;
	_data_->_tmp30_ = _data_->version_path;
	if (g_file_test (_data_->_tmp30_, G_FILE_TEST_IS_REGULAR)) {
		_data_->_tmp31_ = _data_->version_path;
		_data_->_tmp32_ = proton_plus_utils_filesystem_get_file_content (_data_->_tmp31_, FALSE);
		_g_free0 (_data_->_tmp29_);
		_data_->_tmp29_ = _data_->_tmp32_;
	} else {
		_data_->_tmp33_ = g_strdup ("");
		_g_free0 (_data_->_tmp29_);
		_data_->_tmp29_ = _data_->_tmp33_;
	}
	_data_->_tmp34_ = _data_->_tmp29_;
	_data_->_tmp29_ = NULL;
	_data_->version_content = _data_->_tmp34_;
	_data_->_tmp36_ = _data_->proton_path;
	if (g_file_test (_data_->_tmp36_, G_FILE_TEST_IS_REGULAR)) {
		_data_->_tmp37_ = _data_->proton_path;
		_data_->_tmp38_ = proton_plus_utils_filesystem_get_file_content (_data_->_tmp37_, FALSE);
		_g_free0 (_data_->_tmp35_);
		_data_->_tmp35_ = _data_->_tmp38_;
	} else {
		_data_->_tmp39_ = g_strdup ("");
		_g_free0 (_data_->_tmp35_);
		_data_->_tmp35_ = _data_->_tmp39_;
	}
	_data_->_tmp40_ = _data_->_tmp35_;
	_data_->_tmp35_ = NULL;
	_data_->proton_content = _data_->_tmp40_;
	_data_->_tmp43_ = _data_->version_content;
	if (g_strcmp0 (_data_->_tmp43_, "") != 0) {
		_data_->_tmp44_ = _data_->proton_content;
		_data_->_tmp42_ = g_strcmp0 (_data_->_tmp44_, "") != 0;
	} else {
		_data_->_tmp42_ = FALSE;
	}
	if (_data_->_tmp42_) {
		_data_->_tmp45_ = _data_->release;
		_data_->_tmp46_ = _data_->version_content;
		_data_->_tmp47_ = _data_->proton_content;
		_data_->_tmp41_ = proton_plus_services_standard_archive_workflow_release_matches_installed_version (_data_->self, _data_->_tmp45_, _data_->_tmp46_, _data_->_tmp47_);
	} else {
		_data_->_tmp41_ = FALSE;
	}
	if (_data_->_tmp41_) {
		_data_->_tmp49_ = _data_->release;
		_data_->_tmp50_ = proton_plus_models_release_get_source_tag (_data_->_tmp49_);
		_data_->_tmp51_ = _data_->_tmp50_;
		if (g_strcmp0 (_data_->_tmp51_, "") != 0) {
			_data_->_tmp52_ = _data_->release;
			_data_->_tmp53_ = proton_plus_models_release_get_source_tag (_data_->_tmp52_);
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp48_ = _data_->_tmp54_;
		} else {
			_data_->_tmp55_ = _data_->release;
			_data_->_tmp56_ = proton_plus_models_release_get_title (_data_->_tmp55_);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp48_ = _data_->_tmp57_;
		}
		_data_->_tmp58_ = _data_->metadata;
		_data_->_tmp59_ = _data_->runner;
		_data_->_tmp60_ = proton_plus_services_install_job_get_install_location (_data_->job);
		_data_->_tmp61_ = _data_->_tmp60_;
		_data_->_tmp62_ = _data_->release;
		_data_->_tmp63_ = proton_plus_models_release_get_upstream_release_id (_data_->_tmp62_);
		_data_->_tmp64_ = _data_->_tmp63_;
		if (!proton_plus_services_standard_archive_workflow_persist_runner_identity (_data_->self, _data_->_tmp58_, _data_->_tmp59_, _data_->_tmp61_, _data_->_tmp48_, _data_->_tmp64_)) {
			_data_->result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
			_g_free0 (_data_->proton_content);
			_g_free0 (_data_->_tmp35_);
			_g_free0 (_data_->version_content);
			_g_free0 (_data_->_tmp29_);
			_g_free0 (_data_->proton_path);
			_g_free0 (_data_->version_path);
			_g_object_unref0 (_data_->release);
			_g_object_unref0 (_data_->metadata);
			_g_object_unref0 (_data_->runner);
			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 = PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE;
		_g_free0 (_data_->proton_content);
		_g_free0 (_data_->_tmp35_);
		_g_free0 (_data_->version_content);
		_g_free0 (_data_->_tmp29_);
		_g_free0 (_data_->proton_path);
		_g_free0 (_data_->version_path);
		_g_object_unref0 (_data_->release);
		_g_object_unref0 (_data_->metadata);
		_g_object_unref0 (_data_->runner);
		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_->_tmp65_ = proton_plus_services_install_job_get_selected_asset (_data_->job);
	_data_->_tmp66_ = _data_->_tmp65_;
	if (!proton_plus_models_assets_asset_is_archive (_data_->_tmp66_)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_INVALID_DATA;
		_g_free0 (_data_->proton_content);
		_g_free0 (_data_->_tmp35_);
		_g_free0 (_data_->version_content);
		_g_free0 (_data_->_tmp29_);
		_g_free0 (_data_->proton_path);
		_g_free0 (_data_->version_path);
		_g_object_unref0 (_data_->release);
		_g_object_unref0 (_data_->metadata);
		_g_object_unref0 (_data_->runner);
		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;
	}
	proton_plus_services_install_job_set_state (_data_->job, PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_UPDATING);
	_data_->_state_ = 1;
	proton_plus_services_installation_operation_coordinator_install_for_update (_data_->coordinator, _data_->job, proton_plus_services_standard_archive_workflow_update_latest_job_ready, _data_);
	return FALSE;
	_state_1:
	_data_->install_code = proton_plus_services_installation_operation_coordinator_install_for_update_finish (_data_->coordinator, _data_->_res_);
	if (_data_->install_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		proton_plus_services_install_job_finish_operation (_data_->job);
		_data_->result = _data_->install_code;
		_g_free0 (_data_->proton_content);
		_g_free0 (_data_->_tmp35_);
		_g_free0 (_data_->version_content);
		_g_free0 (_data_->_tmp29_);
		_g_free0 (_data_->proton_path);
		_g_free0 (_data_->version_path);
		_g_object_unref0 (_data_->release);
		_g_object_unref0 (_data_->metadata);
		_g_object_unref0 (_data_->runner);
		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_->_tmp67_ = proton_plus_services_install_job_get_replacement_backup_path (_data_->job);
	_data_->_tmp68_ = _data_->_tmp67_;
	_data_->_tmp69_ = g_strdup (_data_->_tmp68_);
	_data_->backup = _data_->_tmp69_;
	_data_->_tmp71_ = _data_->backup;
	if (_data_->_tmp71_ == NULL) {
		_data_->_tmp70_ = TRUE;
	} else {
		_data_->_tmp72_ = _data_->backup;
		_data_->_tmp70_ = !g_file_test (_data_->_tmp72_, G_FILE_TEST_IS_DIR);
	}
	if (_data_->_tmp70_) {
		proton_plus_services_install_job_finish_operation (_data_->job);
		_data_->result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
		_g_free0 (_data_->backup);
		_g_free0 (_data_->proton_content);
		_g_free0 (_data_->_tmp35_);
		_g_free0 (_data_->version_content);
		_g_free0 (_data_->_tmp29_);
		_g_free0 (_data_->proton_path);
		_g_free0 (_data_->version_path);
		_g_object_unref0 (_data_->release);
		_g_object_unref0 (_data_->metadata);
		_g_object_unref0 (_data_->runner);
		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_->_tmp74_ = proton_plus_globals_SETTINGS;
	if (_data_->_tmp74_ != NULL) {
		_data_->_tmp75_ = proton_plus_globals_SETTINGS;
		_data_->_tmp73_ = g_settings_get_boolean (_data_->_tmp75_, "migrate-default-prefix");
	} else {
		_data_->_tmp73_ = FALSE;
	}
	_data_->migrate_prefix = _data_->_tmp73_;
	_data_->_tmp76_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp77_ = _data_->_tmp76_;
	_data_->_tmp78_ = _data_->backup;
	_data_->_state_ = 2;
	proton_plus_services_standard_archive_workflow_finalize_replaced_runner (_data_->self, _data_->_tmp77_, _data_->_tmp78_, _data_->migrate_prefix, proton_plus_services_standard_archive_workflow_update_latest_job_ready, _data_);
	return FALSE;
	_state_2:
	_data_->code = proton_plus_services_standard_archive_workflow_finalize_replaced_runner_finish (_data_->self, _data_->_res_);
	proton_plus_services_install_job_finish_operation (_data_->job);
	if (_data_->code == PROTON_PLUS_RETURN_CODE_RUNNER_UPDATED) {
		_data_->_tmp79_ = _g_object_ref0 (PROTON_PLUS_SERVICES_IS_INSTALLATION_LIFECYCLE_RECORDER (_data_->coordinator) ? ((ProtonPlusServicesInstallationLifecycleRecorder*) _data_->coordinator) : NULL);
		_data_->lifecycle = _data_->_tmp79_;
		_data_->_tmp80_ = _data_->lifecycle;
		if (_data_->_tmp80_ != NULL) {
			_data_->_tmp81_ = _data_->lifecycle;
			proton_plus_services_installation_lifecycle_recorder_record_completed_update (_data_->_tmp81_, _data_->job);
		}
		_g_object_unref0 (_data_->lifecycle);
	}
	_data_->result = _data_->code;
	_g_free0 (_data_->backup);
	_g_free0 (_data_->proton_content);
	_g_free0 (_data_->_tmp35_);
	_g_free0 (_data_->version_content);
	_g_free0 (_data_->_tmp29_);
	_g_free0 (_data_->proton_path);
	_g_free0 (_data_->version_path);
	_g_object_unref0 (_data_->release);
	_g_object_unref0 (_data_->metadata);
	_g_object_unref0 (_data_->runner);
	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
proton_plus_services_standard_archive_workflow_requires_nested_archive (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                        ProtonPlusServicesInstallJob* job)
{
	ProtonPlusModelsProvidersArchiveInstallRequirement _tmp0_;
	ProtonPlusModelsProvidersArchiveInstallRequirement _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (job != NULL, FALSE);
	_tmp0_ = proton_plus_services_install_job_get_archive_install_requirement (job);
	_tmp1_ = _tmp0_;
	result = _tmp1_ == PROTON_PLUS_MODELS_PROVIDERS_ARCHIVE_INSTALL_REQUIREMENT_NESTED_ARCHIVE;
	return result;
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_restore_installed_variant (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                          ProtonPlusServicesInstallJob* job,
                                                                          const gchar* variant_id)
{
	ProtonPlusModelsTool* _tmp34_;
	ProtonPlusModelsTool* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	ProtonPlusReturnCode result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (job != NULL, 0);
	g_return_val_if_fail (variant_id != NULL, 0);
	if (g_strcmp0 (variant_id, "") == 0) {
		result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
		return result;
	}
	{
		GeeLinkedList* _variant_list = NULL;
		ProtonPlusModelsRelease* _tmp0_;
		ProtonPlusModelsRelease* _tmp1_;
		GeeLinkedList* _tmp2_;
		GeeLinkedList* _tmp3_;
		gint _variant_size = 0;
		GeeLinkedList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _variant_index = 0;
		_tmp0_ = proton_plus_services_install_job_get_release (job);
		_tmp1_ = _tmp0_;
		_tmp2_ = proton_plus_models_release_get_variants (_tmp1_);
		_tmp3_ = _tmp2_;
		_variant_list = _tmp3_;
		_tmp4_ = _variant_list;
		_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_variant_size = _tmp6_;
		_variant_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			ProtonPlusModelsVariant* variant = NULL;
			GeeLinkedList* _tmp9_;
			gpointer _tmp10_;
			ProtonPlusModelsVariant* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gboolean _tmp14_ = FALSE;
			ProtonPlusModelsVariant* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			ProtonPlusModelsVariant* _tmp25_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			ProtonPlusModelsVariant* _tmp28_;
			ProtonPlusModelsAssetsAsset* _tmp29_;
			ProtonPlusModelsAssetsAsset* _tmp30_;
			ProtonPlusModelsVariant* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			_variant_index = _variant_index + 1;
			_tmp7_ = _variant_index;
			_tmp8_ = _variant_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _variant_list;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _variant_index);
			variant = (ProtonPlusModelsVariant*) _tmp10_;
			_tmp11_ = variant;
			_tmp12_ = proton_plus_models_variant_get_id (_tmp11_);
			_tmp13_ = _tmp12_;
			if (g_strcmp0 (_tmp13_, variant_id) != 0) {
				_g_object_unref0 (variant);
				continue;
			}
			_tmp15_ = variant;
			_tmp16_ = proton_plus_models_variant_get_download_url (_tmp15_);
			_tmp17_ = _tmp16_;
			if (_tmp17_ == NULL) {
				_tmp14_ = TRUE;
			} else {
				ProtonPlusModelsVariant* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				_tmp18_ = variant;
				_tmp19_ = proton_plus_models_variant_get_download_url (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp14_ = g_strcmp0 (_tmp20_, "") == 0;
			}
			if (_tmp14_) {
				ProtonPlusModelsTool* _tmp21_;
				ProtonPlusModelsTool* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				_tmp21_ = proton_plus_services_install_job_get_tool (job);
				_tmp22_ = _tmp21_;
				_tmp23_ = proton_plus_models_tool_get_title (_tmp22_);
				_tmp24_ = _tmp23_;
				g_warning ("standard-archive-workflow.vala:307: Latest release for %s has no downl" \
"oad URL for installed variant %s", _tmp24_, variant_id);
				result = PROTON_PLUS_RETURN_CODE_INVALID_DATA;
				_g_object_unref0 (variant);
				return result;
			}
			_tmp25_ = variant;
			_tmp26_ = proton_plus_models_variant_get_name (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp28_ = variant;
			_tmp29_ = proton_plus_models_variant_resolved_asset (_tmp28_);
			_tmp30_ = _tmp29_;
			_tmp31_ = variant;
			_tmp32_ = proton_plus_models_variant_get_id (_tmp31_);
			_tmp33_ = _tmp32_;
			proton_plus_services_install_job_set_selected_variant (job, _tmp27_, _tmp30_, _tmp33_);
			_g_object_unref0 (_tmp30_);
			result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
			_g_object_unref0 (variant);
			return result;
		}
	}
	_tmp34_ = proton_plus_services_install_job_get_tool (job);
	_tmp35_ = _tmp34_;
	_tmp36_ = proton_plus_models_tool_get_title (_tmp35_);
	_tmp37_ = _tmp36_;
	g_warning ("standard-archive-workflow.vala:314: Latest release for %s does not con" \
"tain installed variant %s", _tmp37_, variant_id);
	result = PROTON_PLUS_RETURN_CODE_INVALID_DATA;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_extract_nested_archive_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_free0 (_data_->source_path);
	_g_free0 (_data_->extract_path);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData, _data_);
}

static void
proton_plus_services_standard_archive_workflow_extract_nested_archive (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                       ProtonPlusServicesInstallJob* job,
                                                                       const gchar* source_path,
                                                                       const gchar* extract_path,
                                                                       GAsyncReadyCallback _callback_,
                                                                       gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	g_return_if_fail (source_path != NULL);
	g_return_if_fail (extract_path != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_extract_nested_archive_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_tmp2_ = g_strdup (source_path);
	_g_free0 (_data_->source_path);
	_data_->source_path = _tmp2_;
	_tmp3_ = g_strdup (extract_path);
	_g_free0 (_data_->extract_path);
	_data_->extract_path = _tmp3_;
	proton_plus_services_standard_archive_workflow_extract_nested_archive_co (_data_);
}

static gchar*
proton_plus_services_standard_archive_workflow_extract_nested_archive_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                              GAsyncResult* _res_)
{
	gchar* result;
	ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_extract_nested_archive_ready (GObject* source_object,
                                                                             GAsyncResult* _res_,
                                                                             gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_extract_nested_archive_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_extract_nested_archive_co (ProtonPlusServicesStandardArchiveWorkflowExtractNestedArchiveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_utils_archive_helper_get_archive_extension (_data_->source_path, TRUE);
	_data_->extension = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->extension;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = g_strdup ("");
		_data_->result = _data_->_tmp2_;
		_g_free0 (_data_->extension);
		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_->_tmp3_ = g_path_get_basename (_data_->source_path);
	_data_->archive_name = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->archive_name;
	_data_->_tmp5_ = _data_->archive_name;
	_data_->_tmp6_ = strlen (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->extension;
	_data_->_tmp9_ = strlen (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = string_substring (_data_->_tmp4_, (glong) 0, (glong) (_data_->_tmp7_ - _data_->_tmp10_));
	_g_free0 (_data_->archive_name);
	_data_->archive_name = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->archive_name;
	_data_->_tmp13_ = _data_->extension;
	_data_->_tmp14_ = proton_plus_services_install_job_get_cancellable (_data_->job);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->_state_ = 1;
	proton_plus_utils_filesystem_extract (_data_->extract_path, _data_->_tmp12_, _data_->_tmp13_, _data_->_tmp15_, proton_plus_services_standard_archive_workflow_extract_nested_archive_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp16_ = proton_plus_utils_filesystem_extract_finish (_data_->_res_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_g_object_unref0 (_data_->_tmp15_);
	_data_->result = _data_->_tmp17_;
	_g_free0 (_data_->archive_name);
	_g_free0 (_data_->extension);
	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 ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_rewrite_compatibility_tool_vdf (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                               ProtonPlusServicesInstallJob* job,
                                                                               const gchar* staged_install_path)
{
	gchar* path = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* content = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	ProtonPlusUtilsVDFVdfDocument* document = NULL;
	const gchar* _tmp6_;
	ProtonPlusUtilsVDFVdfDocument* _tmp7_;
	ProtonPlusUtilsVDFVdfDocument* _tmp8_;
	ProtonPlusUtilsVDFVdfEntry* compat_tools = NULL;
	ProtonPlusUtilsVDFVdfDocument* _tmp10_;
	ProtonPlusUtilsVDFVdfEntry* _tmp11_;
	gboolean _tmp12_ = FALSE;
	ProtonPlusUtilsVDFVdfEntry* _tmp13_;
	ProtonPlusUtilsVDFVdfEntry* tool = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp20_;
	GeeArrayList* _tmp21_;
	GeeArrayList* _tmp22_;
	gpointer _tmp23_;
	gboolean _tmp24_ = FALSE;
	gboolean _tmp25_ = FALSE;
	ProtonPlusUtilsVDFVdfEntry* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ProtonPlusUtilsVDFVdfDocument* _tmp39_;
	ProtonPlusUtilsVDFVdfEntry* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	const gchar* _tmp45_;
	ProtonPlusUtilsVDFVdfDocument* _tmp46_;
	ProtonPlusUtilsVDFVdfDocument* _tmp47_;
	ProtonPlusUtilsVDFVdfDocument* _tmp49_;
	ProtonPlusUtilsVDFVdfEntry* _tmp50_;
	gboolean _tmp51_ = FALSE;
	ProtonPlusUtilsVDFVdfEntry* _tmp52_;
	ProtonPlusUtilsVDFVdfEntry* _tmp59_;
	GeeArrayList* _tmp60_;
	GeeArrayList* _tmp61_;
	gpointer _tmp62_;
	ProtonPlusUtilsVDFVdfEntry* display_name = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp63_;
	ProtonPlusUtilsVDFVdfEntry* _tmp64_;
	gboolean _tmp65_ = FALSE;
	gboolean _tmp66_ = FALSE;
	gboolean _tmp67_ = FALSE;
	ProtonPlusUtilsVDFVdfEntry* _tmp68_;
	ProtonPlusUtilsVDFVdfDocument* _tmp82_;
	ProtonPlusUtilsVDFVdfEntry* _tmp83_;
	gchar* _tmp84_;
	gchar* _tmp85_;
	gchar* _tmp86_;
	gchar* _tmp87_;
	const gchar* _tmp88_;
	const gchar* _tmp89_;
	ProtonPlusReturnCode result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (job != NULL, 0);
	g_return_val_if_fail (staged_install_path != NULL, 0);
	_tmp0_ = g_strdup_printf ("%s/compatibilitytool.vdf", staged_install_path);
	path = _tmp0_;
	_tmp1_ = path;
	if (!g_file_test (_tmp1_, G_FILE_TEST_IS_REGULAR)) {
		result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
		_g_free0 (path);
		return result;
	}
	_tmp2_ = path;
	_tmp3_ = proton_plus_utils_filesystem_get_file_content (_tmp2_, FALSE);
	content = _tmp3_;
	_tmp4_ = content;
	if (g_strcmp0 (_tmp4_, "") == 0) {
		const gchar* _tmp5_;
		_tmp5_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp5_, "manifest is empty or unreadable");
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp6_ = content;
	_tmp7_ = proton_plus_utils_vdf_vdf_parser_parse_document (_tmp6_);
	document = _tmp7_;
	_tmp8_ = document;
	if (_tmp8_ == NULL) {
		const gchar* _tmp9_;
		_tmp9_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp9_, "manifest is not valid text VDF");
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp10_ = document;
	_tmp11_ = proton_plus_services_standard_archive_workflow_find_compat_tools (self, _tmp10_);
	compat_tools = _tmp11_;
	_tmp13_ = compat_tools;
	if (_tmp13_ == NULL) {
		_tmp12_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp14_;
		GeeArrayList* _tmp15_;
		GeeArrayList* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		_tmp14_ = compat_tools;
		_tmp15_ = proton_plus_utils_vdf_vdf_entry_get_children (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp16_);
		_tmp18_ = _tmp17_;
		_tmp12_ = _tmp18_ != 1;
	}
	if (_tmp12_) {
		const gchar* _tmp19_;
		_tmp19_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp19_, "expected exactly one compat_tools entry");
		_g_object_unref0 (compat_tools);
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp20_ = compat_tools;
	_tmp21_ = proton_plus_utils_vdf_vdf_entry_get_children (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _tmp22_, 0);
	tool = (ProtonPlusUtilsVDFVdfEntry*) _tmp23_;
	_tmp26_ = tool;
	_tmp27_ = proton_plus_utils_vdf_vdf_entry_get_key (_tmp26_);
	_tmp28_ = _tmp27_;
	if (g_strcmp0 (_tmp28_, "") == 0) {
		_tmp25_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp29_;
		gint _tmp30_;
		gint _tmp31_;
		_tmp29_ = tool;
		_tmp30_ = proton_plus_utils_vdf_vdf_entry_get_key_start (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp25_ = _tmp31_ < 0;
	}
	if (_tmp25_) {
		_tmp24_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		ProtonPlusUtilsVDFVdfEntry* _tmp35_;
		gint _tmp36_;
		gint _tmp37_;
		_tmp32_ = tool;
		_tmp33_ = proton_plus_utils_vdf_vdf_entry_get_key_end (_tmp32_);
		_tmp34_ = _tmp33_;
		_tmp35_ = tool;
		_tmp36_ = proton_plus_utils_vdf_vdf_entry_get_key_start (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp24_ = _tmp34_ < _tmp37_;
	}
	if (_tmp24_) {
		const gchar* _tmp38_;
		_tmp38_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp38_, "compatibility tool name is missing or invalid");
		_g_object_unref0 (tool);
		_g_object_unref0 (compat_tools);
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp39_ = document;
	_tmp40_ = tool;
	_tmp41_ = proton_plus_services_install_job_get_title (job);
	_tmp42_ = _tmp41_;
	_tmp43_ = _tmp42_;
	_tmp44_ = proton_plus_utils_vdf_vdf_document_replace_key (_tmp39_, _tmp40_, _tmp43_);
	_g_free0 (content);
	content = _tmp44_;
	_g_free0 (_tmp43_);
	_tmp45_ = content;
	_tmp46_ = proton_plus_utils_vdf_vdf_parser_parse_document (_tmp45_);
	_g_object_unref0 (document);
	document = _tmp46_;
	_tmp47_ = document;
	if (_tmp47_ == NULL) {
		const gchar* _tmp48_;
		_tmp48_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp48_, "renamed manifest is not valid text VDF");
		_g_object_unref0 (tool);
		_g_object_unref0 (compat_tools);
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp49_ = document;
	_tmp50_ = proton_plus_services_standard_archive_workflow_find_compat_tools (self, _tmp49_);
	_g_object_unref0 (compat_tools);
	compat_tools = _tmp50_;
	_tmp52_ = compat_tools;
	if (_tmp52_ == NULL) {
		_tmp51_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp53_;
		GeeArrayList* _tmp54_;
		GeeArrayList* _tmp55_;
		gint _tmp56_;
		gint _tmp57_;
		_tmp53_ = compat_tools;
		_tmp54_ = proton_plus_utils_vdf_vdf_entry_get_children (_tmp53_);
		_tmp55_ = _tmp54_;
		_tmp56_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp55_);
		_tmp57_ = _tmp56_;
		_tmp51_ = _tmp57_ != 1;
	}
	if (_tmp51_) {
		const gchar* _tmp58_;
		_tmp58_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp58_, "renamed manifest lost its compat_tools entry");
		_g_object_unref0 (tool);
		_g_object_unref0 (compat_tools);
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp59_ = compat_tools;
	_tmp60_ = proton_plus_utils_vdf_vdf_entry_get_children (_tmp59_);
	_tmp61_ = _tmp60_;
	_tmp62_ = gee_abstract_list_get ((GeeAbstractList*) _tmp61_, 0);
	_g_object_unref0 (tool);
	tool = (ProtonPlusUtilsVDFVdfEntry*) _tmp62_;
	_tmp63_ = tool;
	_tmp64_ = proton_plus_utils_vdf_vdf_entry_get_child (_tmp63_, "display_name");
	display_name = _tmp64_;
	_tmp68_ = display_name;
	if (_tmp68_ == NULL) {
		_tmp67_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp69_;
		const gchar* _tmp70_;
		const gchar* _tmp71_;
		_tmp69_ = display_name;
		_tmp70_ = proton_plus_utils_vdf_vdf_entry_get_value (_tmp69_);
		_tmp71_ = _tmp70_;
		_tmp67_ = _tmp71_ == NULL;
	}
	if (_tmp67_) {
		_tmp66_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp72_;
		gint _tmp73_;
		gint _tmp74_;
		_tmp72_ = display_name;
		_tmp73_ = proton_plus_utils_vdf_vdf_entry_get_value_start (_tmp72_);
		_tmp74_ = _tmp73_;
		_tmp66_ = _tmp74_ < 0;
	}
	if (_tmp66_) {
		_tmp65_ = TRUE;
	} else {
		ProtonPlusUtilsVDFVdfEntry* _tmp75_;
		gint _tmp76_;
		gint _tmp77_;
		ProtonPlusUtilsVDFVdfEntry* _tmp78_;
		gint _tmp79_;
		gint _tmp80_;
		_tmp75_ = display_name;
		_tmp76_ = proton_plus_utils_vdf_vdf_entry_get_value_end (_tmp75_);
		_tmp77_ = _tmp76_;
		_tmp78_ = display_name;
		_tmp79_ = proton_plus_utils_vdf_vdf_entry_get_value_start (_tmp78_);
		_tmp80_ = _tmp79_;
		_tmp65_ = _tmp77_ < _tmp80_;
	}
	if (_tmp65_) {
		const gchar* _tmp81_;
		_tmp81_ = path;
		result = proton_plus_services_standard_archive_workflow_manifest_failure (self, job, _tmp81_, "display_name is missing or invalid");
		_g_object_unref0 (display_name);
		_g_object_unref0 (tool);
		_g_object_unref0 (compat_tools);
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	_tmp82_ = document;
	_tmp83_ = display_name;
	_tmp84_ = proton_plus_services_install_job_get_title (job);
	_tmp85_ = _tmp84_;
	_tmp86_ = _tmp85_;
	_tmp87_ = proton_plus_utils_vdf_vdf_document_replace_value (_tmp82_, _tmp83_, _tmp86_);
	_g_free0 (content);
	content = _tmp87_;
	_g_free0 (_tmp86_);
	_tmp88_ = path;
	_tmp89_ = content;
	if (!proton_plus_utils_filesystem_modify_file (_tmp88_, _tmp89_)) {
		gchar* _tmp90_;
		gchar* _tmp91_;
		gchar* _tmp92_;
		const gchar* _tmp93_;
		_tmp90_ = proton_plus_services_install_job_get_title (job);
		_tmp91_ = _tmp90_;
		_tmp92_ = _tmp91_;
		_tmp93_ = path;
		g_warning ("standard-archive-workflow.vala:357: Could not rewrite Latest compatibi" \
"lity manifest for %s at %s: file write failed", _tmp92_, _tmp93_);
		_g_free0 (_tmp92_);
		proton_plus_services_install_job_set_error_message (job, _ ("Failed to update compatibilitytool.vdf"));
		result = PROTON_PLUS_RETURN_CODE_FILESYSTEM_ERROR;
		_g_object_unref0 (display_name);
		_g_object_unref0 (tool);
		_g_object_unref0 (compat_tools);
		_g_object_unref0 (document);
		_g_free0 (content);
		_g_free0 (path);
		return result;
	}
	result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
	_g_object_unref0 (display_name);
	_g_object_unref0 (tool);
	_g_object_unref0 (compat_tools);
	_g_object_unref0 (document);
	_g_free0 (content);
	_g_free0 (path);
	return result;
}

static ProtonPlusUtilsVDFVdfEntry*
proton_plus_services_standard_archive_workflow_find_compat_tools (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                  ProtonPlusUtilsVDFVdfDocument* document)
{
	ProtonPlusUtilsVDFVdfEntry* compat_tools = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp0_;
	ProtonPlusUtilsVDFVdfEntry* _tmp1_;
	ProtonPlusUtilsVDFVdfEntry* _tmp2_;
	ProtonPlusUtilsVDFVdfEntry* _tmp3_;
	ProtonPlusUtilsVDFVdfEntry* compatibility_tools = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp4_;
	ProtonPlusUtilsVDFVdfEntry* _tmp5_;
	ProtonPlusUtilsVDFVdfEntry* _tmp6_;
	ProtonPlusUtilsVDFVdfEntry* _tmp7_ = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp8_;
	ProtonPlusUtilsVDFVdfEntry* _tmp9_ = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp11_;
	ProtonPlusUtilsVDFVdfEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (document != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_vdf_document_get_root (document);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_utils_vdf_vdf_entry_get_child (_tmp1_, "compat_tools");
	compat_tools = _tmp2_;
	_tmp3_ = compat_tools;
	if (_tmp3_ != NULL) {
		result = compat_tools;
		return result;
	}
	_tmp4_ = proton_plus_utils_vdf_vdf_document_get_root (document);
	_tmp5_ = _tmp4_;
	_tmp6_ = proton_plus_utils_vdf_vdf_entry_get_child (_tmp5_, "compatibilitytools");
	compatibility_tools = _tmp6_;
	_tmp8_ = compatibility_tools;
	_tmp7_ = _tmp8_;
	_tmp9_ = NULL;
	if (_tmp7_ != NULL) {
		ProtonPlusUtilsVDFVdfEntry* _tmp10_;
		_tmp10_ = proton_plus_utils_vdf_vdf_entry_get_child (_tmp7_, "compat_tools");
		_g_object_unref0 (_tmp9_);
		_tmp9_ = _tmp10_;
	}
	_tmp11_ = _tmp9_;
	_tmp9_ = NULL;
	result = _tmp11_;
	_g_object_unref0 (_tmp9_);
	_g_object_unref0 (compatibility_tools);
	_g_object_unref0 (compat_tools);
	return result;
}

static ProtonPlusReturnCode
proton_plus_services_standard_archive_workflow_manifest_failure (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                 ProtonPlusServicesInstallJob* job,
                                                                 const gchar* path,
                                                                 const gchar* reason)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ProtonPlusReturnCode result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (job != NULL, 0);
	g_return_val_if_fail (path != NULL, 0);
	g_return_val_if_fail (reason != NULL, 0);
	_tmp0_ = proton_plus_services_install_job_get_title (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_warning ("standard-archive-workflow.vala:374: Could not rewrite Latest compatibi" \
"lity manifest for %s at %s: %s", _tmp2_, path, reason);
	_g_free0 (_tmp2_);
	proton_plus_services_install_job_set_error_message (job, _ ("The compatibility tool manifest is invalid or incomplete"));
	result = PROTON_PLUS_RETURN_CODE_INVALID_DATA;
	return result;
}

static gboolean
proton_plus_services_standard_archive_workflow_persist_runner_install_metadata (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                ProtonPlusServicesInstallJob* job,
                                                                                const gchar* path)
{
	ProtonPlusModelsToolsProviderTool* runner = NULL;
	ProtonPlusModelsTool* _tmp0_;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsToolsProviderTool* _tmp2_;
	ProtonPlusModelsToolsProviderTool* _tmp3_;
	ProtonPlusUtilsMetadata* metadata = NULL;
	ProtonPlusUtilsMetadata* _tmp4_;
	ProtonPlusUtilsMetadata* _tmp5_;
	ProtonPlusModelsToolsProviderTool* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	ProtonPlusUtilsMetadata* _tmp10_;
	ProtonPlusModelsToolsProviderTool* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_ = NULL;
	ProtonPlusModelsRelease* _tmp15_;
	ProtonPlusModelsRelease* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	ProtonPlusUtilsMetadata* _tmp27_;
	ProtonPlusUtilsMetadata* _tmp28_;
	ProtonPlusModelsToolsProviderTool* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	ProtonPlusUtilsMetadata* _tmp32_;
	ProtonPlusModelsToolsProviderTool* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	ProtonPlusUtilsMetadata* _tmp36_;
	ProtonPlusModelsToolsProviderTool* _tmp37_;
	ProtonPlusModelsGroup* _tmp38_;
	ProtonPlusModelsGroup* _tmp39_;
	ProtonPlusModelsLauncher* _tmp40_;
	ProtonPlusModelsLauncher* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	ProtonPlusUtilsMetadata* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	ProtonPlusUtilsMetadata* _tmp47_;
	ProtonPlusModelsRelease* _tmp48_;
	ProtonPlusModelsRelease* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	ProtonPlusUtilsMetadata* _tmp52_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (job != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = proton_plus_services_install_job_get_tool (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_tmp1_) ? ((ProtonPlusModelsToolsProviderTool*) _tmp1_) : NULL);
	runner = _tmp2_;
	_tmp3_ = runner;
	if (_tmp3_ == NULL) {
		result = FALSE;
		_g_object_unref0 (runner);
		return result;
	}
	_tmp4_ = proton_plus_utils_metadata_load (path);
	metadata = _tmp4_;
	_tmp5_ = metadata;
	_tmp6_ = runner;
	_tmp7_ = proton_plus_models_tools_provider_tool_get_endpoint (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	proton_plus_utils_metadata_set_runner_endpoint (_tmp5_, _tmp9_);
	_g_free0 (_tmp9_);
	_tmp10_ = metadata;
	_tmp11_ = runner;
	_tmp12_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) _tmp11_);
	_tmp13_ = _tmp12_;
	proton_plus_utils_metadata_set_runner_title (_tmp10_, _tmp13_);
	_tmp15_ = proton_plus_services_install_job_get_release (job);
	_tmp16_ = _tmp15_;
	_tmp17_ = proton_plus_models_release_get_source_tag (_tmp16_);
	_tmp18_ = _tmp17_;
	if (g_strcmp0 (_tmp18_, "") != 0) {
		ProtonPlusModelsRelease* _tmp19_;
		ProtonPlusModelsRelease* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		_tmp19_ = proton_plus_services_install_job_get_release (job);
		_tmp20_ = _tmp19_;
		_tmp21_ = proton_plus_models_release_get_source_tag (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp14_ = _tmp22_;
	} else {
		ProtonPlusModelsRelease* _tmp23_;
		ProtonPlusModelsRelease* _tmp24_;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		_tmp23_ = proton_plus_services_install_job_get_release (job);
		_tmp24_ = _tmp23_;
		_tmp25_ = proton_plus_models_release_get_title (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp14_ = _tmp26_;
	}
	_tmp27_ = metadata;
	proton_plus_utils_metadata_set_tag (_tmp27_, _tmp14_);
	_tmp28_ = metadata;
	_tmp29_ = runner;
	_tmp30_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) _tmp29_);
	_tmp31_ = _tmp30_;
	proton_plus_utils_metadata_set_provider_id (_tmp28_, _tmp31_);
	_tmp32_ = metadata;
	_tmp33_ = runner;
	_tmp34_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) _tmp33_);
	_tmp35_ = _tmp34_;
	proton_plus_utils_metadata_set_tool_id (_tmp32_, _tmp35_);
	_tmp36_ = metadata;
	_tmp37_ = runner;
	_tmp38_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _tmp37_);
	_tmp39_ = _tmp38_;
	_tmp40_ = proton_plus_models_group_get_launcher (_tmp39_);
	_tmp41_ = _tmp40_;
	_tmp42_ = proton_plus_models_launcher_get_tool_target_id (_tmp41_);
	_tmp43_ = _tmp42_;
	proton_plus_utils_metadata_set_launcher_id (_tmp36_, _tmp43_);
	_tmp44_ = metadata;
	_tmp45_ = proton_plus_services_install_job_selected_variant_identity (job);
	_tmp46_ = _tmp45_;
	proton_plus_utils_metadata_set_variant_id (_tmp44_, _tmp46_);
	_g_free0 (_tmp46_);
	_tmp47_ = metadata;
	_tmp48_ = proton_plus_services_install_job_get_release (job);
	_tmp49_ = _tmp48_;
	_tmp50_ = proton_plus_models_release_get_upstream_release_id (_tmp49_);
	_tmp51_ = _tmp50_;
	proton_plus_utils_metadata_set_release_id (_tmp47_, _tmp51_);
	_tmp52_ = metadata;
	result = proton_plus_utils_metadata_save (_tmp52_, path);
	_g_object_unref0 (metadata);
	_g_object_unref0 (runner);
	return result;
}

static void
proton_plus_services_standard_archive_workflow_rollback_replaced_runner_data_free (gpointer _data)
{
	ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData* _data_;
	_data_ = _data;
	_g_free0 (_data_->directory);
	_g_free0 (_data_->backup);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData, _data_);
}

static void
proton_plus_services_standard_archive_workflow_rollback_replaced_runner (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                         const gchar* directory,
                                                                         const gchar* backup,
                                                                         GAsyncReadyCallback _callback_,
                                                                         gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData* _data_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (directory != NULL);
	g_return_if_fail (backup != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_standard_archive_workflow_rollback_replaced_runner_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (directory);
	_g_free0 (_data_->directory);
	_data_->directory = _tmp1_;
	_tmp2_ = g_strdup (backup);
	_g_free0 (_data_->backup);
	_data_->backup = _tmp2_;
	proton_plus_services_standard_archive_workflow_rollback_replaced_runner_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_rollback_replaced_runner_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_standard_archive_workflow_rollback_replaced_runner_ready (GObject* source_object,
                                                                               GAsyncResult* _res_,
                                                                               gpointer _user_data_)
{
	ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_standard_archive_workflow_rollback_replaced_runner_co (_data_);
}

static gboolean
proton_plus_services_standard_archive_workflow_rollback_replaced_runner_co (ProtonPlusServicesStandardArchiveWorkflowRollbackReplacedRunnerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup_printf ("%s.failed", _data_->backup);
	_data_->failed = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->failed;
	_data_->_state_ = 1;
	proton_plus_utils_filesystem_move_directory_atomic (_data_->directory, _data_->_tmp1_, proton_plus_services_standard_archive_workflow_rollback_replaced_runner_ready, _data_);
	return FALSE;
	_state_1:
	if (!proton_plus_utils_filesystem_move_directory_atomic_finish (_data_->_res_)) {
		_data_->result = FALSE;
		_g_free0 (_data_->failed);
		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_->_state_ = 2;
	proton_plus_utils_filesystem_move_directory_atomic (_data_->backup, _data_->directory, proton_plus_services_standard_archive_workflow_rollback_replaced_runner_ready, _data_);
	return FALSE;
	_state_2:
	if (!proton_plus_utils_filesystem_move_directory_atomic_finish (_data_->_res_)) {
		_data_->_tmp2_ = _data_->failed;
		_data_->_state_ = 3;
		proton_plus_utils_filesystem_move_directory_atomic (_data_->_tmp2_, _data_->directory, proton_plus_services_standard_archive_workflow_rollback_replaced_runner_ready, _data_);
		return FALSE;
		_state_3:
		proton_plus_utils_filesystem_move_directory_atomic_finish (_data_->_res_);
		_data_->result = FALSE;
		_g_free0 (_data_->failed);
		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_->_tmp3_ = _data_->failed;
	_data_->_state_ = 4;
	proton_plus_utils_filesystem_delete_directory (_data_->_tmp3_, proton_plus_services_standard_archive_workflow_rollback_replaced_runner_ready, _data_);
	return FALSE;
	_state_4:
	_data_->result = proton_plus_utils_filesystem_delete_directory_finish (_data_->_res_);
	_g_free0 (_data_->failed);
	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 gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gboolean
proton_plus_services_standard_archive_workflow_release_matches_installed_version (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                  ProtonPlusModelsRelease* release,
                                                                                  const gchar* version_content,
                                                                                  const gchar* proton_content)
{
	gchar** parts = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint parts_length1;
	gint _parts_size_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar* version_title = NULL;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* start_word = NULL;
	gchar* _tmp6_;
	gint start = 0;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gint end = 0;
	gchar* proton_title = NULL;
	gchar* _tmp11_;
	const gchar* _tmp12_ = NULL;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* title = NULL;
	gchar* _tmp19_;
	gboolean _tmp20_ = FALSE;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (release != NULL, FALSE);
	g_return_val_if_fail (version_content != NULL, FALSE);
	g_return_val_if_fail (proton_content != NULL, FALSE);
	_tmp1_ = _tmp0_ = g_strsplit (version_content, " ", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = parts_length1;
	_tmp2_ = parts;
	_tmp2__length1 = parts_length1;
	if (_tmp2__length1 < 2) {
		result = FALSE;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp3_ = parts;
	_tmp3__length1 = parts_length1;
	_tmp4_ = _tmp3_[1];
	_tmp5_ = string_strip (_tmp4_);
	version_title = _tmp5_;
	_tmp6_ = g_strdup ("CURRENT_PREFIX_VERSION=\"");
	start_word = _tmp6_;
	_tmp7_ = start_word;
	start = string_index_of (proton_content, _tmp7_, 0);
	if (start == -1) {
		result = FALSE;
		_g_free0 (start_word);
		_g_free0 (version_title);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp8_ = start_word;
	_tmp9_ = strlen (_tmp8_);
	_tmp10_ = _tmp9_;
	start += _tmp10_;
	end = string_index_of (proton_content, "\"", start);
	if (end == -1) {
		result = FALSE;
		_g_free0 (start_word);
		_g_free0 (version_title);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp11_ = string_substring (proton_content, (glong) start, (glong) (end - start));
	proton_title = _tmp11_;
	_tmp13_ = proton_plus_models_release_get_source_tag (release);
	_tmp14_ = _tmp13_;
	if (g_strcmp0 (_tmp14_, "") != 0) {
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp15_ = proton_plus_models_release_get_source_tag (release);
		_tmp16_ = _tmp15_;
		_tmp12_ = _tmp16_;
	} else {
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		_tmp17_ = proton_plus_models_release_get_title (release);
		_tmp18_ = _tmp17_;
		_tmp12_ = _tmp18_;
	}
	_tmp19_ = g_strdup (_tmp12_);
	title = _tmp19_;
	_tmp21_ = title;
	_tmp22_ = version_title;
	if (g_strcmp0 (_tmp21_, _tmp22_) == 0) {
		_tmp20_ = TRUE;
	} else {
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		_tmp23_ = title;
		_tmp24_ = proton_title;
		_tmp20_ = g_strcmp0 (_tmp23_, _tmp24_) == 0;
	}
	result = _tmp20_;
	_g_free0 (title);
	_g_free0 (proton_title);
	_g_free0 (start_word);
	_g_free0 (version_title);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gboolean
proton_plus_services_standard_archive_workflow_persist_runner_identity (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                        ProtonPlusUtilsMetadata* metadata,
                                                                        ProtonPlusModelsToolsProviderTool* runner,
                                                                        const gchar* directory,
                                                                        const gchar* tag,
                                                                        const gchar* release_id)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	ProtonPlusModelsGroup* _tmp9_;
	ProtonPlusModelsGroup* _tmp10_;
	ProtonPlusModelsLauncher* _tmp11_;
	ProtonPlusModelsLauncher* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (metadata != NULL, FALSE);
	g_return_val_if_fail (runner != NULL, FALSE);
	g_return_val_if_fail (directory != NULL, FALSE);
	g_return_val_if_fail (tag != NULL, FALSE);
	g_return_val_if_fail (release_id != NULL, FALSE);
	_tmp0_ = proton_plus_models_tools_provider_tool_get_endpoint (runner);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	proton_plus_utils_metadata_set_runner_endpoint (metadata, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) runner);
	_tmp4_ = _tmp3_;
	proton_plus_utils_metadata_set_runner_title (metadata, _tmp4_);
	_tmp5_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) runner);
	_tmp6_ = _tmp5_;
	proton_plus_utils_metadata_set_provider_id (metadata, _tmp6_);
	_tmp7_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) runner);
	_tmp8_ = _tmp7_;
	proton_plus_utils_metadata_set_tool_id (metadata, _tmp8_);
	_tmp9_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) runner);
	_tmp10_ = _tmp9_;
	_tmp11_ = proton_plus_models_group_get_launcher (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = proton_plus_models_launcher_get_tool_target_id (_tmp12_);
	_tmp14_ = _tmp13_;
	proton_plus_utils_metadata_set_launcher_id (metadata, _tmp14_);
	if (g_strcmp0 (tag, "") != 0) {
		proton_plus_utils_metadata_set_tag (metadata, tag);
	}
	if (g_strcmp0 (release_id, "") != 0) {
		proton_plus_utils_metadata_set_release_id (metadata, release_id);
	}
	result = proton_plus_utils_metadata_save (metadata, directory);
	return result;
}

ProtonPlusServicesStandardArchiveWorkflow*
proton_plus_services_standard_archive_workflow_construct (GType object_type)
{
	ProtonPlusServicesStandardArchiveWorkflow * self = NULL;
	self = (ProtonPlusServicesStandardArchiveWorkflow*) proton_plus_services_installation_workflow_construct (object_type);
	return self;
}

ProtonPlusServicesStandardArchiveWorkflow*
proton_plus_services_standard_archive_workflow_new (void)
{
	return proton_plus_services_standard_archive_workflow_construct (PROTON_PLUS_SERVICES_TYPE_STANDARD_ARCHIVE_WORKFLOW);
}

static void
proton_plus_services_standard_archive_workflow_class_init (ProtonPlusServicesStandardArchiveWorkflowClass * klass,
                                                           gpointer klass_data)
{
	proton_plus_services_standard_archive_workflow_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusServicesStandardArchiveWorkflow_private_offset);
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->validate_install = (ProtonPlusReturnCode (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*, gboolean)) proton_plus_services_standard_archive_workflow_real_validate_install;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->install = (void (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*, gboolean, GAsyncReadyCallback, gpointer)) proton_plus_services_standard_archive_workflow_real_install;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->install_finish = (ProtonPlusReturnCode (*) (ProtonPlusServicesInstallationWorkflow*, GAsyncResult*)) proton_plus_services_standard_archive_workflow_install_finish;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->update = (void (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*, ProtonPlusServicesInstallationOperationCoordinator*, GAsyncReadyCallback, gpointer)) proton_plus_services_standard_archive_workflow_real_update;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->update_finish = (ProtonPlusReturnCode (*) (ProtonPlusServicesInstallationWorkflow*, GAsyncResult*)) proton_plus_services_standard_archive_workflow_update_finish;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->remove = (void (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*, GAsyncReadyCallback, gpointer)) proton_plus_services_standard_archive_workflow_real_remove;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->remove_finish = (ProtonPlusReturnCode (*) (ProtonPlusServicesInstallationWorkflow*, GAsyncResult*)) proton_plus_services_standard_archive_workflow_remove_finish;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->refresh_state = (void (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*)) proton_plus_services_standard_archive_workflow_real_refresh_state;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->finalize_install_success = (void (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*)) proton_plus_services_standard_archive_workflow_real_finalize_install_success;
	((ProtonPlusServicesInstallationWorkflowClass *) klass)->finalize_removal_success = (void (*) (ProtonPlusServicesInstallationWorkflow*, ProtonPlusServicesInstallJob*)) proton_plus_services_standard_archive_workflow_real_finalize_removal_success;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_services_standard_archive_workflow_finalize;
}

static void
proton_plus_services_standard_archive_workflow_instance_init (ProtonPlusServicesStandardArchiveWorkflow * self,
                                                              gpointer klass)
{
	ProtonPlusServicesArchiveWorkflowSupport* _tmp0_;
	self->priv = proton_plus_services_standard_archive_workflow_get_instance_private (self);
	_tmp0_ = proton_plus_services_archive_workflow_support_new ();
	self->priv->archive_support = _tmp0_;
}

static void
proton_plus_services_standard_archive_workflow_finalize (GObject * obj)
{
	ProtonPlusServicesStandardArchiveWorkflow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_SERVICES_TYPE_STANDARD_ARCHIVE_WORKFLOW, ProtonPlusServicesStandardArchiveWorkflow);
	_g_object_unref0 (self->priv->archive_support);
	G_OBJECT_CLASS (proton_plus_services_standard_archive_workflow_parent_class)->finalize (obj);
}

static GType
proton_plus_services_standard_archive_workflow_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesStandardArchiveWorkflowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_standard_archive_workflow_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesStandardArchiveWorkflow), 0, (GInstanceInitFunc) proton_plus_services_standard_archive_workflow_instance_init, NULL };
	GType proton_plus_services_standard_archive_workflow_type_id;
	proton_plus_services_standard_archive_workflow_type_id = g_type_register_static (PROTON_PLUS_SERVICES_TYPE_INSTALLATION_WORKFLOW, "ProtonPlusServicesStandardArchiveWorkflow", &g_define_type_info, 0);
	ProtonPlusServicesStandardArchiveWorkflow_private_offset = g_type_add_instance_private (proton_plus_services_standard_archive_workflow_type_id, sizeof (ProtonPlusServicesStandardArchiveWorkflowPrivate));
	return proton_plus_services_standard_archive_workflow_type_id;
}

GType
proton_plus_services_standard_archive_workflow_get_type (void)
{
	static volatile gsize proton_plus_services_standard_archive_workflow_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_standard_archive_workflow_type_id__once)) {
		GType proton_plus_services_standard_archive_workflow_type_id;
		proton_plus_services_standard_archive_workflow_type_id = proton_plus_services_standard_archive_workflow_get_type_once ();
		g_once_init_leave (&proton_plus_services_standard_archive_workflow_type_id__once, proton_plus_services_standard_archive_workflow_type_id);
	}
	return proton_plus_services_standard_archive_workflow_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;
}

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

