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

{

    static int monitor_device_index = 0;

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

    if (!opts) {

        fprintf(stderr, "duplicate chardev: %s\n", label);

        exit(1);

    }

    qemu_opt_set(opts, "mode", mode);

    qemu_opt_set(opts, "chardev", label);

    if (def)

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

    monitor_device_index++;

}

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

{

    static int monitor_device_index = 0;

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

    if (!opts) {

        fprintf(stderr, "duplicate chardev: %s\n", label);

        exit(1);

    }

    qemu_opt_set(opts, "mode", mode);

    qemu_opt_set(opts, "chardev", label);

    if (def)

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

    monitor_device_index++;

}

    opts = qemu_opts_create(qemu_find_opts("mon"), label, 1);
static void FUNC_0(const char *VAR_0, const char *VAR_1)

{

    static int VAR_2 = 0;

    QemuOpts *opts;

    const char *VAR_3;

    char VAR_4[32];

    int VAR_5 = 0;



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

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

    } else {

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

                 VAR_2);

        if (VAR_2 == 0) {

            VAR_5 = 1;

        }

        opts = qemu_chr_parse_compat(VAR_4, VAR_0);

        if (!opts) {

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

            exit(1);

        }

    }



    opts = qemu_opts_create(qemu_find_opts("mon"), VAR_4, 1);

    if (!opts) {

        fprintf(stderr, "duplicate chardev: %s\n", VAR_4);

        exit(1);

    }

    qemu_opt_set(opts, "VAR_1", VAR_1);

    qemu_opt_set(opts, "chardev", VAR_4);

    if (VAR_5)

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

    VAR_2++;

}

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