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

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <utils/cpu-probe.h>
#include <sys/utsname.h>
#include <gobject/gvaluecollector.h>

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

enum  {
	PROTON_PLUS_UTILS_COMMAND_RESULT_0_PROPERTY,
	PROTON_PLUS_UTILS_COMMAND_RESULT_STDOUT_PROPERTY,
	PROTON_PLUS_UTILS_COMMAND_RESULT_STDERR_PROPERTY,
	PROTON_PLUS_UTILS_COMMAND_RESULT_EXIT_STATUS_PROPERTY,
	PROTON_PLUS_UTILS_COMMAND_RESULT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND (proton_plus_utils_host_systemctl_backend_get_type ())
#define PROTON_PLUS_UTILS_HOST_SYSTEMCTL_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND, ProtonPlusUtilsHostSystemctlBackend))
#define PROTON_PLUS_UTILS_HOST_SYSTEMCTL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND, ProtonPlusUtilsHostSystemctlBackendClass))
#define PROTON_PLUS_UTILS_IS_HOST_SYSTEMCTL_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND))
#define PROTON_PLUS_UTILS_IS_HOST_SYSTEMCTL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND))
#define PROTON_PLUS_UTILS_HOST_SYSTEMCTL_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND, ProtonPlusUtilsHostSystemctlBackendClass))

typedef struct _ProtonPlusUtilsHostSystemctlBackend ProtonPlusUtilsHostSystemctlBackend;
typedef struct _ProtonPlusUtilsHostSystemctlBackendClass ProtonPlusUtilsHostSystemctlBackendClass;
typedef struct _ProtonPlusUtilsHostSystemctlBackendPrivate ProtonPlusUtilsHostSystemctlBackendPrivate;
enum  {
	PROTON_PLUS_UTILS_HOST_SYSTEMCTL_BACKEND_0_PROPERTY,
	PROTON_PLUS_UTILS_HOST_SYSTEMCTL_BACKEND_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_host_systemctl_backend_properties[PROTON_PLUS_UTILS_HOST_SYSTEMCTL_BACKEND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ProtonPlusUtilsHostSystemctlBackendRunData ProtonPlusUtilsHostSystemctlBackendRunData;
enum  {
	PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_0_PROPERTY,
	PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_systemd_timer_manager_properties[PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_NUM_PROPERTIES];
typedef struct _ProtonPlusUtilsSystemdTimerManagerReconcileData ProtonPlusUtilsSystemdTimerManagerReconcileData;
typedef struct _ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ProtonPlusUtilsSystemdTimerManagerRunActionData ProtonPlusUtilsSystemdTimerManagerRunActionData;
typedef struct _ProtonPlusCpuFeatureProbe ProtonPlusCpuFeatureProbe;
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _ProtonPlusUtilsSystemRunCommandData ProtonPlusUtilsSystemRunCommandData;
typedef struct _ProtonPlusUtilsSystemCheckDependencyData ProtonPlusUtilsSystemCheckDependencyData;
typedef struct _ProtonPlusUtilsSystemDetectGpuVendorData ProtonPlusUtilsSystemDetectGpuVendorData;
typedef struct _ProtonPlusUtilsSystemUpdateSystemdFilesData ProtonPlusUtilsSystemUpdateSystemdFilesData;
typedef struct _ProtonPlusUtilsParamSpecSystem ProtonPlusUtilsParamSpecSystem;

struct _ProtonPlusUtilsCommandResultPrivate {
	gchar* _stdout;
	gchar* _stderr;
	gint _exit_status;
};

struct _ProtonPlusUtilsHostSystemctlBackend {
	GObject parent_instance;
	ProtonPlusUtilsHostSystemctlBackendPrivate * priv;
};

struct _ProtonPlusUtilsHostSystemctlBackendClass {
	GObjectClass parent_class;
};

struct _ProtonPlusUtilsHostSystemctlBackendRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusUtilsHostSystemctlBackend* self;
	gchar* arguments;
	ProtonPlusUtilsCommandResult* result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	ProtonPlusUtilsCommandResult* _tmp2_;
	ProtonPlusUtilsCommandResult* _tmp3_;
};

struct _ProtonPlusUtilsSystemdTimerManagerPrivate {
	ProtonPlusUtilsSystemctlBackend* backend;
	gchar* systemd_dir;
	gchar* service_template;
	gchar* timer_template;
	gchar* exec_start;
};

struct _ProtonPlusUtilsSystemdTimerManagerReconcileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusUtilsSystemdTimerManager* self;
	gboolean check_on_boot;
	gboolean background_updates;
	gint frequency;
	gboolean result;
	gboolean _tmp0_;
	gboolean files_changed;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean enabled;
	ProtonPlusUtilsSystemctlBackend* _tmp4_;
	ProtonPlusUtilsCommandResult* _tmp5_;
	ProtonPlusUtilsCommandResult* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gboolean _tmp9_;
	gboolean active;
	ProtonPlusUtilsSystemctlBackend* _tmp10_;
	ProtonPlusUtilsCommandResult* _tmp11_;
	ProtonPlusUtilsCommandResult* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
};

struct _ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusUtilsSystemdTimerManager* self;
	gboolean result;
	gboolean files_present;
	gboolean enabled;
	ProtonPlusUtilsSystemctlBackend* _tmp0_;
	ProtonPlusUtilsCommandResult* _tmp1_;
	ProtonPlusUtilsCommandResult* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	gboolean active;
	ProtonPlusUtilsSystemctlBackend* _tmp6_;
	ProtonPlusUtilsCommandResult* _tmp7_;
	ProtonPlusUtilsCommandResult* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gboolean files_removed;
	gboolean _tmp15_;
	gboolean _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
};

struct _ProtonPlusUtilsSystemdTimerManagerRunActionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusUtilsSystemdTimerManager* self;
	gchar* arguments;
	gboolean result;
	gchar* command;
	gchar* _tmp0_;
	ProtonPlusUtilsCommandResult* _result_;
	ProtonPlusUtilsSystemctlBackend* _tmp1_;
	ProtonPlusUtilsCommandResult* _tmp2_;
	ProtonPlusUtilsCommandResult* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gchar* error_output;
	ProtonPlusUtilsCommandResult* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	ProtonPlusUtilsCommandResult* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	ProtonPlusUtilsCommandResult* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	const gchar* _tmp21_;
};

struct _ProtonPlusCpuFeatureProbe {
	gboolean available;
	gboolean cmpxchg16b;
	gboolean lahf_sahf;
	gboolean popcnt;
	gboolean sse3;
	gboolean sse4_1;
	gboolean sse4_2;
	gboolean ssse3;
	gboolean avx;
	gboolean avx2;
	gboolean bmi1;
	gboolean bmi2;
	gboolean f16c;
	gboolean fma;
	gboolean lzcnt;
	gboolean movbe;
	gboolean osxsave;
	gboolean xcr0_xmm;
	gboolean xcr0_ymm;
	gboolean avx512f;
	gboolean avx512bw;
	gboolean avx512cd;
	gboolean avx512dq;
	gboolean avx512vl;
	gboolean xcr0_opmask;
	gboolean xcr0_zmm_hi256;
	gboolean xcr0_hi16_zmm;
	gboolean aarch64_crc32;
	gboolean aarch64_lse_atomics;
	gboolean aarch64_rdma;
};

struct _ProtonPlusUtilsSystemRunCommandData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* command;
	ProtonPlusUtilsCommandResult* result;
	gchar** argv;
	gint _tmp0_;
	gchar** _tmp1_;
	gint argv_length1;
	gint _argv_size_;
	GSubprocess* subprocess;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GSubprocess* _tmp3_;
	GBytes* stdout_bytes;
	GBytes* stderr_bytes;
	GSubprocess* _tmp4_;
	GBytes* _tmp5_;
	GBytes* _tmp6_;
	gchar* _tmp7_;
	GBytes* _tmp8_;
	GBytes* _tmp9_;
	gsize _tmp10_;
	guint8* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* stdout;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GBytes* _tmp16_;
	GBytes* _tmp17_;
	gsize _tmp18_;
	guint8* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* stderr;
	gchar* _tmp22_;
	gint _tmp23_;
	GSubprocess* _tmp24_;
	GSubprocess* _tmp25_;
	gint exit_status;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	ProtonPlusUtilsCommandResult* _tmp28_;
	GError* e;
	GError* _tmp29_;
	const gchar* _tmp30_;
	GError* _tmp31_;
	const gchar* _tmp32_;
	ProtonPlusUtilsCommandResult* _tmp33_;
	GError* _inner_error0_;
};

struct _ProtonPlusUtilsSystemCheckDependencyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* name;
	gboolean result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	gchar* output;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	ProtonPlusUtilsCommandResult* _tmp7_;
	ProtonPlusUtilsCommandResult* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gboolean _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
};

struct _ProtonPlusUtilsSystemDetectGpuVendorData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusUtilsGpuVendor result;
	ProtonPlusUtilsCommandResult* _result_;
	ProtonPlusUtilsCommandResult* _tmp0_;
	ProtonPlusUtilsCommandResult* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	ProtonPlusUtilsCommandResult* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
};

struct _ProtonPlusUtilsSystemUpdateSystemdFilesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gboolean _tmp0_;
	ProtonPlusUtilsSystemdTimerManager* manager;
	ProtonPlusUtilsSystemdTimerManager* _tmp1_;
	ProtonPlusUtilsSystemdTimerManager* _tmp2_;
	ProtonPlusUtilsSystemdTimerManager* _tmp3_;
	GSettings* _tmp4_;
	GSettings* _tmp5_;
	GSettings* _tmp6_;
};

struct _ProtonPlusUtilsParamSpecSystem {
	GParamSpec parent_instance;
};

static gint ProtonPlusUtilsCommandResult_private_offset;
static gpointer proton_plus_utils_command_result_parent_class = NULL;
static gpointer proton_plus_utils_host_systemctl_backend_parent_class = NULL;
static ProtonPlusUtilsSystemctlBackendIface * proton_plus_utils_host_systemctl_backend_proton_plus_utils_systemctl_backend_parent_iface = NULL;
static gint ProtonPlusUtilsSystemdTimerManager_private_offset;
static gpointer proton_plus_utils_systemd_timer_manager_parent_class = NULL;
static gpointer proton_plus_utils_system_parent_class = NULL;
static gboolean proton_plus_utils_system_systemd_update_running;
static gboolean proton_plus_utils_system_systemd_update_running = FALSE;
static gboolean proton_plus_utils_system_systemd_update_pending;
static gboolean proton_plus_utils_system_systemd_update_pending = FALSE;
static ProtonPlusUtilsSystemdTimerManager* proton_plus_utils_system_systemd_timer_manager;
static ProtonPlusUtilsSystemdTimerManager* proton_plus_utils_system_systemd_timer_manager = NULL;

static void proton_plus_utils_command_result_set_stdout (ProtonPlusUtilsCommandResult* self,
                                                  const gchar* value);
static void proton_plus_utils_command_result_set_stderr (ProtonPlusUtilsCommandResult* self,
                                                  const gchar* value);
static void proton_plus_utils_command_result_set_exit_status (ProtonPlusUtilsCommandResult* self,
                                                       gint value);
static void proton_plus_utils_command_result_finalize (GObject * obj);
static GType proton_plus_utils_command_result_get_type_once (void);
static void _vala_proton_plus_utils_command_result_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_proton_plus_utils_command_result_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
static GType proton_plus_utils_systemctl_backend_get_type_once (void);
VALA_EXTERN GType proton_plus_utils_host_systemctl_backend_get_type (void) G_GNUC_CONST ;
static void proton_plus_utils_host_systemctl_backend_real_run_data_free (gpointer _data);
static void proton_plus_utils_host_systemctl_backend_real_run (ProtonPlusUtilsSystemctlBackend* base,
                                                        const gchar* arguments,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
static gboolean proton_plus_utils_host_systemctl_backend_real_run_co (ProtonPlusUtilsHostSystemctlBackendRunData* _data_);
static void proton_plus_utils_host_systemctl_backend_run_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_);
VALA_EXTERN ProtonPlusUtilsHostSystemctlBackend* proton_plus_utils_host_systemctl_backend_new (void);
VALA_EXTERN ProtonPlusUtilsHostSystemctlBackend* proton_plus_utils_host_systemctl_backend_construct (GType object_type);
static GType proton_plus_utils_host_systemctl_backend_get_type_once (void);
static void proton_plus_utils_systemd_timer_manager_reconcile_data_free (gpointer _data);
static gboolean proton_plus_utils_systemd_timer_manager_reconcile_co (ProtonPlusUtilsSystemdTimerManagerReconcileData* _data_);
static void proton_plus_utils_systemd_timer_manager_reconcile_disabled (ProtonPlusUtilsSystemdTimerManager* self,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_);
static gboolean proton_plus_utils_systemd_timer_manager_reconcile_disabled_finish (ProtonPlusUtilsSystemdTimerManager* self,
                                                                            GAsyncResult* _res_);
static void proton_plus_utils_systemd_timer_manager_reconcile_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
static gboolean proton_plus_utils_systemd_timer_manager_write_unit_files (ProtonPlusUtilsSystemdTimerManager* self,
                                                                   gboolean check_on_boot,
                                                                   gboolean background_updates,
                                                                   gint frequency,
                                                                   gboolean* files_changed);
static void proton_plus_utils_systemd_timer_manager_run_action (ProtonPlusUtilsSystemdTimerManager* self,
                                                         const gchar* arguments,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static gboolean proton_plus_utils_systemd_timer_manager_run_action_finish (ProtonPlusUtilsSystemdTimerManager* self,
                                                                    GAsyncResult* _res_);
static void proton_plus_utils_systemd_timer_manager_reconcile_disabled_data_free (gpointer _data);
static gboolean proton_plus_utils_systemd_timer_manager_reconcile_disabled_co (ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData* _data_);
static gboolean proton_plus_utils_systemd_timer_manager_unit_files_exist (ProtonPlusUtilsSystemdTimerManager* self);
static void proton_plus_utils_systemd_timer_manager_reconcile_disabled_ready (GObject* source_object,
                                                                       GAsyncResult* _res_,
                                                                       gpointer _user_data_);
static gboolean proton_plus_utils_systemd_timer_manager_remove_unit_files (ProtonPlusUtilsSystemdTimerManager* self,
                                                                    gboolean* files_removed);
static gboolean proton_plus_utils_systemd_timer_manager_write_if_changed (ProtonPlusUtilsSystemdTimerManager* self,
                                                                   const gchar* path,
                                                                   const gchar* contents,
                                                                   GError** error);
static void proton_plus_utils_systemd_timer_manager_run_action_data_free (gpointer _data);
static gboolean proton_plus_utils_systemd_timer_manager_run_action_co (ProtonPlusUtilsSystemdTimerManagerRunActionData* _data_);
static void proton_plus_utils_systemd_timer_manager_run_action_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_);
static void proton_plus_utils_systemd_timer_manager_finalize (GObject * obj);
static GType proton_plus_utils_systemd_timer_manager_get_type_once (void);
static ProtonPlusCpuFeatureProbe* proton_plus_utils_system_cpu_feature_probe_dup (const ProtonPlusCpuFeatureProbe* self);
static void proton_plus_utils_system_cpu_feature_probe_free (ProtonPlusCpuFeatureProbe* self);
static void proton_plus_utils_system_run_command_data_free (gpointer _data);
static gboolean proton_plus_utils_system_run_command_co (ProtonPlusUtilsSystemRunCommandData* _data_);
static gchar** proton_plus_utils_system_get_command_argv (const gchar* command,
                                                   gint* result_length1,
                                                   GError** error);
static void proton_plus_utils_system_run_command_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static ProtonPlusModelsX86_64Features* proton_plus_utils_system_get_x86_64_features (ProtonPlusCpuFeatureProbe* probe);
static ProtonPlusModelsAarch64Features* proton_plus_utils_system_get_aarch64_features (ProtonPlusCpuFeatureProbe* probe);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
static void proton_plus_utils_system_check_dependency_data_free (gpointer _data);
static gboolean proton_plus_utils_system_check_dependency_co (ProtonPlusUtilsSystemCheckDependencyData* _data_);
static void proton_plus_utils_system_check_dependency_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static void proton_plus_utils_system_detect_gpu_vendor_data_free (gpointer _data);
static gboolean proton_plus_utils_system_detect_gpu_vendor_co (ProtonPlusUtilsSystemDetectGpuVendorData* _data_);
static void proton_plus_utils_system_detect_gpu_vendor_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
static void __lambda10_ (GObject* obj,
                  GAsyncResult* res);
static void ___lambda10__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void proton_plus_utils_system_update_systemd_files (GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static void proton_plus_utils_system_update_systemd_files_finish (GAsyncResult* _res_);
static void proton_plus_utils_system_update_systemd_files_data_free (gpointer _data);
static gboolean proton_plus_utils_system_update_systemd_files_co (ProtonPlusUtilsSystemUpdateSystemdFilesData* _data_);
static ProtonPlusUtilsSystemdTimerManager* proton_plus_utils_system_get_systemd_timer_manager (void);
static void proton_plus_utils_system_update_systemd_files_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
static void proton_plus_utils_system_finalize (ProtonPlusUtilsSystem * obj);
static GType proton_plus_utils_system_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 GType
proton_plus_utils_gpu_vendor_get_type_once (void)
{
	static const GEnumValue values[] = {{PROTON_PLUS_UTILS_GPU_VENDOR_UNKNOWN, "PROTON_PLUS_UTILS_GPU_VENDOR_UNKNOWN", "unknown"}, {PROTON_PLUS_UTILS_GPU_VENDOR_AMD, "PROTON_PLUS_UTILS_GPU_VENDOR_AMD", "amd"}, {PROTON_PLUS_UTILS_GPU_VENDOR_NVIDIA, "PROTON_PLUS_UTILS_GPU_VENDOR_NVIDIA", "nvidia"}, {PROTON_PLUS_UTILS_GPU_VENDOR_INTEL, "PROTON_PLUS_UTILS_GPU_VENDOR_INTEL", "intel"}, {0, NULL, NULL}};
	GType proton_plus_utils_gpu_vendor_type_id;
	proton_plus_utils_gpu_vendor_type_id = g_enum_register_static ("ProtonPlusUtilsGpuVendor", values);
	return proton_plus_utils_gpu_vendor_type_id;
}

GType
proton_plus_utils_gpu_vendor_get_type (void)
{
	static volatile gsize proton_plus_utils_gpu_vendor_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_gpu_vendor_type_id__once)) {
		GType proton_plus_utils_gpu_vendor_type_id;
		proton_plus_utils_gpu_vendor_type_id = proton_plus_utils_gpu_vendor_get_type_once ();
		g_once_init_leave (&proton_plus_utils_gpu_vendor_type_id__once, proton_plus_utils_gpu_vendor_type_id);
	}
	return proton_plus_utils_gpu_vendor_type_id__once;
}

static inline gpointer
proton_plus_utils_command_result_get_instance_private (ProtonPlusUtilsCommandResult* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsCommandResult_private_offset);
}

ProtonPlusUtilsCommandResult*
proton_plus_utils_command_result_construct (GType object_type,
                                            const gchar* stdout,
                                            const gchar* stderr,
                                            gint exit_status)
{
	ProtonPlusUtilsCommandResult * self = NULL;
	g_return_val_if_fail (stdout != NULL, NULL);
	g_return_val_if_fail (stderr != NULL, NULL);
	self = (ProtonPlusUtilsCommandResult*) g_object_new (object_type, NULL);
	proton_plus_utils_command_result_set_stdout (self, stdout);
	proton_plus_utils_command_result_set_stderr (self, stderr);
	proton_plus_utils_command_result_set_exit_status (self, exit_status);
	return self;
}

ProtonPlusUtilsCommandResult*
proton_plus_utils_command_result_new (const gchar* stdout,
                                      const gchar* stderr,
                                      gint exit_status)
{
	return proton_plus_utils_command_result_construct (PROTON_PLUS_UTILS_TYPE_COMMAND_RESULT, stdout, stderr, exit_status);
}

const gchar*
proton_plus_utils_command_result_get_stdout (ProtonPlusUtilsCommandResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stdout;
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_command_result_set_stdout (ProtonPlusUtilsCommandResult* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_command_result_get_stdout (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_stdout);
		self->priv->_stdout = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_STDOUT_PROPERTY]);
	}
}

const gchar*
proton_plus_utils_command_result_get_stderr (ProtonPlusUtilsCommandResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stderr;
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_command_result_set_stderr (ProtonPlusUtilsCommandResult* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_command_result_get_stderr (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_stderr);
		self->priv->_stderr = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_STDERR_PROPERTY]);
	}
}

gint
proton_plus_utils_command_result_get_exit_status (ProtonPlusUtilsCommandResult* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_exit_status;
	return result;
}

static void
proton_plus_utils_command_result_set_exit_status (ProtonPlusUtilsCommandResult* self,
                                                  gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_command_result_get_exit_status (self);
	if (old_value != value) {
		self->priv->_exit_status = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_EXIT_STATUS_PROPERTY]);
	}
}

static void
proton_plus_utils_command_result_class_init (ProtonPlusUtilsCommandResultClass * klass,
                                             gpointer klass_data)
{
	proton_plus_utils_command_result_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsCommandResult_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_command_result_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_utils_command_result_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_command_result_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_COMMAND_RESULT_STDOUT_PROPERTY, proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_STDOUT_PROPERTY] = g_param_spec_string ("stdout", "stdout", "stdout", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_COMMAND_RESULT_STDERR_PROPERTY, proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_STDERR_PROPERTY] = g_param_spec_string ("stderr", "stderr", "stderr", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_COMMAND_RESULT_EXIT_STATUS_PROPERTY, proton_plus_utils_command_result_properties[PROTON_PLUS_UTILS_COMMAND_RESULT_EXIT_STATUS_PROPERTY] = g_param_spec_int ("exit-status", "exit-status", "exit-status", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_utils_command_result_instance_init (ProtonPlusUtilsCommandResult * self,
                                                gpointer klass)
{
	self->priv = proton_plus_utils_command_result_get_instance_private (self);
}

static void
proton_plus_utils_command_result_finalize (GObject * obj)
{
	ProtonPlusUtilsCommandResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_COMMAND_RESULT, ProtonPlusUtilsCommandResult);
	_g_free0 (self->priv->_stdout);
	_g_free0 (self->priv->_stderr);
	G_OBJECT_CLASS (proton_plus_utils_command_result_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_command_result_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsCommandResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_command_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsCommandResult), 0, (GInstanceInitFunc) proton_plus_utils_command_result_instance_init, NULL };
	GType proton_plus_utils_command_result_type_id;
	proton_plus_utils_command_result_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsCommandResult", &g_define_type_info, 0);
	ProtonPlusUtilsCommandResult_private_offset = g_type_add_instance_private (proton_plus_utils_command_result_type_id, sizeof (ProtonPlusUtilsCommandResultPrivate));
	return proton_plus_utils_command_result_type_id;
}

GType
proton_plus_utils_command_result_get_type (void)
{
	static volatile gsize proton_plus_utils_command_result_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_command_result_type_id__once)) {
		GType proton_plus_utils_command_result_type_id;
		proton_plus_utils_command_result_type_id = proton_plus_utils_command_result_get_type_once ();
		g_once_init_leave (&proton_plus_utils_command_result_type_id__once, proton_plus_utils_command_result_type_id);
	}
	return proton_plus_utils_command_result_type_id__once;
}

static void
_vala_proton_plus_utils_command_result_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	ProtonPlusUtilsCommandResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_COMMAND_RESULT, ProtonPlusUtilsCommandResult);
	switch (property_id) {
		case PROTON_PLUS_UTILS_COMMAND_RESULT_STDOUT_PROPERTY:
		g_value_set_string (value, proton_plus_utils_command_result_get_stdout (self));
		break;
		case PROTON_PLUS_UTILS_COMMAND_RESULT_STDERR_PROPERTY:
		g_value_set_string (value, proton_plus_utils_command_result_get_stderr (self));
		break;
		case PROTON_PLUS_UTILS_COMMAND_RESULT_EXIT_STATUS_PROPERTY:
		g_value_set_int (value, proton_plus_utils_command_result_get_exit_status (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_utils_command_result_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	ProtonPlusUtilsCommandResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_COMMAND_RESULT, ProtonPlusUtilsCommandResult);
	switch (property_id) {
		case PROTON_PLUS_UTILS_COMMAND_RESULT_STDOUT_PROPERTY:
		proton_plus_utils_command_result_set_stdout (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_UTILS_COMMAND_RESULT_STDERR_PROPERTY:
		proton_plus_utils_command_result_set_stderr (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_UTILS_COMMAND_RESULT_EXIT_STATUS_PROPERTY:
		proton_plus_utils_command_result_set_exit_status (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
proton_plus_utils_systemctl_backend_run (ProtonPlusUtilsSystemctlBackend* self,
                                         const gchar* arguments,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	ProtonPlusUtilsSystemctlBackendIface* _iface_;
	_iface_ = PROTON_PLUS_UTILS_SYSTEMCTL_BACKEND_GET_INTERFACE (self);
	if (_iface_->run) {
		_iface_->run (self, arguments, _callback_, _user_data_);
	}
}

ProtonPlusUtilsCommandResult*
proton_plus_utils_systemctl_backend_run_finish (ProtonPlusUtilsSystemctlBackend* self,
                                                GAsyncResult* _res_)
{
	ProtonPlusUtilsSystemctlBackendIface* _iface_;
	_iface_ = PROTON_PLUS_UTILS_SYSTEMCTL_BACKEND_GET_INTERFACE (self);
	if (_iface_->run_finish) {
		return _iface_->run_finish (self, _res_);
	}
	return NULL;
}

static void
proton_plus_utils_systemctl_backend_default_init (ProtonPlusUtilsSystemctlBackendIface * iface,
                                                  gpointer iface_data)
{
}

static GType
proton_plus_utils_systemctl_backend_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsSystemctlBackendIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_systemctl_backend_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType proton_plus_utils_systemctl_backend_type_id;
	proton_plus_utils_systemctl_backend_type_id = g_type_register_static (G_TYPE_INTERFACE, "ProtonPlusUtilsSystemctlBackend", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (proton_plus_utils_systemctl_backend_type_id, G_TYPE_OBJECT);
	return proton_plus_utils_systemctl_backend_type_id;
}

GType
proton_plus_utils_systemctl_backend_get_type (void)
{
	static volatile gsize proton_plus_utils_systemctl_backend_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_systemctl_backend_type_id__once)) {
		GType proton_plus_utils_systemctl_backend_type_id;
		proton_plus_utils_systemctl_backend_type_id = proton_plus_utils_systemctl_backend_get_type_once ();
		g_once_init_leave (&proton_plus_utils_systemctl_backend_type_id__once, proton_plus_utils_systemctl_backend_type_id);
	}
	return proton_plus_utils_systemctl_backend_type_id__once;
}

static void
proton_plus_utils_host_systemctl_backend_real_run_data_free (gpointer _data)
{
	ProtonPlusUtilsHostSystemctlBackendRunData* _data_;
	_data_ = _data;
	_g_free0 (_data_->arguments);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusUtilsHostSystemctlBackendRunData, _data_);
}

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

static void
proton_plus_utils_host_systemctl_backend_real_run (ProtonPlusUtilsSystemctlBackend* base,
                                                   const gchar* arguments,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ProtonPlusUtilsHostSystemctlBackend * self;
	ProtonPlusUtilsHostSystemctlBackendRunData* _data_;
	ProtonPlusUtilsHostSystemctlBackend* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (arguments != NULL);
	self = (ProtonPlusUtilsHostSystemctlBackend*) base;
	_data_ = g_slice_new0 (ProtonPlusUtilsHostSystemctlBackendRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_host_systemctl_backend_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (arguments);
	_g_free0 (_data_->arguments);
	_data_->arguments = _tmp1_;
	proton_plus_utils_host_systemctl_backend_real_run_co (_data_);
}

static ProtonPlusUtilsCommandResult*
proton_plus_utils_host_systemctl_backend_run_finish (ProtonPlusUtilsSystemctlBackend* base,
                                                     GAsyncResult* _res_)
{
	ProtonPlusUtilsCommandResult* result;
	ProtonPlusUtilsHostSystemctlBackendRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_utils_host_systemctl_backend_run_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_)
{
	ProtonPlusUtilsHostSystemctlBackendRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_host_systemctl_backend_real_run_co (_data_);
}

static gboolean
proton_plus_utils_host_systemctl_backend_real_run_co (ProtonPlusUtilsHostSystemctlBackendRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strconcat ("systemctl --user ", _data_->arguments, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_state_ = 1;
	proton_plus_utils_system_run_command (_data_->_tmp1_, proton_plus_utils_host_systemctl_backend_run_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = proton_plus_utils_system_run_command_finish (_data_->_res_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_g_free0 (_data_->_tmp1_);
	_data_->result = _data_->_tmp3_;
	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;
}

ProtonPlusUtilsHostSystemctlBackend*
proton_plus_utils_host_systemctl_backend_construct (GType object_type)
{
	ProtonPlusUtilsHostSystemctlBackend * self = NULL;
	self = (ProtonPlusUtilsHostSystemctlBackend*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusUtilsHostSystemctlBackend*
proton_plus_utils_host_systemctl_backend_new (void)
{
	return proton_plus_utils_host_systemctl_backend_construct (PROTON_PLUS_UTILS_TYPE_HOST_SYSTEMCTL_BACKEND);
}

static void
proton_plus_utils_host_systemctl_backend_class_init (ProtonPlusUtilsHostSystemctlBackendClass * klass,
                                                     gpointer klass_data)
{
	proton_plus_utils_host_systemctl_backend_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_utils_host_systemctl_backend_proton_plus_utils_systemctl_backend_interface_init (ProtonPlusUtilsSystemctlBackendIface * iface,
                                                                                             gpointer iface_data)
{
	proton_plus_utils_host_systemctl_backend_proton_plus_utils_systemctl_backend_parent_iface = g_type_interface_peek_parent (iface);
	iface->run = (void (*) (ProtonPlusUtilsSystemctlBackend*, const gchar*, GAsyncReadyCallback, gpointer)) proton_plus_utils_host_systemctl_backend_real_run;
	iface->run_finish = (ProtonPlusUtilsCommandResult* (*) (ProtonPlusUtilsSystemctlBackend*, GAsyncResult*)) proton_plus_utils_host_systemctl_backend_run_finish;
}

static void
proton_plus_utils_host_systemctl_backend_instance_init (ProtonPlusUtilsHostSystemctlBackend * self,
                                                        gpointer klass)
{
}

static GType
proton_plus_utils_host_systemctl_backend_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsHostSystemctlBackendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_host_systemctl_backend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsHostSystemctlBackend), 0, (GInstanceInitFunc) proton_plus_utils_host_systemctl_backend_instance_init, NULL };
	static const GInterfaceInfo proton_plus_utils_systemctl_backend_info = { (GInterfaceInitFunc) proton_plus_utils_host_systemctl_backend_proton_plus_utils_systemctl_backend_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType proton_plus_utils_host_systemctl_backend_type_id;
	proton_plus_utils_host_systemctl_backend_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsHostSystemctlBackend", &g_define_type_info, 0);
	g_type_add_interface_static (proton_plus_utils_host_systemctl_backend_type_id, PROTON_PLUS_UTILS_TYPE_SYSTEMCTL_BACKEND, &proton_plus_utils_systemctl_backend_info);
	return proton_plus_utils_host_systemctl_backend_type_id;
}

GType
proton_plus_utils_host_systemctl_backend_get_type (void)
{
	static volatile gsize proton_plus_utils_host_systemctl_backend_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_host_systemctl_backend_type_id__once)) {
		GType proton_plus_utils_host_systemctl_backend_type_id;
		proton_plus_utils_host_systemctl_backend_type_id = proton_plus_utils_host_systemctl_backend_get_type_once ();
		g_once_init_leave (&proton_plus_utils_host_systemctl_backend_type_id__once, proton_plus_utils_host_systemctl_backend_type_id);
	}
	return proton_plus_utils_host_systemctl_backend_type_id__once;
}

static inline gpointer
proton_plus_utils_systemd_timer_manager_get_instance_private (ProtonPlusUtilsSystemdTimerManager* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsSystemdTimerManager_private_offset);
}

ProtonPlusUtilsSystemdTimerManager*
proton_plus_utils_systemd_timer_manager_construct (GType object_type,
                                                   ProtonPlusUtilsSystemctlBackend* backend,
                                                   const gchar* systemd_dir,
                                                   const gchar* service_template,
                                                   const gchar* timer_template,
                                                   const gchar* exec_start)
{
	ProtonPlusUtilsSystemdTimerManager * self = NULL;
	ProtonPlusUtilsSystemctlBackend* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_val_if_fail (backend != NULL, NULL);
	g_return_val_if_fail (systemd_dir != NULL, NULL);
	g_return_val_if_fail (service_template != NULL, NULL);
	g_return_val_if_fail (timer_template != NULL, NULL);
	g_return_val_if_fail (exec_start != NULL, NULL);
	self = (ProtonPlusUtilsSystemdTimerManager*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (backend);
	_g_object_unref0 (self->priv->backend);
	self->priv->backend = _tmp0_;
	_tmp1_ = g_strdup (systemd_dir);
	_g_free0 (self->priv->systemd_dir);
	self->priv->systemd_dir = _tmp1_;
	_tmp2_ = g_strdup (service_template);
	_g_free0 (self->priv->service_template);
	self->priv->service_template = _tmp2_;
	_tmp3_ = g_strdup (timer_template);
	_g_free0 (self->priv->timer_template);
	self->priv->timer_template = _tmp3_;
	_tmp4_ = g_strdup (exec_start);
	_g_free0 (self->priv->exec_start);
	self->priv->exec_start = _tmp4_;
	return self;
}

ProtonPlusUtilsSystemdTimerManager*
proton_plus_utils_systemd_timer_manager_new (ProtonPlusUtilsSystemctlBackend* backend,
                                             const gchar* systemd_dir,
                                             const gchar* service_template,
                                             const gchar* timer_template,
                                             const gchar* exec_start)
{
	return proton_plus_utils_systemd_timer_manager_construct (PROTON_PLUS_UTILS_TYPE_SYSTEMD_TIMER_MANAGER, backend, systemd_dir, service_template, timer_template, exec_start);
}

static void
proton_plus_utils_systemd_timer_manager_reconcile_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemdTimerManagerReconcileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusUtilsSystemdTimerManagerReconcileData, _data_);
}

void
proton_plus_utils_systemd_timer_manager_reconcile (ProtonPlusUtilsSystemdTimerManager* self,
                                                   gboolean check_on_boot,
                                                   gboolean background_updates,
                                                   gint frequency,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ProtonPlusUtilsSystemdTimerManagerReconcileData* _data_;
	ProtonPlusUtilsSystemdTimerManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemdTimerManagerReconcileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_systemd_timer_manager_reconcile_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->check_on_boot = check_on_boot;
	_data_->background_updates = background_updates;
	_data_->frequency = frequency;
	proton_plus_utils_systemd_timer_manager_reconcile_co (_data_);
}

gboolean
proton_plus_utils_systemd_timer_manager_reconcile_finish (ProtonPlusUtilsSystemdTimerManager* self,
                                                          GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsSystemdTimerManagerReconcileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_systemd_timer_manager_reconcile_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	ProtonPlusUtilsSystemdTimerManagerReconcileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_systemd_timer_manager_reconcile_co (_data_);
}

static gboolean
proton_plus_utils_systemd_timer_manager_reconcile_co (ProtonPlusUtilsSystemdTimerManagerReconcileData* _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;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!_data_->check_on_boot) {
		_data_->_tmp0_ = !_data_->background_updates;
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->_state_ = 1;
		proton_plus_utils_systemd_timer_manager_reconcile_disabled (_data_->self, proton_plus_utils_systemd_timer_manager_reconcile_ready, _data_);
		return FALSE;
		_state_1:
		_data_->result = proton_plus_utils_systemd_timer_manager_reconcile_disabled_finish (_data_->self, _data_->_res_);
		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_->_tmp1_ = FALSE;
	_data_->_tmp2_ = proton_plus_utils_systemd_timer_manager_write_unit_files (_data_->self, _data_->check_on_boot, _data_->background_updates, _data_->frequency, &_data_->_tmp1_);
	_data_->files_changed = _data_->_tmp1_;
	if (!_data_->_tmp2_) {
		_data_->result = FALSE;
		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_->files_changed) {
		_data_->_state_ = 2;
		proton_plus_utils_systemd_timer_manager_run_action (_data_->self, "daemon-reload", proton_plus_utils_systemd_timer_manager_reconcile_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp3_ = !proton_plus_utils_systemd_timer_manager_run_action_finish (_data_->self, _data_->_res_);
	} else {
		_data_->_tmp3_ = FALSE;
	}
	if (_data_->_tmp3_) {
		_data_->result = FALSE;
		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_->_tmp4_ = _data_->self->priv->backend;
	_data_->_state_ = 3;
	proton_plus_utils_systemctl_backend_run (_data_->_tmp4_, "is-enabled --quiet " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_ready, _data_);
	return FALSE;
	_state_3:
	_data_->_tmp5_ = proton_plus_utils_systemctl_backend_run_finish (_data_->_tmp4_, _data_->_res_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = _data_->_tmp8_ == 0;
	_g_object_unref0 (_data_->_tmp6_);
	_data_->enabled = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->self->priv->backend;
	_data_->_state_ = 4;
	proton_plus_utils_systemctl_backend_run (_data_->_tmp10_, "is-active --quiet " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_ready, _data_);
	return FALSE;
	_state_4:
	_data_->_tmp11_ = proton_plus_utils_systemctl_backend_run_finish (_data_->_tmp10_, _data_->_res_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_tmp15_ = _data_->_tmp14_ == 0;
	_g_object_unref0 (_data_->_tmp12_);
	_data_->active = _data_->_tmp15_;
	if (!_data_->enabled) {
		_data_->_tmp16_ = TRUE;
	} else {
		_data_->_tmp16_ = !_data_->active;
	}
	if (_data_->_tmp16_) {
		_data_->_state_ = 5;
		proton_plus_utils_systemd_timer_manager_run_action (_data_->self, "enable --now " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_ready, _data_);
		return FALSE;
		_state_5:
		if (!proton_plus_utils_systemd_timer_manager_run_action_finish (_data_->self, _data_->_res_)) {
			_data_->result = FALSE;
			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_->active) {
			_data_->result = TRUE;
			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_->files_changed) {
		_data_->_state_ = 6;
		proton_plus_utils_systemd_timer_manager_run_action (_data_->self, "restart " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_ready, _data_);
		return FALSE;
		_state_6:
		_data_->result = proton_plus_utils_systemd_timer_manager_run_action_finish (_data_->self, _data_->_res_);
		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 = TRUE;
	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_utils_systemd_timer_manager_reconcile_disabled_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData, _data_);
}

static void
proton_plus_utils_systemd_timer_manager_reconcile_disabled (ProtonPlusUtilsSystemdTimerManager* self,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_)
{
	ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData* _data_;
	ProtonPlusUtilsSystemdTimerManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_systemd_timer_manager_reconcile_disabled_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_utils_systemd_timer_manager_reconcile_disabled_co (_data_);
}

static gboolean
proton_plus_utils_systemd_timer_manager_reconcile_disabled_finish (ProtonPlusUtilsSystemdTimerManager* self,
                                                                   GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_systemd_timer_manager_reconcile_disabled_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_)
{
	ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_systemd_timer_manager_reconcile_disabled_co (_data_);
}

static gboolean
proton_plus_utils_systemd_timer_manager_reconcile_disabled_co (ProtonPlusUtilsSystemdTimerManagerReconcileDisabledData* _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_->files_present = proton_plus_utils_systemd_timer_manager_unit_files_exist (_data_->self);
	_data_->_tmp0_ = _data_->self->priv->backend;
	_data_->_state_ = 1;
	proton_plus_utils_systemctl_backend_run (_data_->_tmp0_, "is-enabled --quiet " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_disabled_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = proton_plus_utils_systemctl_backend_run_finish (_data_->_tmp0_, _data_->_res_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _data_->_tmp4_ == 0;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->enabled = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->self->priv->backend;
	_data_->_state_ = 2;
	proton_plus_utils_systemctl_backend_run (_data_->_tmp6_, "is-active --quiet " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_disabled_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp7_ = proton_plus_utils_systemctl_backend_run_finish (_data_->_tmp6_, _data_->_res_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = _data_->_tmp10_ == 0;
	_g_object_unref0 (_data_->_tmp8_);
	_data_->active = _data_->_tmp11_;
	if (_data_->files_present) {
		_data_->_tmp14_ = TRUE;
	} else {
		_data_->_tmp14_ = _data_->enabled;
	}
	if (_data_->_tmp14_) {
		_data_->_tmp13_ = TRUE;
	} else {
		_data_->_tmp13_ = _data_->active;
	}
	if (_data_->_tmp13_) {
		_data_->_state_ = 3;
		proton_plus_utils_systemd_timer_manager_run_action (_data_->self, "disable --now " PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, proton_plus_utils_systemd_timer_manager_reconcile_disabled_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp12_ = !proton_plus_utils_systemd_timer_manager_run_action_finish (_data_->self, _data_->_res_);
	} else {
		_data_->_tmp12_ = FALSE;
	}
	if (_data_->_tmp12_) {
		_data_->result = FALSE;
		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_ = FALSE;
	_data_->_tmp16_ = proton_plus_utils_systemd_timer_manager_remove_unit_files (_data_->self, &_data_->_tmp15_);
	_data_->files_removed = _data_->_tmp15_;
	if (!_data_->_tmp16_) {
		_data_->result = FALSE;
		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_->files_removed) {
		_data_->_tmp18_ = TRUE;
	} else {
		_data_->_tmp18_ = _data_->enabled;
	}
	if (_data_->_tmp18_) {
		_data_->_tmp17_ = TRUE;
	} else {
		_data_->_tmp17_ = _data_->active;
	}
	if (_data_->_tmp17_) {
		_data_->_state_ = 4;
		proton_plus_utils_systemd_timer_manager_run_action (_data_->self, "daemon-reload", proton_plus_utils_systemd_timer_manager_reconcile_disabled_ready, _data_);
		return FALSE;
		_state_4:
		_data_->result = proton_plus_utils_systemd_timer_manager_run_action_finish (_data_->self, _data_->_res_);
		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 = TRUE;
	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_utils_systemd_timer_manager_unit_files_exist (ProtonPlusUtilsSystemdTimerManager* self)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->systemd_dir;
	_tmp2_ = g_build_filename (_tmp1_, "protonplus.service", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_file_test (_tmp3_, G_FILE_TEST_EXISTS);
	_g_free0 (_tmp3_);
	if (_tmp4_) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp5_ = self->priv->systemd_dir;
		_tmp6_ = g_build_filename (_tmp5_, PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, NULL);
		_tmp7_ = _tmp6_;
		_tmp0_ = g_file_test (_tmp7_, G_FILE_TEST_EXISTS);
		_g_free0 (_tmp7_);
	}
	result = _tmp0_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gboolean
proton_plus_utils_systemd_timer_manager_write_unit_files (ProtonPlusUtilsSystemdTimerManager* self,
                                                          gboolean check_on_boot,
                                                          gboolean background_updates,
                                                          gint frequency,
                                                          gboolean* files_changed)
{
	gboolean _vala_files_changed = FALSE;
	gchar* on_unit_active_sec = NULL;
	gchar* _tmp0_;
	gchar* service_content = NULL;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* timer_content = NULL;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gboolean _tmp36_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_files_changed = FALSE;
	_tmp0_ = g_strdup ("1h");
	on_unit_active_sec = _tmp0_;
	switch (frequency) {
		case 1:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("3h");
			_g_free0 (on_unit_active_sec);
			on_unit_active_sec = _tmp1_;
			break;
		}
		case 2:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("6h");
			_g_free0 (on_unit_active_sec);
			on_unit_active_sec = _tmp2_;
			break;
		}
		case 3:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("12h");
			_g_free0 (on_unit_active_sec);
			on_unit_active_sec = _tmp3_;
			break;
		}
		default:
		case 0:
		{
			break;
		}
	}
	_tmp4_ = self->priv->service_template;
	_tmp5_ = self->priv->exec_start;
	_tmp6_ = string_replace (_tmp4_, "{ExecStart}", _tmp5_);
	service_content = _tmp6_;
	_tmp7_ = self->priv->timer_template;
	_tmp8_ = g_strdup (_tmp7_);
	timer_content = _tmp8_;
	if (!check_on_boot) {
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp9_ = timer_content;
		_tmp10_ = string_replace (_tmp9_, "OnBootSec=1min", "");
		_g_free0 (timer_content);
		timer_content = _tmp10_;
	}
	if (background_updates) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = timer_content;
		_tmp12_ = on_unit_active_sec;
		_tmp13_ = string_replace (_tmp11_, "{OnUnitActiveSec}", _tmp12_);
		_g_free0 (timer_content);
		timer_content = _tmp13_;
	} else {
		const gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		_tmp14_ = timer_content;
		_tmp15_ = string_replace (_tmp14_, "OnUnitActiveSec={OnUnitActiveSec}\n", "");
		_tmp16_ = _tmp15_;
		_tmp17_ = string_replace (_tmp16_, "OnUnitActiveSec={OnUnitActiveSec}", "");
		_g_free0 (timer_content);
		timer_content = _tmp17_;
		_g_free0 (_tmp16_);
	}
	{
		GFile* dir = NULL;
		const gchar* _tmp18_;
		GFile* _tmp19_;
		GFile* _tmp20_;
		gboolean _tmp22_ = FALSE;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		const gchar* _tmp26_;
		gboolean _tmp27_;
		gboolean _tmp28_ = FALSE;
		const gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		const gchar* _tmp32_;
		gboolean _tmp33_;
		_tmp18_ = self->priv->systemd_dir;
		_tmp19_ = g_file_new_for_path (_tmp18_);
		dir = _tmp19_;
		_tmp20_ = dir;
		if (!g_file_query_exists (_tmp20_, NULL)) {
			GFile* _tmp21_;
			_tmp21_ = dir;
			g_file_make_directory_with_parents (_tmp21_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (dir);
				goto __catch0_g_error;
			}
		}
		_tmp23_ = self->priv->systemd_dir;
		_tmp24_ = g_build_filename (_tmp23_, "protonplus.service", NULL);
		_tmp25_ = _tmp24_;
		_tmp26_ = service_content;
		_tmp27_ = proton_plus_utils_systemd_timer_manager_write_if_changed (self, _tmp25_, _tmp26_, &_inner_error0_);
		_g_free0 (_tmp25_);
		_tmp22_ = _tmp27_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (dir);
			goto __catch0_g_error;
		}
		_vala_files_changed = _vala_files_changed | _tmp22_;
		_tmp29_ = self->priv->systemd_dir;
		_tmp30_ = g_build_filename (_tmp29_, PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT, NULL);
		_tmp31_ = _tmp30_;
		_tmp32_ = timer_content;
		_tmp33_ = proton_plus_utils_systemd_timer_manager_write_if_changed (self, _tmp31_, _tmp32_, &_inner_error0_);
		_g_free0 (_tmp31_);
		_tmp28_ = _tmp33_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (dir);
			goto __catch0_g_error;
		}
		_vala_files_changed = _vala_files_changed | _tmp28_;
		result = TRUE;
		_g_object_unref0 (dir);
		_g_free0 (timer_content);
		_g_free0 (service_content);
		_g_free0 (on_unit_active_sec);
		if (files_changed) {
			*files_changed = _vala_files_changed;
		}
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp34_;
		const gchar* _tmp35_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp34_ = e;
		_tmp35_ = _tmp34_->message;
		g_warning ("system.vala:155: %s", _tmp35_);
		result = FALSE;
		_g_error_free0 (e);
		_g_free0 (timer_content);
		_g_free0 (service_content);
		_g_free0 (on_unit_active_sec);
		if (files_changed) {
			*files_changed = _vala_files_changed;
		}
		return result;
	}
	__finally0:
	_g_free0 (timer_content);
	_g_free0 (service_content);
	_g_free0 (on_unit_active_sec);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp36_;
}

static gboolean
proton_plus_utils_systemd_timer_manager_write_if_changed (ProtonPlusUtilsSystemdTimerManager* self,
                                                          const gchar* path,
                                                          const gchar* contents,
                                                          GError** error)
{
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (contents != NULL, FALSE);
	if (g_file_test (path, G_FILE_TEST_EXISTS)) {
		gchar* existing = NULL;
		gchar* _tmp0_ = NULL;
		const gchar* _tmp3_;
		g_file_get_contents (path, &_tmp0_, NULL, &_inner_error0_);
		_g_free0 (existing);
		existing = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_FILE_ERROR) {
				gboolean _tmp1_ = FALSE;
				g_propagate_error (error, _inner_error0_);
				_g_free0 (existing);
				return _tmp1_;
			} else {
				gboolean _tmp2_ = FALSE;
				_g_free0 (existing);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return _tmp2_;
			}
		}
		_tmp3_ = existing;
		if (g_strcmp0 (_tmp3_, contents) == 0) {
			result = FALSE;
			_g_free0 (existing);
			return result;
		}
		_g_free0 (existing);
	}
	g_file_set_contents (path, contents, (gssize) -1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_FILE_ERROR) {
			gboolean _tmp4_ = FALSE;
			g_propagate_error (error, _inner_error0_);
			return _tmp4_;
		} else {
			gboolean _tmp5_ = FALSE;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp5_;
		}
	}
	result = TRUE;
	return result;
}

static gboolean
proton_plus_utils_systemd_timer_manager_remove_unit_files (ProtonPlusUtilsSystemdTimerManager* self,
                                                           gboolean* files_removed)
{
	gboolean _vala_files_removed = FALSE;
	gboolean _tmp14_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_files_removed = FALSE;
	{
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar** _tmp2_;
		_tmp0_ = g_strdup ("protonplus.service");
		_tmp1_ = g_strdup (PROTON_PLUS_UTILS_SYSTEMD_TIMER_MANAGER_TIMER_UNIT);
		_tmp2_ = g_new0 (gchar*, 2 + 1);
		_tmp2_[0] = _tmp0_;
		_tmp2_[1] = _tmp1_;
		{
			gchar** name_collection = NULL;
			gint name_collection_length1 = 0;
			gint _name_collection_size_ = 0;
			gint name_it = 0;
			name_collection = _tmp2_;
			name_collection_length1 = 2;
			for (name_it = 0; name_it < name_collection_length1; name_it = name_it + 1) {
				gchar* _tmp3_;
				gchar* name = NULL;
				_tmp3_ = g_strdup (name_collection[name_it]);
				name = _tmp3_;
				{
					GFile* file = NULL;
					const gchar* _tmp4_;
					const gchar* _tmp5_;
					gchar* _tmp6_;
					gchar* _tmp7_;
					GFile* _tmp8_;
					GFile* _tmp9_;
					GFile* _tmp10_;
					GFile* _tmp11_;
					_tmp4_ = self->priv->systemd_dir;
					_tmp5_ = name;
					_tmp6_ = g_build_filename (_tmp4_, _tmp5_, NULL);
					_tmp7_ = _tmp6_;
					_tmp8_ = g_file_new_for_path (_tmp7_);
					_tmp9_ = _tmp8_;
					_g_free0 (_tmp7_);
					file = _tmp9_;
					_tmp10_ = file;
					if (!g_file_query_exists (_tmp10_, NULL)) {
						_g_object_unref0 (file);
						_g_free0 (name);
						continue;
					}
					_tmp11_ = file;
					g_file_delete (_tmp11_, NULL, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_object_unref0 (file);
						_g_free0 (name);
						name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
						goto __catch0_g_error;
					}
					_vala_files_removed = TRUE;
					_g_object_unref0 (file);
					_g_free0 (name);
				}
			}
			name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
		}
		result = TRUE;
		if (files_removed) {
			*files_removed = _vala_files_removed;
		}
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_warning ("system.vala:184: %s", _tmp13_);
		result = FALSE;
		_g_error_free0 (e);
		if (files_removed) {
			*files_removed = _vala_files_removed;
		}
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp14_;
}

static void
proton_plus_utils_systemd_timer_manager_run_action_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemdTimerManagerRunActionData* _data_;
	_data_ = _data;
	_g_free0 (_data_->arguments);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusUtilsSystemdTimerManagerRunActionData, _data_);
}

static void
proton_plus_utils_systemd_timer_manager_run_action (ProtonPlusUtilsSystemdTimerManager* self,
                                                    const gchar* arguments,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	ProtonPlusUtilsSystemdTimerManagerRunActionData* _data_;
	ProtonPlusUtilsSystemdTimerManager* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (arguments != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemdTimerManagerRunActionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_systemd_timer_manager_run_action_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (arguments);
	_g_free0 (_data_->arguments);
	_data_->arguments = _tmp1_;
	proton_plus_utils_systemd_timer_manager_run_action_co (_data_);
}

static gboolean
proton_plus_utils_systemd_timer_manager_run_action_finish (ProtonPlusUtilsSystemdTimerManager* self,
                                                           GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsSystemdTimerManagerRunActionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_systemd_timer_manager_run_action_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_)
{
	ProtonPlusUtilsSystemdTimerManagerRunActionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_systemd_timer_manager_run_action_co (_data_);
}

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 gboolean
proton_plus_utils_systemd_timer_manager_run_action_co (ProtonPlusUtilsSystemdTimerManagerRunActionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strconcat ("systemctl --user ", _data_->arguments, NULL);
	_data_->command = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->backend;
	_data_->_state_ = 1;
	proton_plus_utils_systemctl_backend_run (_data_->_tmp1_, _data_->arguments, proton_plus_utils_systemd_timer_manager_run_action_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = proton_plus_utils_systemctl_backend_run_finish (_data_->_tmp1_, _data_->_res_);
	_data_->_result_ = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->_result_;
	_data_->_tmp4_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	if (_data_->_tmp5_ == 0) {
		_data_->result = TRUE;
		_g_object_unref0 (_data_->_result_);
		_g_free0 (_data_->command);
		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_->_tmp6_ = _data_->_result_;
	_data_->_tmp7_ = proton_plus_utils_command_result_get_stderr (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = string_strip (_data_->_tmp8_);
	_data_->error_output = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->error_output;
	if (g_strcmp0 (_data_->_tmp10_, "") == 0) {
		_data_->_tmp11_ = _data_->_result_;
		_data_->_tmp12_ = proton_plus_utils_command_result_get_stdout (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = string_strip (_data_->_tmp13_);
		_g_free0 (_data_->error_output);
		_data_->error_output = _data_->_tmp14_;
	}
	_data_->_tmp15_ = _data_->error_output;
	if (g_strcmp0 (_data_->_tmp15_, "") == 0) {
		_data_->_tmp16_ = g_strdup ("no output");
		_g_free0 (_data_->error_output);
		_data_->error_output = _data_->_tmp16_;
	}
	_data_->_tmp17_ = _data_->command;
	_data_->_tmp18_ = _data_->_result_;
	_data_->_tmp19_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp18_);
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = _data_->error_output;
	g_warning ("system.vala:201: %s failed with exit status %d: %s", _data_->_tmp17_, _data_->_tmp20_, _data_->_tmp21_);
	_data_->result = FALSE;
	_g_free0 (_data_->error_output);
	_g_object_unref0 (_data_->_result_);
	_g_free0 (_data_->command);
	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_utils_systemd_timer_manager_class_init (ProtonPlusUtilsSystemdTimerManagerClass * klass,
                                                    gpointer klass_data)
{
	proton_plus_utils_systemd_timer_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsSystemdTimerManager_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_systemd_timer_manager_finalize;
}

static void
proton_plus_utils_systemd_timer_manager_instance_init (ProtonPlusUtilsSystemdTimerManager * self,
                                                       gpointer klass)
{
	self->priv = proton_plus_utils_systemd_timer_manager_get_instance_private (self);
}

static void
proton_plus_utils_systemd_timer_manager_finalize (GObject * obj)
{
	ProtonPlusUtilsSystemdTimerManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_SYSTEMD_TIMER_MANAGER, ProtonPlusUtilsSystemdTimerManager);
	_g_object_unref0 (self->priv->backend);
	_g_free0 (self->priv->systemd_dir);
	_g_free0 (self->priv->service_template);
	_g_free0 (self->priv->timer_template);
	_g_free0 (self->priv->exec_start);
	G_OBJECT_CLASS (proton_plus_utils_systemd_timer_manager_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_systemd_timer_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsSystemdTimerManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_systemd_timer_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsSystemdTimerManager), 0, (GInstanceInitFunc) proton_plus_utils_systemd_timer_manager_instance_init, NULL };
	GType proton_plus_utils_systemd_timer_manager_type_id;
	proton_plus_utils_systemd_timer_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsSystemdTimerManager", &g_define_type_info, 0);
	ProtonPlusUtilsSystemdTimerManager_private_offset = g_type_add_instance_private (proton_plus_utils_systemd_timer_manager_type_id, sizeof (ProtonPlusUtilsSystemdTimerManagerPrivate));
	return proton_plus_utils_systemd_timer_manager_type_id;
}

GType
proton_plus_utils_systemd_timer_manager_get_type (void)
{
	static volatile gsize proton_plus_utils_systemd_timer_manager_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_systemd_timer_manager_type_id__once)) {
		GType proton_plus_utils_systemd_timer_manager_type_id;
		proton_plus_utils_systemd_timer_manager_type_id = proton_plus_utils_systemd_timer_manager_get_type_once ();
		g_once_init_leave (&proton_plus_utils_systemd_timer_manager_type_id__once, proton_plus_utils_systemd_timer_manager_type_id);
	}
	return proton_plus_utils_systemd_timer_manager_type_id__once;
}

static void
proton_plus_utils_system_run_command_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemRunCommandData* _data_;
	_data_ = _data;
	_g_free0 (_data_->command);
	_g_object_unref0 (_data_->result);
	g_slice_free (ProtonPlusUtilsSystemRunCommandData, _data_);
}

void
proton_plus_utils_system_run_command (const gchar* command,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	ProtonPlusUtilsSystemRunCommandData* _data_;
	gchar* _tmp0_;
	g_return_if_fail (command != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemRunCommandData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_system_run_command_data_free);
	_tmp0_ = g_strdup (command);
	_g_free0 (_data_->command);
	_data_->command = _tmp0_;
	proton_plus_utils_system_run_command_co (_data_);
}

ProtonPlusUtilsCommandResult*
proton_plus_utils_system_run_command_finish (GAsyncResult* _res_)
{
	ProtonPlusUtilsCommandResult* result;
	ProtonPlusUtilsSystemRunCommandData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
proton_plus_utils_system_run_command_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	ProtonPlusUtilsSystemRunCommandData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_system_run_command_co (_data_);
}

static gboolean
proton_plus_utils_system_run_command_co (ProtonPlusUtilsSystemRunCommandData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = 0;
		_data_->_tmp1_ = proton_plus_utils_system_get_command_argv (_data_->command, &_data_->_tmp0_, &_data_->_inner_error0_);
		_data_->argv = _data_->_tmp1_;
		_data_->argv_length1 = _data_->_tmp0_;
		_data_->_argv_size_ = _data_->argv_length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->argv;
		_data_->_tmp2__length1 = _data_->argv_length1;
		_data_->_tmp3_ = g_subprocess_newv (_data_->_tmp2_, G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_PIPE, &_data_->_inner_error0_);
		_data_->subprocess = _data_->_tmp3_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->subprocess;
		_data_->_tmp5_ = NULL;
		_data_->_tmp6_ = NULL;
		_data_->_state_ = 1;
		g_subprocess_communicate_async (_data_->_tmp4_, NULL, NULL, proton_plus_utils_system_run_command_ready, _data_);
		return FALSE;
		_state_1:
		g_subprocess_communicate_finish (_data_->_tmp4_, _data_->_res_, &_data_->_tmp5_, &_data_->_tmp6_, &_data_->_inner_error0_);
		_g_bytes_unref0 (_data_->stdout_bytes);
		_data_->stdout_bytes = _data_->_tmp5_;
		_g_bytes_unref0 (_data_->stderr_bytes);
		_data_->stderr_bytes = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_bytes_unref0 (_data_->stderr_bytes);
			_g_bytes_unref0 (_data_->stdout_bytes);
			_g_object_unref0 (_data_->subprocess);
			_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_data_->_tmp8_ = _data_->stdout_bytes;
		if (_data_->_tmp8_ != NULL) {
			_data_->_tmp9_ = _data_->stdout_bytes;
			_data_->_tmp10_ = 0;
			_data_->_tmp11_ = g_bytes_get_data (_data_->_tmp9_, &_data_->_tmp10_);
			_data_->_tmp12_ = proton_plus_utils_parser_data_to_string (_data_->_tmp11_, (gint) _data_->_tmp10_);
			_g_free0 (_data_->_tmp7_);
			_data_->_tmp7_ = _data_->_tmp12_;
		} else {
			_data_->_tmp13_ = g_strdup ("");
			_g_free0 (_data_->_tmp7_);
			_data_->_tmp7_ = _data_->_tmp13_;
		}
		_data_->_tmp14_ = _data_->_tmp7_;
		_data_->_tmp7_ = NULL;
		_data_->stdout = _data_->_tmp14_;
		_data_->_tmp16_ = _data_->stderr_bytes;
		if (_data_->_tmp16_ != NULL) {
			_data_->_tmp17_ = _data_->stderr_bytes;
			_data_->_tmp18_ = 0;
			_data_->_tmp19_ = g_bytes_get_data (_data_->_tmp17_, &_data_->_tmp18_);
			_data_->_tmp20_ = proton_plus_utils_parser_data_to_string (_data_->_tmp19_, (gint) _data_->_tmp18_);
			_g_free0 (_data_->_tmp15_);
			_data_->_tmp15_ = _data_->_tmp20_;
		} else {
			_data_->_tmp21_ = g_strdup ("");
			_g_free0 (_data_->_tmp15_);
			_data_->_tmp15_ = _data_->_tmp21_;
		}
		_data_->_tmp22_ = _data_->_tmp15_;
		_data_->_tmp15_ = NULL;
		_data_->stderr = _data_->_tmp22_;
		_data_->_tmp24_ = _data_->subprocess;
		if (g_subprocess_get_if_exited (_data_->_tmp24_)) {
			_data_->_tmp25_ = _data_->subprocess;
			_data_->_tmp23_ = g_subprocess_get_exit_status (_data_->_tmp25_);
		} else {
			_data_->_tmp23_ = -1;
		}
		_data_->exit_status = _data_->_tmp23_;
		_data_->_tmp26_ = _data_->stdout;
		_data_->_tmp27_ = _data_->stderr;
		_data_->_tmp28_ = proton_plus_utils_command_result_new (_data_->_tmp26_, _data_->_tmp27_, _data_->exit_status);
		_data_->result = _data_->_tmp28_;
		_g_free0 (_data_->stderr);
		_g_free0 (_data_->_tmp15_);
		_g_free0 (_data_->stdout);
		_g_free0 (_data_->_tmp7_);
		_g_bytes_unref0 (_data_->stderr_bytes);
		_g_bytes_unref0 (_data_->stdout_bytes);
		_g_object_unref0 (_data_->subprocess);
		_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp29_ = _data_->e;
		_data_->_tmp30_ = _data_->_tmp29_->message;
		g_warning ("system.vala:263: %s", _data_->_tmp30_);
		_data_->_tmp31_ = _data_->e;
		_data_->_tmp32_ = _data_->_tmp31_->message;
		_data_->_tmp33_ = proton_plus_utils_command_result_new ("", _data_->_tmp32_, -1);
		_data_->result = _data_->_tmp33_;
		_g_error_free0 (_data_->e);
		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;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gchar*
proton_plus_utils_system_run_command_sync (const gchar* command)
{
	gchar* output = NULL;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (command != NULL, NULL);
	_tmp0_ = g_strdup ("");
	output = _tmp0_;
	{
		gchar** argv = NULL;
		gint _tmp1_ = 0;
		gchar** _tmp2_;
		gint argv_length1;
		gint _argv_size_;
		GSubprocess* subprocess = NULL;
		gchar** _tmp3_;
		gint _tmp3__length1;
		GSubprocess* _tmp4_;
		GBytes* stdout_bytes = NULL;
		GSubprocess* _tmp5_;
		GBytes* _tmp6_ = NULL;
		GBytes* _tmp7_;
		_tmp2_ = proton_plus_utils_system_get_command_argv (command, &_tmp1_, &_inner_error0_);
		argv = _tmp2_;
		argv_length1 = _tmp1_;
		_argv_size_ = argv_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = argv;
		_tmp3__length1 = argv_length1;
		_tmp4_ = g_subprocess_newv (_tmp3_, G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_MERGE, &_inner_error0_);
		subprocess = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_tmp5_ = subprocess;
		g_subprocess_communicate (_tmp5_, NULL, NULL, &_tmp6_, NULL, &_inner_error0_);
		_g_bytes_unref0 (stdout_bytes);
		stdout_bytes = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_bytes_unref0 (stdout_bytes);
			_g_object_unref0 (subprocess);
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_tmp7_ = stdout_bytes;
		if (_tmp7_ != NULL) {
			GBytes* _tmp8_;
			gsize _tmp9_ = 0;
			guint8* _tmp10_;
			gchar* _tmp11_;
			_tmp8_ = stdout_bytes;
			_tmp10_ = g_bytes_get_data (_tmp8_, &_tmp9_);
			_tmp11_ = proton_plus_utils_parser_data_to_string (_tmp10_, (gint) _tmp9_);
			_g_free0 (output);
			output = _tmp11_;
		}
		_g_bytes_unref0 (stdout_bytes);
		_g_object_unref0 (subprocess);
		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_warning ("system.vala:280: %s", _tmp13_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (output);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = output;
	return result;
}

ProtonPlusUtilsCommandResult*
proton_plus_utils_system_run_command_sync_result (const gchar* command)
{
	gchar* output = NULL;
	gchar* _tmp0_;
	gchar* error_output = NULL;
	gchar* _tmp1_;
	gint exit_status = 0;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ProtonPlusUtilsCommandResult* _tmp29_;
	GError* _inner_error0_ = NULL;
	ProtonPlusUtilsCommandResult* result;
	g_return_val_if_fail (command != NULL, NULL);
	_tmp0_ = g_strdup ("");
	output = _tmp0_;
	_tmp1_ = g_strdup ("");
	error_output = _tmp1_;
	exit_status = -1;
	{
		gchar** argv = NULL;
		gint _tmp2_ = 0;
		gchar** _tmp3_;
		gint argv_length1;
		gint _argv_size_;
		GSubprocess* subprocess = NULL;
		gchar** _tmp4_;
		gint _tmp4__length1;
		GSubprocess* _tmp5_;
		GBytes* stdout_bytes = NULL;
		GBytes* stderr_bytes = NULL;
		GSubprocess* _tmp6_;
		GBytes* _tmp7_ = NULL;
		GBytes* _tmp8_ = NULL;
		GBytes* _tmp9_;
		GBytes* _tmp14_;
		gint _tmp19_ = 0;
		GSubprocess* _tmp20_;
		_tmp3_ = proton_plus_utils_system_get_command_argv (command, &_tmp2_, &_inner_error0_);
		argv = _tmp3_;
		argv_length1 = _tmp2_;
		_argv_size_ = argv_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = argv;
		_tmp4__length1 = argv_length1;
		_tmp5_ = g_subprocess_newv (_tmp4_, G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_PIPE, &_inner_error0_);
		subprocess = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_tmp6_ = subprocess;
		g_subprocess_communicate (_tmp6_, NULL, NULL, &_tmp7_, &_tmp8_, &_inner_error0_);
		_g_bytes_unref0 (stdout_bytes);
		stdout_bytes = _tmp7_;
		_g_bytes_unref0 (stderr_bytes);
		stderr_bytes = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_bytes_unref0 (stderr_bytes);
			_g_bytes_unref0 (stdout_bytes);
			_g_object_unref0 (subprocess);
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_tmp9_ = stdout_bytes;
		if (_tmp9_ != NULL) {
			GBytes* _tmp10_;
			gsize _tmp11_ = 0;
			guint8* _tmp12_;
			gchar* _tmp13_;
			_tmp10_ = stdout_bytes;
			_tmp12_ = g_bytes_get_data (_tmp10_, &_tmp11_);
			_tmp13_ = proton_plus_utils_parser_data_to_string (_tmp12_, (gint) _tmp11_);
			_g_free0 (output);
			output = _tmp13_;
		}
		_tmp14_ = stderr_bytes;
		if (_tmp14_ != NULL) {
			GBytes* _tmp15_;
			gsize _tmp16_ = 0;
			guint8* _tmp17_;
			gchar* _tmp18_;
			_tmp15_ = stderr_bytes;
			_tmp17_ = g_bytes_get_data (_tmp15_, &_tmp16_);
			_tmp18_ = proton_plus_utils_parser_data_to_string (_tmp17_, (gint) _tmp16_);
			_g_free0 (error_output);
			error_output = _tmp18_;
		}
		_tmp20_ = subprocess;
		if (g_subprocess_get_if_exited (_tmp20_)) {
			GSubprocess* _tmp21_;
			_tmp21_ = subprocess;
			_tmp19_ = g_subprocess_get_exit_status (_tmp21_);
		} else {
			_tmp19_ = -1;
		}
		exit_status = _tmp19_;
		_g_bytes_unref0 (stderr_bytes);
		_g_bytes_unref0 (stdout_bytes);
		_g_object_unref0 (subprocess);
		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp22_;
		const gchar* _tmp23_;
		GError* _tmp24_;
		const gchar* _tmp25_;
		gchar* _tmp26_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp22_ = e;
		_tmp23_ = _tmp22_->message;
		g_warning ("system.vala:306: %s", _tmp23_);
		_tmp24_ = e;
		_tmp25_ = _tmp24_->message;
		_tmp26_ = g_strdup (_tmp25_);
		_g_free0 (error_output);
		error_output = _tmp26_;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (error_output);
		_g_free0 (output);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	_tmp27_ = output;
	_tmp28_ = error_output;
	_tmp29_ = proton_plus_utils_command_result_new (_tmp27_, _tmp28_, exit_status);
	result = _tmp29_;
	_g_free0 (error_output);
	_g_free0 (output);
	return result;
}

static gchar**
proton_plus_utils_system_get_command_argv (const gchar* command,
                                           gint* result_length1,
                                           GError** error)
{
	gchar* _tmp0_ = NULL;
	gchar* command_line = NULL;
	gchar* _tmp3_;
	gchar** argv = NULL;
	gint argv_length1 = 0;
	gint _argv_size_ = 0;
	gchar** _tmp4_ = NULL;
	gint _tmp5_ = 0;
	gchar** _tmp6_;
	gint _tmp6__length1;
	GError* _inner_error0_ = NULL;
	gchar** result;
	g_return_val_if_fail (command != NULL, NULL);
	if (proton_plus_globals_IS_FLATPAK) {
		gchar* _tmp1_;
		_tmp1_ = g_strconcat ("flatpak-spawn --host ", command, NULL);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (command);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	command_line = _tmp3_;
	g_shell_parse_argv (command_line, &_tmp5_, &_tmp4_, &_inner_error0_);
	argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
	argv = _tmp4_;
	argv_length1 = _tmp5_;
	_argv_size_ = argv_length1;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_SHELL_ERROR) {
			g_propagate_error (error, _inner_error0_);
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (command_line);
			_g_free0 (_tmp0_);
			return NULL;
		} else {
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (command_line);
			_g_free0 (_tmp0_);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp6_ = argv;
	_tmp6__length1 = argv_length1;
	if (result_length1) {
		*result_length1 = _tmp6__length1;
	}
	result = _tmp6_;
	_g_free0 (command_line);
	_g_free0 (_tmp0_);
	return result;
}

ProtonPlusModelsCpuArchitecture
proton_plus_utils_system_normalize_cpu_architecture (const gchar* machine)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GQuark _tmp6_ = 0U;
	static GQuark _tmp5_label0 = 0;
	static GQuark _tmp5_label1 = 0;
	static GQuark _tmp5_label2 = 0;
	static GQuark _tmp5_label3 = 0;
	static GQuark _tmp5_label4 = 0;
	static GQuark _tmp5_label5 = 0;
	static GQuark _tmp5_label6 = 0;
	static GQuark _tmp5_label7 = 0;
	static GQuark _tmp5_label8 = 0;
	static GQuark _tmp5_label9 = 0;
	static GQuark _tmp5_label10 = 0;
	static GQuark _tmp5_label11 = 0;
	static GQuark _tmp5_label12 = 0;
	ProtonPlusModelsCpuArchitecture result;
	g_return_val_if_fail (machine != NULL, 0);
	_tmp0_ = string_strip (machine);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_ascii_strdown (_tmp1_, (gssize) -1);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	_tmp4_ = _tmp3_;
	_tmp6_ = (NULL == _tmp4_) ? 0 : g_quark_from_string (_tmp4_);
	g_free (_tmp4_);
	if ((((_tmp6_ == ((0 != _tmp5_label0) ? _tmp5_label0 : (_tmp5_label0 = g_quark_from_static_string ("x86_64")))) || (_tmp6_ == ((0 != _tmp5_label1) ? _tmp5_label1 : (_tmp5_label1 = g_quark_from_static_string ("amd64"))))) || (_tmp6_ == ((0 != _tmp5_label2) ? _tmp5_label2 : (_tmp5_label2 = g_quark_from_static_string ("x64"))))) || (_tmp6_ == ((0 != _tmp5_label3) ? _tmp5_label3 : (_tmp5_label3 = g_quark_from_static_string ("x86-64"))))) {
		switch (0) {
			default:
			{
				result = PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_64;
				return result;
			}
		}
	} else if ((_tmp6_ == ((0 != _tmp5_label4) ? _tmp5_label4 : (_tmp5_label4 = g_quark_from_static_string ("aarch64")))) || (_tmp6_ == ((0 != _tmp5_label5) ? _tmp5_label5 : (_tmp5_label5 = g_quark_from_static_string ("arm64"))))) {
		switch (0) {
			default:
			{
				result = PROTON_PLUS_MODELS_CPU_ARCHITECTURE_AARCH64;
				return result;
			}
		}
	} else if (((((((_tmp6_ == ((0 != _tmp5_label6) ? _tmp5_label6 : (_tmp5_label6 = g_quark_from_static_string ("i386")))) || (_tmp6_ == ((0 != _tmp5_label7) ? _tmp5_label7 : (_tmp5_label7 = g_quark_from_static_string ("i486"))))) || (_tmp6_ == ((0 != _tmp5_label8) ? _tmp5_label8 : (_tmp5_label8 = g_quark_from_static_string ("i586"))))) || (_tmp6_ == ((0 != _tmp5_label9) ? _tmp5_label9 : (_tmp5_label9 = g_quark_from_static_string ("i686"))))) || (_tmp6_ == ((0 != _tmp5_label10) ? _tmp5_label10 : (_tmp5_label10 = g_quark_from_static_string ("x86"))))) || (_tmp6_ == ((0 != _tmp5_label11) ? _tmp5_label11 : (_tmp5_label11 = g_quark_from_static_string ("x86_32"))))) || (_tmp6_ == ((0 != _tmp5_label12) ? _tmp5_label12 : (_tmp5_label12 = g_quark_from_static_string ("ia32"))))) {
		switch (0) {
			default:
			{
				result = PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_32;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = PROTON_PLUS_MODELS_CPU_ARCHITECTURE_UNKNOWN;
				return result;
			}
		}
	}
}

ProtonPlusModelsCpuCapabilities*
proton_plus_utils_system_get_cpu_capabilities_for_probe (const gchar* machine,
                                                         gboolean feature_probe_available,
                                                         ProtonPlusModelsX86_64Features* features,
                                                         ProtonPlusModelsAarch64Features* aarch64_features)
{
	ProtonPlusModelsCpuArchitecture architecture = 0;
	ProtonPlusModelsX86_64Level _tmp4_ = 0;
	ProtonPlusModelsX86_64Level level = 0;
	ProtonPlusModelsCpuCapabilities* _tmp5_;
	ProtonPlusModelsCpuCapabilities* result;
	g_return_val_if_fail (machine != NULL, NULL);
	g_return_val_if_fail (features != NULL, NULL);
	architecture = proton_plus_utils_system_normalize_cpu_architecture (machine);
	if (architecture == PROTON_PLUS_MODELS_CPU_ARCHITECTURE_AARCH64) {
		ProtonPlusModelsAarch64Level _tmp0_ = 0;
		gboolean _tmp1_ = FALSE;
		ProtonPlusModelsAarch64Level level = 0;
		ProtonPlusModelsCpuCapabilities* _tmp2_;
		if (feature_probe_available) {
			_tmp1_ = aarch64_features != NULL;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			_tmp0_ = proton_plus_models_cpu_capabilities_aarch64_level_from_features (G_TYPE_CHECK_INSTANCE_CAST (aarch64_features, PROTON_PLUS_MODELS_TYPE_AARCH64_FEATURES, ProtonPlusModelsAarch64Features));
		} else {
			_tmp0_ = PROTON_PLUS_MODELS_AARCH64_LEVEL_V8_0;
		}
		level = _tmp0_;
		_tmp2_ = proton_plus_models_cpu_capabilities_new (architecture, PROTON_PLUS_MODELS_X86_64LEVEL_UNKNOWN, level);
		result = _tmp2_;
		return result;
	}
	if (architecture != PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_64) {
		ProtonPlusModelsCpuCapabilities* _tmp3_;
		_tmp3_ = proton_plus_models_cpu_capabilities_new (architecture, PROTON_PLUS_MODELS_X86_64LEVEL_UNKNOWN, PROTON_PLUS_MODELS_AARCH64_LEVEL_UNKNOWN);
		result = _tmp3_;
		return result;
	}
	if (feature_probe_available) {
		_tmp4_ = proton_plus_models_cpu_capabilities_x86_64_level_from_features (features);
	} else {
		_tmp4_ = PROTON_PLUS_MODELS_X86_64LEVEL_BASELINE;
	}
	level = _tmp4_;
	_tmp5_ = proton_plus_models_cpu_capabilities_new (architecture, level, PROTON_PLUS_MODELS_AARCH64_LEVEL_UNKNOWN);
	result = _tmp5_;
	return result;
}

static ProtonPlusModelsX86_64Features*
proton_plus_utils_system_get_x86_64_features (ProtonPlusCpuFeatureProbe* probe)
{
	ProtonPlusCpuFeatureProbe _tmp0_;
	ProtonPlusCpuFeatureProbe _tmp1_;
	ProtonPlusCpuFeatureProbe _tmp2_;
	ProtonPlusCpuFeatureProbe _tmp3_;
	ProtonPlusCpuFeatureProbe _tmp4_;
	ProtonPlusCpuFeatureProbe _tmp5_;
	ProtonPlusCpuFeatureProbe _tmp6_;
	ProtonPlusCpuFeatureProbe _tmp7_;
	ProtonPlusCpuFeatureProbe _tmp8_;
	ProtonPlusCpuFeatureProbe _tmp9_;
	ProtonPlusCpuFeatureProbe _tmp10_;
	ProtonPlusCpuFeatureProbe _tmp11_;
	ProtonPlusCpuFeatureProbe _tmp12_;
	ProtonPlusCpuFeatureProbe _tmp13_;
	ProtonPlusCpuFeatureProbe _tmp14_;
	ProtonPlusCpuFeatureProbe _tmp15_;
	ProtonPlusCpuFeatureProbe _tmp16_;
	ProtonPlusCpuFeatureProbe _tmp17_;
	ProtonPlusCpuFeatureProbe _tmp18_;
	ProtonPlusCpuFeatureProbe _tmp19_;
	ProtonPlusCpuFeatureProbe _tmp20_;
	ProtonPlusCpuFeatureProbe _tmp21_;
	ProtonPlusCpuFeatureProbe _tmp22_;
	ProtonPlusCpuFeatureProbe _tmp23_;
	ProtonPlusCpuFeatureProbe _tmp24_;
	ProtonPlusCpuFeatureProbe _tmp25_;
	ProtonPlusModelsX86_64Features* _tmp26_ = NULL;
	ProtonPlusModelsX86_64Features* result;
	g_return_val_if_fail (probe != NULL, NULL);
	_tmp0_ = *probe;
	_tmp1_ = *probe;
	_tmp2_ = *probe;
	_tmp3_ = *probe;
	_tmp4_ = *probe;
	_tmp5_ = *probe;
	_tmp6_ = *probe;
	_tmp7_ = *probe;
	_tmp8_ = *probe;
	_tmp9_ = *probe;
	_tmp10_ = *probe;
	_tmp11_ = *probe;
	_tmp12_ = *probe;
	_tmp13_ = *probe;
	_tmp14_ = *probe;
	_tmp15_ = *probe;
	_tmp16_ = *probe;
	_tmp17_ = *probe;
	_tmp18_ = *probe;
	_tmp19_ = *probe;
	_tmp20_ = *probe;
	_tmp21_ = *probe;
	_tmp22_ = *probe;
	_tmp23_ = *probe;
	_tmp24_ = *probe;
	_tmp25_ = *probe;
	_tmp26_ = proton_plus_models_x86_64features_new ();
	proton_plus_models_x86_64features_set_cmpxchg16b (_tmp26_, _tmp0_.cmpxchg16b);
	proton_plus_models_x86_64features_set_lahf_sahf (_tmp26_, _tmp1_.lahf_sahf);
	proton_plus_models_x86_64features_set_popcnt (_tmp26_, _tmp2_.popcnt);
	proton_plus_models_x86_64features_set_sse3 (_tmp26_, _tmp3_.sse3);
	proton_plus_models_x86_64features_set_sse4_1 (_tmp26_, _tmp4_.sse4_1);
	proton_plus_models_x86_64features_set_sse4_2 (_tmp26_, _tmp5_.sse4_2);
	proton_plus_models_x86_64features_set_ssse3 (_tmp26_, _tmp6_.ssse3);
	proton_plus_models_x86_64features_set_avx (_tmp26_, _tmp7_.avx);
	proton_plus_models_x86_64features_set_avx2 (_tmp26_, _tmp8_.avx2);
	proton_plus_models_x86_64features_set_bmi1 (_tmp26_, _tmp9_.bmi1);
	proton_plus_models_x86_64features_set_bmi2 (_tmp26_, _tmp10_.bmi2);
	proton_plus_models_x86_64features_set_f16c (_tmp26_, _tmp11_.f16c);
	proton_plus_models_x86_64features_set_fma (_tmp26_, _tmp12_.fma);
	proton_plus_models_x86_64features_set_lzcnt (_tmp26_, _tmp13_.lzcnt);
	proton_plus_models_x86_64features_set_movbe (_tmp26_, _tmp14_.movbe);
	proton_plus_models_x86_64features_set_osxsave (_tmp26_, _tmp15_.osxsave);
	proton_plus_models_x86_64features_set_xcr0_xmm (_tmp26_, _tmp16_.xcr0_xmm);
	proton_plus_models_x86_64features_set_xcr0_ymm (_tmp26_, _tmp17_.xcr0_ymm);
	proton_plus_models_x86_64features_set_avx512f (_tmp26_, _tmp18_.avx512f);
	proton_plus_models_x86_64features_set_avx512bw (_tmp26_, _tmp19_.avx512bw);
	proton_plus_models_x86_64features_set_avx512cd (_tmp26_, _tmp20_.avx512cd);
	proton_plus_models_x86_64features_set_avx512dq (_tmp26_, _tmp21_.avx512dq);
	proton_plus_models_x86_64features_set_avx512vl (_tmp26_, _tmp22_.avx512vl);
	proton_plus_models_x86_64features_set_xcr0_opmask (_tmp26_, _tmp23_.xcr0_opmask);
	proton_plus_models_x86_64features_set_xcr0_zmm_hi256 (_tmp26_, _tmp24_.xcr0_zmm_hi256);
	proton_plus_models_x86_64features_set_xcr0_hi16_zmm (_tmp26_, _tmp25_.xcr0_hi16_zmm);
	result = _tmp26_;
	return result;
}

static ProtonPlusModelsAarch64Features*
proton_plus_utils_system_get_aarch64_features (ProtonPlusCpuFeatureProbe* probe)
{
	ProtonPlusCpuFeatureProbe _tmp0_;
	ProtonPlusCpuFeatureProbe _tmp1_;
	ProtonPlusCpuFeatureProbe _tmp2_;
	ProtonPlusModelsAarch64Features* _tmp3_ = NULL;
	ProtonPlusModelsAarch64Features* result;
	g_return_val_if_fail (probe != NULL, NULL);
	_tmp0_ = *probe;
	_tmp1_ = *probe;
	_tmp2_ = *probe;
	_tmp3_ = proton_plus_models_aarch64_features_new ();
	proton_plus_models_aarch64_features_set_crc32 (_tmp3_, _tmp0_.aarch64_crc32);
	proton_plus_models_aarch64_features_set_lse_atomics (_tmp3_, _tmp1_.aarch64_lse_atomics);
	proton_plus_models_aarch64_features_set_rdma (_tmp3_, _tmp2_.aarch64_rdma);
	result = _tmp3_;
	return result;
}

ProtonPlusModelsCpuCapabilities*
proton_plus_utils_system_get_cpu_capabilities (void)
{
	struct utsname system_info = {0};
	ProtonPlusModelsCpuArchitecture architecture = 0;
	struct utsname _tmp0_;
	const gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ProtonPlusCpuFeatureProbe probe = {0};
	ProtonPlusCpuFeatureProbe _tmp4_ = {0};
	struct utsname _tmp5_;
	const gchar* _tmp6_;
	ProtonPlusCpuFeatureProbe _tmp7_;
	ProtonPlusCpuFeatureProbe _tmp8_;
	ProtonPlusModelsX86_64Features* _tmp9_;
	ProtonPlusModelsX86_64Features* _tmp10_;
	ProtonPlusCpuFeatureProbe _tmp11_;
	ProtonPlusModelsAarch64Features* _tmp12_;
	ProtonPlusModelsAarch64Features* _tmp13_;
	ProtonPlusModelsCpuCapabilities* _tmp14_;
	ProtonPlusModelsCpuCapabilities* _tmp15_;
	ProtonPlusModelsCpuCapabilities* result;
	uname (&system_info);
	_tmp0_ = system_info;
	_tmp1_ = _tmp0_.machine;
	architecture = proton_plus_utils_system_normalize_cpu_architecture (_tmp1_);
	if (architecture != PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_64) {
		_tmp2_ = architecture != PROTON_PLUS_MODELS_CPU_ARCHITECTURE_AARCH64;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		ProtonPlusModelsCpuCapabilities* _tmp3_;
		_tmp3_ = proton_plus_models_cpu_capabilities_new (architecture, PROTON_PLUS_MODELS_X86_64LEVEL_UNKNOWN, PROTON_PLUS_MODELS_AARCH64_LEVEL_UNKNOWN);
		result = _tmp3_;
		return result;
	}
	protonplus_cpu_get_feature_probe (&_tmp4_);
	probe = _tmp4_;
	_tmp5_ = system_info;
	_tmp6_ = _tmp5_.machine;
	_tmp7_ = probe;
	_tmp8_ = probe;
	_tmp9_ = proton_plus_utils_system_get_x86_64_features (&_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = probe;
	_tmp12_ = proton_plus_utils_system_get_aarch64_features (&_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = proton_plus_utils_system_get_cpu_capabilities_for_probe (_tmp6_, _tmp7_.available, _tmp10_, _tmp13_);
	_tmp15_ = _tmp14_;
	_g_object_unref0 (_tmp13_);
	_g_object_unref0 (_tmp10_);
	result = _tmp15_;
	return result;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_list_free__g_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_free0_);
}

GList*
proton_plus_utils_system_get_hwcaps_for_capabilities (ProtonPlusModelsCpuCapabilities* capabilities)
{
	GList* hwcaps = NULL;
	ProtonPlusModelsCpuArchitecture _tmp0_;
	ProtonPlusModelsCpuArchitecture _tmp1_;
	GList* _tmp10_;
	GList* result;
	g_return_val_if_fail (capabilities != NULL, NULL);
	hwcaps = NULL;
	_tmp0_ = proton_plus_models_cpu_capabilities_get_architecture (capabilities);
	_tmp1_ = _tmp0_;
	switch (_tmp1_) {
		case PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_64:
		{
			gchar* _tmp5_;
			if (proton_plus_models_cpu_capabilities_supports_x86_64_level (capabilities, PROTON_PLUS_MODELS_X86_64LEVEL_V4)) {
				gchar* _tmp2_;
				_tmp2_ = g_strdup ("x86_64_v4");
				hwcaps = g_list_append (hwcaps, _tmp2_);
			}
			if (proton_plus_models_cpu_capabilities_supports_x86_64_level (capabilities, PROTON_PLUS_MODELS_X86_64LEVEL_V3)) {
				gchar* _tmp3_;
				_tmp3_ = g_strdup ("x86_64_v3");
				hwcaps = g_list_append (hwcaps, _tmp3_);
			}
			if (proton_plus_models_cpu_capabilities_supports_x86_64_level (capabilities, PROTON_PLUS_MODELS_X86_64LEVEL_V2)) {
				gchar* _tmp4_;
				_tmp4_ = g_strdup ("x86_64_v2");
				hwcaps = g_list_append (hwcaps, _tmp4_);
			}
			_tmp5_ = g_strdup ("x86_64");
			hwcaps = g_list_append (hwcaps, _tmp5_);
			break;
		}
		case PROTON_PLUS_MODELS_CPU_ARCHITECTURE_AARCH64:
		{
			gchar* _tmp7_;
			if (proton_plus_models_cpu_capabilities_supports_aarch64_level (capabilities, PROTON_PLUS_MODELS_AARCH64_LEVEL_V8_1)) {
				gchar* _tmp6_;
				_tmp6_ = g_strdup ("aarch64_v8_1");
				hwcaps = g_list_append (hwcaps, _tmp6_);
			}
			_tmp7_ = g_strdup ("aarch64");
			hwcaps = g_list_append (hwcaps, _tmp7_);
			break;
		}
		case PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_32:
		{
			gchar* _tmp8_;
			_tmp8_ = g_strdup ("x86");
			hwcaps = g_list_append (hwcaps, _tmp8_);
			break;
		}
		default:
		{
			gchar* _tmp9_;
			_tmp9_ = g_strdup ("unknown");
			hwcaps = g_list_append (hwcaps, _tmp9_);
			break;
		}
	}
	_tmp10_ = hwcaps;
	hwcaps = NULL;
	result = _tmp10_;
	(hwcaps == NULL) ? NULL : (hwcaps = (_g_list_free__g_free0_ (hwcaps), NULL));
	return result;
}

GList*
proton_plus_utils_system_get_hwcaps (void)
{
	ProtonPlusModelsCpuCapabilities* _tmp0_;
	ProtonPlusModelsCpuCapabilities* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GList* result;
	_tmp0_ = proton_plus_utils_system_get_cpu_capabilities ();
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_utils_system_get_hwcaps_for_capabilities (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static void
proton_plus_utils_system_check_dependency_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemCheckDependencyData* _data_;
	_data_ = _data;
	_g_free0 (_data_->name);
	g_slice_free (ProtonPlusUtilsSystemCheckDependencyData, _data_);
}

void
proton_plus_utils_system_check_dependency (const gchar* name,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	ProtonPlusUtilsSystemCheckDependencyData* _data_;
	gchar* _tmp0_;
	g_return_if_fail (name != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemCheckDependencyData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_system_check_dependency_data_free);
	_tmp0_ = g_strdup (name);
	_g_free0 (_data_->name);
	_data_->name = _tmp0_;
	proton_plus_utils_system_check_dependency_co (_data_);
}

gboolean
proton_plus_utils_system_check_dependency_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsSystemCheckDependencyData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_system_check_dependency_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	ProtonPlusUtilsSystemCheckDependencyData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_system_check_dependency_co (_data_);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
proton_plus_utils_system_check_dependency_co (ProtonPlusUtilsSystemCheckDependencyData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!proton_plus_globals_IS_FLATPAK) {
		_data_->_tmp0_ = g_find_program_in_path (_data_->name);
		_data_->_tmp1_ = _data_->_tmp0_;
		_data_->_tmp2_ = _data_->_tmp1_ != NULL;
		_g_free0 (_data_->_tmp1_);
		_data_->result = _data_->_tmp2_;
		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_shell_quote (_data_->name);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = g_strdup_printf ("which %s", _data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_state_ = 1;
	proton_plus_utils_system_run_command (_data_->_tmp6_, proton_plus_utils_system_check_dependency_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = proton_plus_utils_system_run_command_finish (_data_->_res_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = proton_plus_utils_command_result_get_stdout (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = g_strdup (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_g_object_unref0 (_data_->_tmp8_);
	_g_free0 (_data_->_tmp6_);
	_g_free0 (_data_->_tmp4_);
	_data_->output = _data_->_tmp12_;
	_data_->_tmp14_ = _data_->output;
	if (g_strcmp0 (_data_->_tmp14_, "") != 0) {
		_data_->_tmp15_ = _data_->output;
		_data_->_tmp13_ = !string_contains (_data_->_tmp15_, "which: no");
	} else {
		_data_->_tmp13_ = FALSE;
	}
	_data_->result = _data_->_tmp13_;
	_g_free0 (_data_->output);
	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;
}

gboolean
proton_plus_utils_system_check_dependency_sync (const gchar* name)
{
	gchar* output = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gboolean _tmp9_ = FALSE;
	const gchar* _tmp10_;
	gboolean result;
	g_return_val_if_fail (name != NULL, FALSE);
	if (!proton_plus_globals_IS_FLATPAK) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gboolean _tmp2_;
		_tmp0_ = g_find_program_in_path (name);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_ != NULL;
		_g_free0 (_tmp1_);
		result = _tmp2_;
		return result;
	}
	_tmp3_ = g_shell_quote (name);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup_printf ("which %s", _tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = proton_plus_utils_system_run_command_sync (_tmp6_);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	output = _tmp8_;
	_tmp10_ = output;
	if (g_strcmp0 (_tmp10_, "") != 0) {
		const gchar* _tmp11_;
		_tmp11_ = output;
		_tmp9_ = !string_contains (_tmp11_, "which: no");
	} else {
		_tmp9_ = FALSE;
	}
	result = _tmp9_;
	_g_free0 (output);
	return result;
}

gboolean
proton_plus_utils_system_check_flatpak_dependency_sync (const gchar* name)
{
	gchar* output = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_;
	gboolean result;
	g_return_val_if_fail (name != NULL, FALSE);
	if (!proton_plus_globals_IS_FLATPAK) {
		result = FALSE;
		return result;
	}
	_tmp0_ = g_shell_quote (name);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("flatpak info %s", _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_utils_system_run_command_sync (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	output = _tmp5_;
	_tmp7_ = output;
	if (g_strcmp0 (_tmp7_, "") != 0) {
		const gchar* _tmp8_;
		_tmp8_ = output;
		_tmp6_ = !string_contains (_tmp8_, "error:");
	} else {
		_tmp6_ = FALSE;
	}
	result = _tmp6_;
	_g_free0 (output);
	return result;
}

ProtonPlusUtilsGpuVendor
proton_plus_utils_system_get_gpu_vendor_from_pci_devices (const gchar* pci_devices)
{
	gchar** _tmp0_;
	gchar** _tmp1_;
	ProtonPlusUtilsGpuVendor result;
	g_return_val_if_fail (pci_devices != NULL, 0);
	_tmp1_ = _tmp0_ = g_strsplit (pci_devices, "\n", 0);
	{
		gchar** line_collection = NULL;
		gint line_collection_length1 = 0;
		gint _line_collection_size_ = 0;
		gint line_it = 0;
		line_collection = _tmp1_;
		line_collection_length1 = _vala_array_length (_tmp0_);
		for (line_it = 0; line_it < line_collection_length1; line_it = line_it + 1) {
			gchar* _tmp2_;
			gchar* line = NULL;
			_tmp2_ = g_strdup (line_collection[line_it]);
			line = _tmp2_;
			{
				const gchar* _tmp3_;
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				const gchar* _tmp6_;
				_tmp3_ = line;
				if (!string_contains (_tmp3_, "[03")) {
					_g_free0 (line);
					continue;
				}
				_tmp4_ = line;
				if (string_contains (_tmp4_, "[1002:")) {
					result = PROTON_PLUS_UTILS_GPU_VENDOR_AMD;
					_g_free0 (line);
					line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_tmp5_ = line;
				if (string_contains (_tmp5_, "[10de:")) {
					result = PROTON_PLUS_UTILS_GPU_VENDOR_NVIDIA;
					_g_free0 (line);
					line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_tmp6_ = line;
				if (string_contains (_tmp6_, "[8086:")) {
					result = PROTON_PLUS_UTILS_GPU_VENDOR_INTEL;
					_g_free0 (line);
					line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_g_free0 (line);
			}
		}
		line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	result = PROTON_PLUS_UTILS_GPU_VENDOR_UNKNOWN;
	return result;
}

static void
proton_plus_utils_system_detect_gpu_vendor_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemDetectGpuVendorData* _data_;
	_data_ = _data;
	g_slice_free (ProtonPlusUtilsSystemDetectGpuVendorData, _data_);
}

void
proton_plus_utils_system_detect_gpu_vendor (GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	ProtonPlusUtilsSystemDetectGpuVendorData* _data_;
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemDetectGpuVendorData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_system_detect_gpu_vendor_data_free);
	proton_plus_utils_system_detect_gpu_vendor_co (_data_);
}

ProtonPlusUtilsGpuVendor
proton_plus_utils_system_detect_gpu_vendor_finish (GAsyncResult* _res_)
{
	ProtonPlusUtilsGpuVendor result;
	ProtonPlusUtilsSystemDetectGpuVendorData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_system_detect_gpu_vendor_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	ProtonPlusUtilsSystemDetectGpuVendorData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_system_detect_gpu_vendor_co (_data_);
}

static gboolean
proton_plus_utils_system_detect_gpu_vendor_co (ProtonPlusUtilsSystemDetectGpuVendorData* _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_->_state_ = 1;
	proton_plus_utils_system_check_dependency ("lspci", proton_plus_utils_system_detect_gpu_vendor_ready, _data_);
	return FALSE;
	_state_1:
	if (!proton_plus_utils_system_check_dependency_finish (_data_->_res_)) {
		_data_->result = PROTON_PLUS_UTILS_GPU_VENDOR_UNKNOWN;
		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_system_run_command ("lspci -nn", proton_plus_utils_system_detect_gpu_vendor_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp0_ = proton_plus_utils_system_run_command_finish (_data_->_res_);
	_data_->_result_ = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->_result_;
	_data_->_tmp2_ = proton_plus_utils_command_result_get_exit_status (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->_tmp3_ != 0) {
		_data_->result = PROTON_PLUS_UTILS_GPU_VENDOR_UNKNOWN;
		_g_object_unref0 (_data_->_result_);
		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_->_tmp4_ = _data_->_result_;
	_data_->_tmp5_ = proton_plus_utils_command_result_get_stdout (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->result = proton_plus_utils_system_get_gpu_vendor_from_pci_devices (_data_->_tmp6_);
	_g_object_unref0 (_data_->_result_);
	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 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;
}

gchar*
proton_plus_utils_system_get_distribution_name (void)
{
	gchar* distro_name = NULL;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	_tmp0_ = g_strdup ("Unknown");
	distro_name = _tmp0_;
	{
		GFile* file = NULL;
		GFile* _tmp1_;
		GFile* _tmp2_;
		GFile* _tmp4_;
		_tmp1_ = g_file_new_for_path ("/etc/os-release");
		file = _tmp1_;
		_tmp2_ = file;
		if (!g_file_query_exists (_tmp2_, NULL)) {
			GFile* _tmp3_;
			_tmp3_ = g_file_new_for_path ("/usr/lib/os-release");
			_g_object_unref0 (file);
			file = _tmp3_;
		}
		_tmp4_ = file;
		if (g_file_query_exists (_tmp4_, NULL)) {
			GFileInputStream* _tmp5_ = NULL;
			GFile* _tmp6_;
			GFileInputStream* _tmp7_;
			GDataInputStream* dis = NULL;
			GDataInputStream* _tmp8_;
			gchar* line = NULL;
			_tmp6_ = file;
			_tmp7_ = g_file_read (_tmp6_, NULL, &_inner_error0_);
			_tmp5_ = _tmp7_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (file);
				goto __catch0_g_error;
			}
			_tmp8_ = g_data_input_stream_new ((GInputStream*) _tmp5_);
			dis = _tmp8_;
			while (TRUE) {
				gchar* _tmp9_ = NULL;
				GDataInputStream* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_tmp10_ = dis;
				_tmp11_ = g_data_input_stream_read_line (_tmp10_, NULL, NULL, &_inner_error0_);
				_tmp9_ = _tmp11_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_free0 (line);
					_g_object_unref0 (dis);
					_g_object_unref0 (_tmp5_);
					_g_object_unref0 (file);
					goto __catch0_g_error;
				}
				_tmp12_ = _tmp9_;
				_tmp9_ = NULL;
				_g_free0 (line);
				line = _tmp12_;
				_tmp13_ = line;
				if (!(_tmp13_ != NULL)) {
					_g_free0 (_tmp9_);
					break;
				}
				_tmp14_ = line;
				if (g_str_has_prefix (_tmp14_, "NAME=")) {
					const gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					gchar* _tmp18_;
					gchar* _tmp19_;
					gchar* _tmp20_;
					_tmp15_ = line;
					_tmp16_ = string_substring (_tmp15_, (glong) 5, (glong) -1);
					_tmp17_ = _tmp16_;
					_tmp18_ = string_replace (_tmp17_, "\"", "");
					_tmp19_ = _tmp18_;
					_tmp20_ = string_replace (_tmp19_, "'", "");
					_g_free0 (distro_name);
					distro_name = _tmp20_;
					_g_free0 (_tmp19_);
					_g_free0 (_tmp17_);
					_g_free0 (_tmp9_);
					break;
				}
				_g_free0 (_tmp9_);
			}
			_g_free0 (line);
			_g_object_unref0 (dis);
			_g_object_unref0 (_tmp5_);
		}
		_g_object_unref0 (file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp21_;
		const gchar* _tmp22_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp21_ = e;
		_tmp22_ = _tmp21_->message;
		g_warning ("system.vala:529: %s", _tmp22_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (distro_name);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = distro_name;
	return result;
}

gboolean
proton_plus_utils_system_is_kde (void)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp3_;
	const gchar* _tmp4_ = NULL;
	const gchar* _tmp5_;
	gchar** desktop_identifiers = NULL;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar** _tmp9_;
	gint desktop_identifiers_length1;
	gint _desktop_identifiers_size_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gboolean result;
	_tmp1_ = g_getenv ("XDG_CURRENT_DESKTOP");
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp3_ = g_getenv ("XDG_SESSION_DESKTOP");
	_tmp2_ = _tmp3_;
	if (_tmp2_ == NULL) {
		_tmp2_ = "";
	}
	_tmp5_ = g_getenv ("DESKTOP_SESSION");
	_tmp4_ = _tmp5_;
	if (_tmp4_ == NULL) {
		_tmp4_ = "";
	}
	_tmp6_ = g_strdup (_tmp0_);
	_tmp7_ = g_strdup (_tmp2_);
	_tmp8_ = g_strdup (_tmp4_);
	_tmp9_ = g_new0 (gchar*, 3 + 1);
	_tmp9_[0] = _tmp6_;
	_tmp9_[1] = _tmp7_;
	_tmp9_[2] = _tmp8_;
	desktop_identifiers = _tmp9_;
	desktop_identifiers_length1 = 3;
	_desktop_identifiers_size_ = desktop_identifiers_length1;
	_tmp10_ = desktop_identifiers;
	_tmp10__length1 = desktop_identifiers_length1;
	{
		gchar** identifier_collection = NULL;
		gint identifier_collection_length1 = 0;
		gint _identifier_collection_size_ = 0;
		gint identifier_it = 0;
		identifier_collection = _tmp10_;
		identifier_collection_length1 = _tmp10__length1;
		for (identifier_it = 0; identifier_it < identifier_collection_length1; identifier_it = identifier_it + 1) {
			gchar* _tmp11_;
			gchar* identifier = NULL;
			_tmp11_ = g_strdup (identifier_collection[identifier_it]);
			identifier = _tmp11_;
			{
				gchar* desktop = NULL;
				const gchar* _tmp12_;
				gchar* _tmp13_;
				gboolean _tmp14_ = FALSE;
				const gchar* _tmp15_;
				_tmp12_ = identifier;
				_tmp13_ = g_ascii_strdown (_tmp12_, (gssize) -1);
				desktop = _tmp13_;
				_tmp15_ = desktop;
				if (string_contains (_tmp15_, "kde")) {
					_tmp14_ = TRUE;
				} else {
					const gchar* _tmp16_;
					_tmp16_ = desktop;
					_tmp14_ = string_contains (_tmp16_, "plasma");
				}
				if (_tmp14_) {
					result = TRUE;
					_g_free0 (desktop);
					_g_free0 (identifier);
					desktop_identifiers = (_vala_array_free (desktop_identifiers, desktop_identifiers_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_g_free0 (desktop);
				_g_free0 (identifier);
			}
		}
	}
	result = FALSE;
	desktop_identifiers = (_vala_array_free (desktop_identifiers, desktop_identifiers_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static void
__lambda10_ (GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		g_app_info_launch_default_for_uri_finish (res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = _error_;
		_tmp1_ = _tmp0_->message;
		g_warning ("system.vala:557: %s", _tmp1_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda10__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda10_ (source_object, res);
}

void
proton_plus_utils_system_open_uri (const gchar* uri)
{
	g_return_if_fail (uri != NULL);
	g_app_info_launch_default_for_uri_async (uri, NULL, NULL, ___lambda10__gasync_ready_callback, NULL);
}

gchar*
proton_plus_utils_system_file_uri_for_path (const gchar* path)
{
	GFile* _tmp0_;
	GFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = g_file_new_for_path (path);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_file_get_uri (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

void
proton_plus_utils_system_open_path (const gchar* path)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (path != NULL);
	_tmp0_ = proton_plus_utils_system_file_uri_for_path (path);
	_tmp1_ = _tmp0_;
	proton_plus_utils_system_open_uri (_tmp1_);
	_g_free0 (_tmp1_);
}

void
proton_plus_utils_system_systemd_handler (void)
{
	proton_plus_utils_system_systemd_update_pending = TRUE;
	if (proton_plus_utils_system_systemd_update_running) {
		return;
	}
	proton_plus_utils_system_systemd_update_running = TRUE;
	proton_plus_utils_system_update_systemd_files (NULL, NULL);
}

static void
proton_plus_utils_system_update_systemd_files_data_free (gpointer _data)
{
	ProtonPlusUtilsSystemUpdateSystemdFilesData* _data_;
	_data_ = _data;
	g_slice_free (ProtonPlusUtilsSystemUpdateSystemdFilesData, _data_);
}

static void
proton_plus_utils_system_update_systemd_files (GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	ProtonPlusUtilsSystemUpdateSystemdFilesData* _data_;
	_data_ = g_slice_new0 (ProtonPlusUtilsSystemUpdateSystemdFilesData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_system_update_systemd_files_data_free);
	proton_plus_utils_system_update_systemd_files_co (_data_);
}

static void
proton_plus_utils_system_update_systemd_files_finish (GAsyncResult* _res_)
{
	ProtonPlusUtilsSystemUpdateSystemdFilesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
proton_plus_utils_system_update_systemd_files_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	ProtonPlusUtilsSystemUpdateSystemdFilesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_system_update_systemd_files_co (_data_);
}

static gboolean
proton_plus_utils_system_update_systemd_files_co (ProtonPlusUtilsSystemUpdateSystemdFilesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = TRUE;
		while (TRUE) {
			if (!_data_->_tmp0_) {
				if (!proton_plus_utils_system_systemd_update_pending) {
					break;
				}
			}
			_data_->_tmp0_ = FALSE;
			proton_plus_utils_system_systemd_update_pending = FALSE;
			_data_->_tmp1_ = proton_plus_utils_system_get_systemd_timer_manager ();
			_data_->manager = _data_->_tmp1_;
			_data_->_tmp2_ = _data_->manager;
			if (_data_->_tmp2_ != NULL) {
				_data_->_tmp3_ = _data_->manager;
				_data_->_tmp4_ = proton_plus_globals_SETTINGS;
				_data_->_tmp5_ = proton_plus_globals_SETTINGS;
				_data_->_tmp6_ = proton_plus_globals_SETTINGS;
				_data_->_state_ = 1;
				proton_plus_utils_systemd_timer_manager_reconcile (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, PROTON_PLUS_UTILS_TYPE_SYSTEMD_TIMER_MANAGER, ProtonPlusUtilsSystemdTimerManager), g_settings_get_boolean (_data_->_tmp4_, "check-updates-on-boot"), g_settings_get_boolean (_data_->_tmp5_, "background-updates"), g_settings_get_enum (_data_->_tmp6_, "background-updates-frequency"), proton_plus_utils_system_update_systemd_files_ready, _data_);
				return FALSE;
				_state_1:
				proton_plus_utils_systemd_timer_manager_reconcile_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, PROTON_PLUS_UTILS_TYPE_SYSTEMD_TIMER_MANAGER, ProtonPlusUtilsSystemdTimerManager), _data_->_res_);
			}
			_g_object_unref0 (_data_->manager);
		}
	}
	proton_plus_utils_system_systemd_update_running = FALSE;
	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 ProtonPlusUtilsSystemdTimerManager*
proton_plus_utils_system_get_systemd_timer_manager (void)
{
	ProtonPlusUtilsSystemdTimerManager* _tmp0_;
	gchar* _tmp3_ = NULL;
	gchar* executable = NULL;
	gchar* _tmp9_;
	gchar* exec_start = NULL;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	ProtonPlusUtilsSystemdTimerManager* _tmp33_;
	ProtonPlusUtilsSystemdTimerManager* _tmp34_;
	GError* _inner_error0_ = NULL;
	ProtonPlusUtilsSystemdTimerManager* result;
	_tmp0_ = proton_plus_utils_system_systemd_timer_manager;
	if (_tmp0_ != NULL) {
		ProtonPlusUtilsSystemdTimerManager* _tmp1_;
		ProtonPlusUtilsSystemdTimerManager* _tmp2_;
		_tmp1_ = proton_plus_utils_system_systemd_timer_manager;
		_tmp2_ = _g_object_ref0 (_tmp1_);
		result = _tmp2_;
		return result;
	}
	if (proton_plus_globals_IS_FLATPAK) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("/usr/bin/flatpak run com.vysp3r.ProtonPlus");
		_g_free0 (_tmp3_);
		_tmp3_ = _tmp4_;
	} else {
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_;
		gchar* _tmp8_;
		_tmp6_ = g_find_program_in_path ("protonplus");
		_tmp5_ = _tmp6_;
		if (_tmp5_ == NULL) {
			gchar* _tmp7_;
			_tmp7_ = g_strdup ("protonplus");
			_g_free0 (_tmp5_);
			_tmp5_ = _tmp7_;
		}
		_tmp8_ = _tmp5_;
		_tmp5_ = NULL;
		_g_free0 (_tmp3_);
		_tmp3_ = _tmp8_;
		_g_free0 (_tmp5_);
	}
	_tmp9_ = _tmp3_;
	_tmp3_ = NULL;
	executable = _tmp9_;
	_tmp10_ = executable;
	_tmp11_ = g_strdup_printf ("%s update all", _tmp10_);
	exec_start = _tmp11_;
	{
		GBytes* service_resource = NULL;
		GBytes* _tmp12_;
		GBytes* timer_resource = NULL;
		GBytes* _tmp13_;
		ProtonPlusUtilsHostSystemctlBackend* _tmp14_;
		ProtonPlusUtilsHostSystemctlBackend* _tmp15_;
		const gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		GBytes* _tmp19_;
		gsize _tmp20_ = 0;
		guint8* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		GBytes* _tmp24_;
		gsize _tmp25_ = 0;
		guint8* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		const gchar* _tmp29_;
		ProtonPlusUtilsSystemdTimerManager* _tmp30_;
		_tmp12_ = g_resources_lookup_data ("/com/vysp3r/ProtonPlus/protonplus.service", G_RESOURCE_LOOKUP_FLAGS_NONE, &_inner_error0_);
		service_resource = _tmp12_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp13_ = g_resources_lookup_data ("/com/vysp3r/ProtonPlus/protonplus.timer", G_RESOURCE_LOOKUP_FLAGS_NONE, &_inner_error0_);
		timer_resource = _tmp13_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_bytes_unref0 (service_resource);
			goto __catch0_g_error;
		}
		_tmp14_ = proton_plus_utils_host_systemctl_backend_new ();
		_tmp15_ = _tmp14_;
		_tmp16_ = g_get_user_config_dir ();
		_tmp17_ = g_build_filename (_tmp16_, "systemd", "user", NULL);
		_tmp18_ = _tmp17_;
		_tmp19_ = service_resource;
		_tmp21_ = g_bytes_get_data (_tmp19_, &_tmp20_);
		_tmp22_ = proton_plus_utils_parser_data_to_string (_tmp21_, (gint) _tmp20_);
		_tmp23_ = _tmp22_;
		_tmp24_ = timer_resource;
		_tmp26_ = g_bytes_get_data (_tmp24_, &_tmp25_);
		_tmp27_ = proton_plus_utils_parser_data_to_string (_tmp26_, (gint) _tmp25_);
		_tmp28_ = _tmp27_;
		_tmp29_ = exec_start;
		_tmp30_ = proton_plus_utils_systemd_timer_manager_new ((ProtonPlusUtilsSystemctlBackend*) _tmp15_, _tmp18_, _tmp23_, _tmp28_, _tmp29_);
		_g_object_unref0 (proton_plus_utils_system_systemd_timer_manager);
		proton_plus_utils_system_systemd_timer_manager = _tmp30_;
		_g_free0 (_tmp28_);
		_g_free0 (_tmp23_);
		_g_free0 (_tmp18_);
		_g_object_unref0 (_tmp15_);
		_g_bytes_unref0 (timer_resource);
		_g_bytes_unref0 (service_resource);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp31_;
		const gchar* _tmp32_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp31_ = e;
		_tmp32_ = _tmp31_->message;
		g_warning ("system.vala:615: %s", _tmp32_);
		result = NULL;
		_g_error_free0 (e);
		_g_free0 (exec_start);
		_g_free0 (executable);
		_g_free0 (_tmp3_);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (exec_start);
		_g_free0 (executable);
		_g_free0 (_tmp3_);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	_tmp33_ = proton_plus_utils_system_systemd_timer_manager;
	_tmp34_ = _g_object_ref0 (_tmp33_);
	result = _tmp34_;
	_g_free0 (exec_start);
	_g_free0 (executable);
	_g_free0 (_tmp3_);
	return result;
}

ProtonPlusUtilsSystem*
proton_plus_utils_system_construct (GType object_type)
{
	ProtonPlusUtilsSystem* self = NULL;
	self = (ProtonPlusUtilsSystem*) g_type_create_instance (object_type);
	return self;
}

ProtonPlusUtilsSystem*
proton_plus_utils_system_new (void)
{
	return proton_plus_utils_system_construct (PROTON_PLUS_UTILS_TYPE_SYSTEM);
}

static ProtonPlusCpuFeatureProbe*
proton_plus_utils_system_cpu_feature_probe_dup (const ProtonPlusCpuFeatureProbe* self)
{
	ProtonPlusCpuFeatureProbe* dup;
	dup = g_new0 (ProtonPlusCpuFeatureProbe, 1);
	memcpy (dup, self, sizeof (ProtonPlusCpuFeatureProbe));
	return dup;
}

static void
proton_plus_utils_system_cpu_feature_probe_free (ProtonPlusCpuFeatureProbe* self)
{
	g_free (self);
}

static void
proton_plus_utils_value_system_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
proton_plus_utils_value_system_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		proton_plus_utils_system_unref (value->data[0].v_pointer);
	}
}

static void
proton_plus_utils_value_system_copy_value (const GValue* src_value,
                                           GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = proton_plus_utils_system_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
proton_plus_utils_value_system_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
proton_plus_utils_value_system_collect_value (GValue* value,
                                              guint n_collect_values,
                                              GTypeCValue* collect_values,
                                              guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		ProtonPlusUtilsSystem * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = proton_plus_utils_system_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
proton_plus_utils_value_system_lcopy_value (const GValue* value,
                                            guint n_collect_values,
                                            GTypeCValue* collect_values,
                                            guint collect_flags)
{
	ProtonPlusUtilsSystem ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = proton_plus_utils_system_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
proton_plus_utils_param_spec_system (const gchar* name,
                                     const gchar* nick,
                                     const gchar* blurb,
                                     GType object_type,
                                     GParamFlags flags)
{
	ProtonPlusUtilsParamSpecSystem* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PROTON_PLUS_UTILS_TYPE_SYSTEM), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
proton_plus_utils_value_get_system (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROTON_PLUS_UTILS_TYPE_SYSTEM), NULL);
	return value->data[0].v_pointer;
}

void
proton_plus_utils_value_set_system (GValue* value,
                                    gpointer v_object)
{
	ProtonPlusUtilsSystem * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROTON_PLUS_UTILS_TYPE_SYSTEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROTON_PLUS_UTILS_TYPE_SYSTEM));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		proton_plus_utils_system_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		proton_plus_utils_system_unref (old);
	}
}

void
proton_plus_utils_value_take_system (GValue* value,
                                     gpointer v_object)
{
	ProtonPlusUtilsSystem * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROTON_PLUS_UTILS_TYPE_SYSTEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROTON_PLUS_UTILS_TYPE_SYSTEM));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		proton_plus_utils_system_unref (old);
	}
}

static void
proton_plus_utils_system_class_init (ProtonPlusUtilsSystemClass * klass,
                                     gpointer klass_data)
{
	proton_plus_utils_system_parent_class = g_type_class_peek_parent (klass);
	((ProtonPlusUtilsSystemClass *) klass)->finalize = proton_plus_utils_system_finalize;
}

static void
proton_plus_utils_system_instance_init (ProtonPlusUtilsSystem * self,
                                        gpointer klass)
{
	self->ref_count = 1;
}

static void
proton_plus_utils_system_finalize (ProtonPlusUtilsSystem * obj)
{
	ProtonPlusUtilsSystem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_SYSTEM, ProtonPlusUtilsSystem);
	g_signal_handlers_destroy (self);
}

static GType
proton_plus_utils_system_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { proton_plus_utils_value_system_init, proton_plus_utils_value_system_free_value, proton_plus_utils_value_system_copy_value, proton_plus_utils_value_system_peek_pointer, "p", proton_plus_utils_value_system_collect_value, "p", proton_plus_utils_value_system_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsSystemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_system_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsSystem), 0, (GInstanceInitFunc) proton_plus_utils_system_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType proton_plus_utils_system_type_id;
	proton_plus_utils_system_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ProtonPlusUtilsSystem", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return proton_plus_utils_system_type_id;
}

GType
proton_plus_utils_system_get_type (void)
{
	static volatile gsize proton_plus_utils_system_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_system_type_id__once)) {
		GType proton_plus_utils_system_type_id;
		proton_plus_utils_system_type_id = proton_plus_utils_system_get_type_once ();
		g_once_init_leave (&proton_plus_utils_system_type_id__once, proton_plus_utils_system_type_id);
	}
	return proton_plus_utils_system_type_id__once;
}

gpointer
proton_plus_utils_system_ref (gpointer instance)
{
	ProtonPlusUtilsSystem * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
proton_plus_utils_system_unref (gpointer instance)
{
	ProtonPlusUtilsSystem * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PROTON_PLUS_UTILS_SYSTEM_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

