static int virtcon_parse(const char *devname)

{

    QemuOptsList *device = qemu_find_opts("device");

    static int index = 0;

    char label[32];

    QemuOpts *bus_opts, *dev_opts;



    if (strcmp(devname, "none") == 0)

        return 0;

    if (index == MAX_VIRTIO_CONSOLES) {

        fprintf(stderr, "qemu: too many virtio consoles\n");

        exit(1);

    }



    bus_opts = qemu_opts_create(device, NULL, 0);

    if (arch_type == QEMU_ARCH_S390X) {

        qemu_opt_set(bus_opts, "driver", "virtio-serial-s390");

    } else {

        qemu_opt_set(bus_opts, "driver", "virtio-serial-pci");

    } 



    dev_opts = qemu_opts_create(device, NULL, 0);

    qemu_opt_set(dev_opts, "driver", "virtconsole");



    snprintf(label, sizeof(label), "virtcon%d", index);

    virtcon_hds[index] = qemu_chr_new(label, devname, NULL);

    if (!virtcon_hds[index]) {

        fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",

                devname, strerror(errno));

        return -1;

    }

    qemu_opt_set(dev_opts, "chardev", label);



    index++;

    return 0;

}

static int virtcon_parse(const char *devname)

{

    QemuOptsList *device = qemu_find_opts("device");

    static int index = 0;

    char label[32];

    QemuOpts *bus_opts, *dev_opts;



    if (strcmp(devname, "none") == 0)

        return 0;

    if (index == MAX_VIRTIO_CONSOLES) {

        fprintf(stderr, "qemu: too many virtio consoles\n");

        exit(1);

    }



    bus_opts = qemu_opts_create(device, NULL, 0);

    if (arch_type == QEMU_ARCH_S390X) {

        qemu_opt_set(bus_opts, "driver", "virtio-serial-s390");

    } else {

        qemu_opt_set(bus_opts, "driver", "virtio-serial-pci");

    } 



    dev_opts = qemu_opts_create(device, NULL, 0);

    qemu_opt_set(dev_opts, "driver", "virtconsole");



    snprintf(label, sizeof(label), "virtcon%d", index);

    virtcon_hds[index] = qemu_chr_new(label, devname, NULL);

    if (!virtcon_hds[index]) {

        fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",

                devname, strerror(errno));

        return -1;

    }

    qemu_opt_set(dev_opts, "chardev", label);



    index++;

    return 0;

}

    bus_opts = qemu_opts_create(device, NULL, 0);     dev_opts = qemu_opts_create(device, NULL, 0);
static int FUNC_0(const char *VAR_0)

{

    QemuOptsList *device = qemu_find_opts("device");

    static int VAR_1 = 0;

    char VAR_2[32];

    QemuOpts *bus_opts, *dev_opts;



    if (strcmp(VAR_0, "none") == 0)

        return 0;

    if (VAR_1 == MAX_VIRTIO_CONSOLES) {

        fprintf(stderr, "qemu: too many virtio consoles\n");

        exit(1);

    }



    bus_opts = qemu_opts_create(device, NULL, 0);

    if (arch_type == QEMU_ARCH_S390X) {

        qemu_opt_set(bus_opts, "driver", "virtio-serial-s390");

    } else {

        qemu_opt_set(bus_opts, "driver", "virtio-serial-pci");

    } 



    dev_opts = qemu_opts_create(device, NULL, 0);

    qemu_opt_set(dev_opts, "driver", "virtconsole");



    snprintf(VAR_2, sizeof(VAR_2), "virtcon%d", VAR_1);

    virtcon_hds[VAR_1] = qemu_chr_new(VAR_2, VAR_0, NULL);

    if (!virtcon_hds[VAR_1]) {

        fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",

                VAR_0, strerror(errno));

        return -1;

    }

    qemu_opt_set(dev_opts, "chardev", VAR_2);



    VAR_1++;

    return 0;

}

static int FUNC_0(const char *VAR_0)
{ QemuOptsList *device = qemu_find_opts("device"); static int VAR_1 = 0; char VAR_2[32]; QemuOpts *bus_opts, *dev_opts; if (strcmp(VAR_0, "none") == 0)
return 0; if (VAR_1 == MAX_VIRTIO_CONSOLES) { fprintf(stderr, "qemu: too many virtio consoles\n"); exit(1); } bus_opts = qemu_opts_create(device, NULL, 0); if (arch_type == QEMU_ARCH_S390X) { qemu_opt_set(bus_opts, "driver", "virtio-serial-s390"); } else { qemu_opt_set(bus_opts, "driver", "virtio-serial-pci"); } dev_opts = qemu_opts_create(device, NULL, 0); qemu_opt_set(dev_opts, "driver", "virtconsole"); snprintf(VAR_2, sizeof(VAR_2), "virtcon%d", VAR_1); virtcon_hds[VAR_1] = qemu_chr_new(VAR_2, VAR_0, NULL); if (!virtcon_hds[VAR_1]) { fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
VAR_0, strerror(errno)); return -1; } qemu_opt_set(dev_opts, "chardev", VAR_2); VAR_1++; return 0; }