int net_init_slirp(QemuOpts *opts,

                   Monitor *mon,

                   const char *name,

                   VLANState *vlan)

{

    struct slirp_config_str *config;

    const char *vhost;

    const char *vhostname;

    const char *vdhcp_start;

    const char *vnamesrv;

    const char *tftp_export;

    const char *bootfile;

    const char *smb_export;

    const char *vsmbsrv;

    char *vnet = NULL;

    int restricted = 0;

    int ret;



    vhost       = qemu_opt_get(opts, "host");

    vhostname   = qemu_opt_get(opts, "hostname");

    vdhcp_start = qemu_opt_get(opts, "dhcpstart");

    vnamesrv    = qemu_opt_get(opts, "dns");

    tftp_export = qemu_opt_get(opts, "tftp");

    bootfile    = qemu_opt_get(opts, "bootfile");

    smb_export  = qemu_opt_get(opts, "smb");

    vsmbsrv     = qemu_opt_get(opts, "smbserver");



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

        const char *ip = qemu_opt_get(opts, "ip");

        int l = strlen(ip) + strlen("/24") + 1;



        vnet = qemu_malloc(l);



        /* emulate legacy ip= parameter */

        pstrcpy(vnet, l, ip);

        pstrcat(vnet, l, "/24");

    }



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

        if (vnet) {

            qemu_free(vnet);

        }

        vnet = qemu_strdup(qemu_opt_get(opts, "net"));

    }



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

        qemu_opt_get(opts, "restrict")[0] == 'y') {

        restricted = 1;

    }



    qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0);



    ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost,

                         vhostname, tftp_export, bootfile, vdhcp_start,

                         vnamesrv, smb_export, vsmbsrv);



    while (slirp_configs) {

        config = slirp_configs;

        slirp_configs = config->next;

        qemu_free(config);

    }



    if (ret != -1 && vlan) {

        vlan->nb_host_devs++;

    }



    qemu_free(vnet);



    return ret;

}

int net_init_slirp(QemuOpts *opts,

                   Monitor *mon,

                   const char *name,

                   VLANState *vlan)

{

    struct slirp_config_str *config;

    const char *vhost;

    const char *vhostname;

    const char *vdhcp_start;

    const char *vnamesrv;

    const char *tftp_export;

    const char *bootfile;

    const char *smb_export;

    const char *vsmbsrv;

    char *vnet = NULL;

    int restricted = 0;

    int ret;



    vhost       = qemu_opt_get(opts, "host");

    vhostname   = qemu_opt_get(opts, "hostname");

    vdhcp_start = qemu_opt_get(opts, "dhcpstart");

    vnamesrv    = qemu_opt_get(opts, "dns");

    tftp_export = qemu_opt_get(opts, "tftp");

    bootfile    = qemu_opt_get(opts, "bootfile");

    smb_export  = qemu_opt_get(opts, "smb");

    vsmbsrv     = qemu_opt_get(opts, "smbserver");



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

        const char *ip = qemu_opt_get(opts, "ip");

        int l = strlen(ip) + strlen("/24") + 1;



        vnet = qemu_malloc(l);



        

        pstrcpy(vnet, l, ip);

        pstrcat(vnet, l, "/24");

    }



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

        if (vnet) {

            qemu_free(vnet);

        }

        vnet = qemu_strdup(qemu_opt_get(opts, "net"));

    }



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

        qemu_opt_get(opts, "restrict")[0] == 'y') {

        restricted = 1;

    }



    qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0);



    ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost,

                         vhostname, tftp_export, bootfile, vdhcp_start,

                         vnamesrv, smb_export, vsmbsrv);



    while (slirp_configs) {

        config = slirp_configs;

        slirp_configs = config->next;

        qemu_free(config);

    }



    if (ret != -1 && vlan) {

        vlan->nb_host_devs++;

    }



    qemu_free(vnet);



    return ret;

}

int FUNC_0(QemuOpts *VAR_0,

                   Monitor *VAR_1,

                   const char *VAR_2,

                   VLANState *VAR_3)

{

    struct slirp_config_str *VAR_4;

    const char *VAR_5;

    const char *VAR_6;

    const char *VAR_7;

    const char *VAR_8;

    const char *VAR_9;

    const char *VAR_10;

    const char *VAR_11;

    const char *VAR_12;

    char *VAR_13 = NULL;

    int VAR_14 = 0;

    int VAR_15;



    VAR_5       = qemu_opt_get(VAR_0, "host");

    VAR_6   = qemu_opt_get(VAR_0, "hostname");

    VAR_7 = qemu_opt_get(VAR_0, "dhcpstart");

    VAR_8    = qemu_opt_get(VAR_0, "dns");

    VAR_9 = qemu_opt_get(VAR_0, "tftp");

    VAR_10    = qemu_opt_get(VAR_0, "VAR_10");

    VAR_11  = qemu_opt_get(VAR_0, "smb");

    VAR_12     = qemu_opt_get(VAR_0, "smbserver");



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

        const char *VAR_16 = qemu_opt_get(VAR_0, "VAR_16");

        int VAR_17 = strlen(VAR_16) + strlen("/24") + 1;



        VAR_13 = qemu_malloc(VAR_17);



        

        pstrcpy(VAR_13, VAR_17, VAR_16);

        pstrcat(VAR_13, VAR_17, "/24");

    }



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

        if (VAR_13) {

            qemu_free(VAR_13);

        }

        VAR_13 = qemu_strdup(qemu_opt_get(VAR_0, "net"));

    }



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

        qemu_opt_get(VAR_0, "restrict")[0] == 'y') {

        VAR_14 = 1;

    }



    qemu_opt_foreach(VAR_0, net_init_slirp_configs, NULL, 0);



    VAR_15 = net_slirp_init(VAR_3, "user", VAR_2, VAR_14, VAR_13, VAR_5,

                         VAR_6, VAR_9, VAR_10, VAR_7,

                         VAR_8, VAR_11, VAR_12);



    while (slirp_configs) {

        VAR_4 = slirp_configs;

        slirp_configs = VAR_4->next;

        qemu_free(VAR_4);

    }



    if (VAR_15 != -1 && VAR_3) {

        VAR_3->nb_host_devs++;

    }



    qemu_free(VAR_13);



    return VAR_15;

}

int FUNC_0(QemuOpts *VAR_0,
Monitor *VAR_1,
const char *VAR_2,
VLANState *VAR_3)
{ struct slirp_config_str *VAR_4; const char *VAR_5; const char *VAR_6; const char *VAR_7; const char *VAR_8; const char *VAR_9; const char *VAR_10; const char *VAR_11; const char *VAR_12; char *VAR_13 = NULL; int VAR_14 = 0; int VAR_15; VAR_5       = qemu_opt_get(VAR_0, "host"); VAR_6   = qemu_opt_get(VAR_0, "hostname"); VAR_7 = qemu_opt_get(VAR_0, "dhcpstart"); VAR_8    = qemu_opt_get(VAR_0, "dns"); VAR_9 = qemu_opt_get(VAR_0, "tftp"); VAR_10    = qemu_opt_get(VAR_0, "VAR_10"); VAR_11  = qemu_opt_get(VAR_0, "smb"); VAR_12     = qemu_opt_get(VAR_0, "smbserver"); if (qemu_opt_get(VAR_0, "VAR_16")) { const char *VAR_16 = qemu_opt_get(VAR_0, "VAR_16"); int VAR_17 = strlen(VAR_16) + strlen("/24") + 1; VAR_13 = qemu_malloc(VAR_17); pstrcpy(VAR_13, VAR_17, VAR_16); pstrcat(VAR_13, VAR_17, "/24"); } if (qemu_opt_get(VAR_0, "net")) { if (VAR_13) { qemu_free(VAR_13); } VAR_13 = qemu_strdup(qemu_opt_get(VAR_0, "net")); } if (qemu_opt_get(VAR_0, "restrict") &&
qemu_opt_get(VAR_0, "restrict")[0] == 'y') { VAR_14 = 1; } qemu_opt_foreach(VAR_0, net_init_slirp_configs, NULL, 0); VAR_15 = net_slirp_init(VAR_3, "user", VAR_2, VAR_14, VAR_13, VAR_5,
VAR_6, VAR_9, VAR_10, VAR_7,
VAR_8, VAR_11, VAR_12); while (slirp_configs) { VAR_4 = slirp_configs; slirp_configs = VAR_4->next; qemu_free(VAR_4); } if (VAR_15 != -1 && VAR_3) { VAR_3->nb_host_devs++; } qemu_free(VAR_13); return VAR_15; }