static int net_init_nic(const NetClientOptions *opts, const char *name,

                        NetClientState *peer, Error **errp)

{

    /* FIXME error_setg(errp, ...) on failure */

    int idx;

    NICInfo *nd;

    const NetLegacyNicOptions *nic;



    assert(opts->kind == NET_CLIENT_OPTIONS_KIND_NIC);

    nic = opts->nic;



    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 (nic->has_netdev) {

        nd->netdev = qemu_find_netdev(nic->netdev);

        if (!nd->netdev) {

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

            return -1;

        }

    } else {

        assert(peer);

        nd->netdev = peer;

    }

    nd->name = g_strdup(name);

    if (nic->has_model) {

        nd->model = g_strdup(nic->model);

    }

    if (nic->has_addr) {

        nd->devaddr = g_strdup(nic->addr);

    }



    if (nic->has_macaddr &&

        net_parse_macaddr(nd->macaddr.a, nic->macaddr) < 0) {

        error_report("invalid syntax for ethernet address");

        return -1;

    }

    if (nic->has_macaddr &&

        is_multicast_ether_addr(nd->macaddr.a)) {

        error_report("NIC cannot have multicast MAC address (odd 1st byte)");

        return -1;

    }

    qemu_macaddr_default_if_unset(&nd->macaddr);



    if (nic->has_vectors) {

        if (nic->vectors > 0x7ffffff) {

            error_report("invalid # of vectors: %"PRIu32, nic->vectors);

            return -1;

        }

        nd->nvectors = nic->vectors;

    } else {

        nd->nvectors = DEV_NVECTORS_UNSPECIFIED;

    }



    nd->used = 1;

    nb_nics++;



    return idx;

}

static int net_init_nic(const NetClientOptions *opts, const char *name,

                        NetClientState *peer, Error **errp)

{

    

    int idx;

    NICInfo *nd;

    const NetLegacyNicOptions *nic;



    assert(opts->kind == NET_CLIENT_OPTIONS_KIND_NIC);

    nic = opts->nic;



    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 (nic->has_netdev) {

        nd->netdev = qemu_find_netdev(nic->netdev);

        if (!nd->netdev) {

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

            return -1;

        }

    } else {

        assert(peer);

        nd->netdev = peer;

    }

    nd->name = g_strdup(name);

    if (nic->has_model) {

        nd->model = g_strdup(nic->model);

    }

    if (nic->has_addr) {

        nd->devaddr = g_strdup(nic->addr);

    }



    if (nic->has_macaddr &&

        net_parse_macaddr(nd->macaddr.a, nic->macaddr) < 0) {

        error_report("invalid syntax for ethernet address");

        return -1;

    }

    if (nic->has_macaddr &&

        is_multicast_ether_addr(nd->macaddr.a)) {

        error_report("NIC cannot have multicast MAC address (odd 1st byte)");

        return -1;

    }

    qemu_macaddr_default_if_unset(&nd->macaddr);



    if (nic->has_vectors) {

        if (nic->vectors > 0x7ffffff) {

            error_report("invalid # of vectors: %"PRIu32, nic->vectors);

            return -1;

        }

        nd->nvectors = nic->vectors;

    } else {

        nd->nvectors = DEV_NVECTORS_UNSPECIFIED;

    }



    nd->used = 1;

    nb_nics++;



    return idx;

}

        error_report("Too Many NICs");             error_report("netdev '%s' not found", nic->netdev);         error_report("invalid syntax for ethernet address");         error_report("NIC cannot have multicast MAC address (odd 1st byte)");             error_report("invalid # of vectors: %"PRIu32, nic->vectors);
static int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,

                        NetClientState *VAR_2, Error **VAR_3)

{

    

    int VAR_4;

    NICInfo *nd;

    const NetLegacyNicOptions *VAR_5;



    assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_NIC);

    VAR_5 = VAR_0->VAR_5;



    VAR_4 = nic_get_free_idx();

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

        error_report("Too Many NICs");

        return -1;

    }



    nd = &nd_table[VAR_4];



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



    if (VAR_5->has_netdev) {

        nd->netdev = qemu_find_netdev(VAR_5->netdev);

        if (!nd->netdev) {

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

            return -1;

        }

    } else {

        assert(VAR_2);

        nd->netdev = VAR_2;

    }

    nd->VAR_1 = g_strdup(VAR_1);

    if (VAR_5->has_model) {

        nd->model = g_strdup(VAR_5->model);

    }

    if (VAR_5->has_addr) {

        nd->devaddr = g_strdup(VAR_5->addr);

    }



    if (VAR_5->has_macaddr &&

        net_parse_macaddr(nd->macaddr.a, VAR_5->macaddr) < 0) {

        error_report("invalid syntax for ethernet address");

        return -1;

    }

    if (VAR_5->has_macaddr &&

        is_multicast_ether_addr(nd->macaddr.a)) {

        error_report("NIC cannot have multicast MAC address (odd 1st byte)");

        return -1;

    }

    qemu_macaddr_default_if_unset(&nd->macaddr);



    if (VAR_5->has_vectors) {

        if (VAR_5->vectors > 0x7ffffff) {

            error_report("invalid # of vectors: %"PRIu32, VAR_5->vectors);

            return -1;

        }

        nd->nvectors = VAR_5->vectors;

    } else {

        nd->nvectors = DEV_NVECTORS_UNSPECIFIED;

    }



    nd->used = 1;

    nb_nics++;



    return VAR_4;

}

static int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,
NetClientState *VAR_2, Error **VAR_3)
{ int VAR_4; NICInfo *nd; const NetLegacyNicOptions *VAR_5; assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_NIC); VAR_5 = VAR_0->VAR_5; VAR_4 = nic_get_free_idx(); if (VAR_4 == -1 || nb_nics >= MAX_NICS) { error_report("Too Many NICs"); return -1; } nd = &nd_table[VAR_4]; memset(nd, 0, sizeof(*nd)); if (VAR_5->has_netdev) { nd->netdev = qemu_find_netdev(VAR_5->netdev); if (!nd->netdev) { error_report("netdev '%s' not found", VAR_5->netdev); return -1; } } else { assert(VAR_2); nd->netdev = VAR_2; } nd->VAR_1 = g_strdup(VAR_1); if (VAR_5->has_model) { nd->model = g_strdup(VAR_5->model); } if (VAR_5->has_addr) { nd->devaddr = g_strdup(VAR_5->addr); } if (VAR_5->has_macaddr &&
net_parse_macaddr(nd->macaddr.a, VAR_5->macaddr) < 0) { error_report("invalid syntax for ethernet address"); return -1; } if (VAR_5->has_macaddr &&
is_multicast_ether_addr(nd->macaddr.a)) { error_report("NIC cannot have multicast MAC address (odd 1st byte)"); return -1; } qemu_macaddr_default_if_unset(&nd->macaddr); if (VAR_5->has_vectors) { if (VAR_5->vectors > 0x7ffffff) { error_report("invalid # of vectors: %"PRIu32, VAR_5->vectors); return -1; } nd->nvectors = VAR_5->vectors; } else { nd->nvectors = DEV_NVECTORS_UNSPECIFIED; } nd->used = 1; nb_nics++; return VAR_4; }