static void monitor_parse(const char *optarg, const char *mode, bool pretty)

{

    static int monitor_device_index = 0;

    Error *local_err = NULL;

    QemuOpts *opts;

    const char *p;

    char label[32];

    int def = 0;



    if (strstart(optarg, "chardev:", &p)) {

        snprintf(label, sizeof(label), "%s", p);

    } else {

        snprintf(label, sizeof(label), "compat_monitor%d",

                 monitor_device_index);

        if (monitor_device_index == 0) {

            def = 1;

        }

        opts = qemu_chr_parse_compat(label, optarg);

        if (!opts) {

            fprintf(stderr, "parse error: %s\n", optarg);

            exit(1);

        }

    }



    opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &local_err);

    if (!opts) {

        error_report_err(local_err);

        exit(1);

    }

    qemu_opt_set(opts, "mode", mode, &error_abort);

    qemu_opt_set(opts, "chardev", label, &error_abort);

    qemu_opt_set_bool(opts, "pretty", pretty, &error_abort);

    if (def)

        qemu_opt_set(opts, "default", "on", &error_abort);

    monitor_device_index++;

}

static void monitor_parse(const char *optarg, const char *mode, bool pretty)

{

    static int monitor_device_index = 0;

    Error *local_err = NULL;

    QemuOpts *opts;

    const char *p;

    char label[32];

    int def = 0;



    if (strstart(optarg, "chardev:", &p)) {

        snprintf(label, sizeof(label), "%s", p);

    } else {

        snprintf(label, sizeof(label), "compat_monitor%d",

                 monitor_device_index);

        if (monitor_device_index == 0) {

            def = 1;

        }

        opts = qemu_chr_parse_compat(label, optarg);

        if (!opts) {

            fprintf(stderr, "parse error: %s\n", optarg);

            exit(1);

        }

    }



    opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &local_err);

    if (!opts) {

        error_report_err(local_err);

        exit(1);

    }

    qemu_opt_set(opts, "mode", mode, &error_abort);

    qemu_opt_set(opts, "chardev", label, &error_abort);

    qemu_opt_set_bool(opts, "pretty", pretty, &error_abort);

    if (def)

        qemu_opt_set(opts, "default", "on", &error_abort);

    monitor_device_index++;

}

static void FUNC_0(const char *VAR_0, const char *VAR_1, bool VAR_2)

{

    static int VAR_3 = 0;

    Error *local_err = NULL;

    QemuOpts *opts;

    const char *VAR_4;

    char VAR_5[32];

    int VAR_6 = 0;



    if (strstart(VAR_0, "chardev:", &VAR_4)) {

        snprintf(VAR_5, sizeof(VAR_5), "%s", VAR_4);

    } else {

        snprintf(VAR_5, sizeof(VAR_5), "compat_monitor%d",

                 VAR_3);

        if (VAR_3 == 0) {

            VAR_6 = 1;

        }

        opts = qemu_chr_parse_compat(VAR_5, VAR_0);

        if (!opts) {

            fprintf(stderr, "parse error: %s\n", VAR_0);

            exit(1);

        }

    }



    opts = qemu_opts_create(qemu_find_opts("mon"), VAR_5, 1, &local_err);

    if (!opts) {

        error_report_err(local_err);

        exit(1);

    }

    qemu_opt_set(opts, "VAR_1", VAR_1, &error_abort);

    qemu_opt_set(opts, "chardev", VAR_5, &error_abort);

    qemu_opt_set_bool(opts, "VAR_2", VAR_2, &error_abort);

    if (VAR_6)

        qemu_opt_set(opts, "default", "on", &error_abort);

    VAR_3++;

}

static void FUNC_0(const char *VAR_0, const char *VAR_1, bool VAR_2)
{ static int VAR_3 = 0; Error *local_err = NULL; QemuOpts *opts; const char *VAR_4; char VAR_5[32]; int VAR_6 = 0; if (strstart(VAR_0, "chardev:", &VAR_4)) { snprintf(VAR_5, sizeof(VAR_5), "%s", VAR_4); } else { snprintf(VAR_5, sizeof(VAR_5), "compat_monitor%d",
VAR_3); if (VAR_3 == 0) { VAR_6 = 1; } opts = qemu_chr_parse_compat(VAR_5, VAR_0); if (!opts) { fprintf(stderr, "parse error: %s\n", VAR_0); exit(1); } } opts = qemu_opts_create(qemu_find_opts("mon"), VAR_5, 1, &local_err); if (!opts) { error_report_err(local_err); exit(1); } qemu_opt_set(opts, "VAR_1", VAR_1, &error_abort); qemu_opt_set(opts, "chardev", VAR_5, &error_abort); qemu_opt_set_bool(opts, "VAR_2", VAR_2, &error_abort); if (VAR_6)
qemu_opt_set(opts, "default", "on", &error_abort); VAR_3++; }