static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan)

{

    int idx;

    NICInfo *nd;

    const char *netdev;



    idx = nic_get_free_idx();

    if (idx == -1 || nb_nics >= MAX_NICS) {

        error_report("Too Many NICs");

        return -1;

    }



    nd = &nd_table[idx];



    memset(nd, 0, sizeof(*nd));



    if ((netdev = qemu_opt_get(opts, "netdev"))) {

        nd->netdev = qemu_find_netdev(netdev);

        if (!nd->netdev) {

            error_report("netdev '%s' not found", netdev);

            return -1;

        }

    } else {

        assert(vlan);

        nd->vlan = vlan;

    }

    if (name) {

        nd->name = g_strdup(name);

    }

    if (qemu_opt_get(opts, "model")) {

        nd->model = g_strdup(qemu_opt_get(opts, "model"));

    }

    if (qemu_opt_get(opts, "addr")) {

        nd->devaddr = g_strdup(qemu_opt_get(opts, "addr"));

    }



    if (qemu_opt_get(opts, "macaddr") &&

        net_parse_macaddr(nd->macaddr.a, qemu_opt_get(opts, "macaddr")) < 0) {

        error_report("invalid syntax for ethernet address");

        return -1;

    }

    qemu_macaddr_default_if_unset(&nd->macaddr);



    nd->nvectors = qemu_opt_get_number(opts, "vectors",

                                       DEV_NVECTORS_UNSPECIFIED);

    if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&

        (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {

        error_report("invalid # of vectors: %d", nd->nvectors);

        return -1;

    }



    nd->used = 1;

    nb_nics++;



    return idx;

}

static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan)

{

    int idx;

    NICInfo *nd;

    const char *netdev;



    idx = nic_get_free_idx();

    if (idx == -1 || nb_nics >= MAX_NICS) {

        error_report("Too Many NICs");

        return -1;

    }



    nd = &nd_table[idx];



    memset(nd, 0, sizeof(*nd));



    if ((netdev = qemu_opt_get(opts, "netdev"))) {

        nd->netdev = qemu_find_netdev(netdev);

        if (!nd->netdev) {

            error_report("netdev '%s' not found", netdev);

            return -1;

        }

    } else {

        assert(vlan);

        nd->vlan = vlan;

    }

    if (name) {

        nd->name = g_strdup(name);

    }

    if (qemu_opt_get(opts, "model")) {

        nd->model = g_strdup(qemu_opt_get(opts, "model"));

    }

    if (qemu_opt_get(opts, "addr")) {

        nd->devaddr = g_strdup(qemu_opt_get(opts, "addr"));

    }



    if (qemu_opt_get(opts, "macaddr") &&

        net_parse_macaddr(nd->macaddr.a, qemu_opt_get(opts, "macaddr")) < 0) {

        error_report("invalid syntax for ethernet address");

        return -1;

    }

    qemu_macaddr_default_if_unset(&nd->macaddr);



    nd->nvectors = qemu_opt_get_number(opts, "vectors",

                                       DEV_NVECTORS_UNSPECIFIED);

    if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&

        (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {

        error_report("invalid # of vectors: %d", nd->nvectors);

        return -1;

    }



    nd->used = 1;

    nb_nics++;



    return idx;

}

static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan)         return -1;             return -1;             return -1;
static int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2)

{

    int VAR_3;

    NICInfo *nd;

    const char *VAR_4;



    VAR_3 = nic_get_free_idx();

    if (VAR_3 == -1 || nb_nics >= MAX_NICS) {

        error_report("Too Many NICs");

        return -1;

    }



    nd = &nd_table[VAR_3];



    memset(nd, 0, sizeof(*nd));



    if ((VAR_4 = qemu_opt_get(VAR_0, "VAR_4"))) {

        nd->VAR_4 = qemu_find_netdev(VAR_4);

        if (!nd->VAR_4) {

            error_report("VAR_4 '%s' not found", VAR_4);

            return -1;

        }

    } else {

        assert(VAR_2);

        nd->VAR_2 = VAR_2;

    }

    if (VAR_1) {

        nd->VAR_1 = g_strdup(VAR_1);

    }

    if (qemu_opt_get(VAR_0, "model")) {

        nd->model = g_strdup(qemu_opt_get(VAR_0, "model"));

    }

    if (qemu_opt_get(VAR_0, "addr")) {

        nd->devaddr = g_strdup(qemu_opt_get(VAR_0, "addr"));

    }



    if (qemu_opt_get(VAR_0, "macaddr") &&

        net_parse_macaddr(nd->macaddr.a, qemu_opt_get(VAR_0, "macaddr")) < 0) {

        error_report("invalid syntax for ethernet address");

        return -1;

    }

    qemu_macaddr_default_if_unset(&nd->macaddr);



    nd->nvectors = qemu_opt_get_number(VAR_0, "vectors",

                                       DEV_NVECTORS_UNSPECIFIED);

    if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&

        (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {

        error_report("invalid # of vectors: %d", nd->nvectors);

        return -1;

    }



    nd->used = 1;

    nb_nics++;



    return VAR_3;

}

static int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, VLANState *VAR_2)
{ int VAR_3; NICInfo *nd; const char *VAR_4; VAR_3 = nic_get_free_idx(); if (VAR_3 == -1 || nb_nics >= MAX_NICS) { error_report("Too Many NICs"); return -1; } nd = &nd_table[VAR_3]; memset(nd, 0, sizeof(*nd)); if ((VAR_4 = qemu_opt_get(VAR_0, "VAR_4"))) { nd->VAR_4 = qemu_find_netdev(VAR_4); if (!nd->VAR_4) { error_report("VAR_4 '%s' not found", VAR_4); return -1; } } else { assert(VAR_2); nd->VAR_2 = VAR_2; } if (VAR_1) { nd->VAR_1 = g_strdup(VAR_1); } if (qemu_opt_get(VAR_0, "model")) { nd->model = g_strdup(qemu_opt_get(VAR_0, "model")); } if (qemu_opt_get(VAR_0, "addr")) { nd->devaddr = g_strdup(qemu_opt_get(VAR_0, "addr")); } if (qemu_opt_get(VAR_0, "macaddr") &&
net_parse_macaddr(nd->macaddr.a, qemu_opt_get(VAR_0, "macaddr")) < 0) { error_report("invalid syntax for ethernet address"); return -1; } qemu_macaddr_default_if_unset(&nd->macaddr); nd->nvectors = qemu_opt_get_number(VAR_0, "vectors",
DEV_NVECTORS_UNSPECIFIED); if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&
(nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { error_report("invalid # of vectors: %d", nd->nvectors); return -1; } nd->used = 1; nb_nics++; return VAR_3; }