int qemu_acl_insert(qemu_acl *acl,

                    int deny,

                    const char *match,

                    int index)

{

    qemu_acl_entry *entry;

    qemu_acl_entry *tmp;

    int i = 0;



    if (index <= 0)

        return -1;

    if (index > acl->nentries) {

        return qemu_acl_append(acl, deny, match);

    }



    entry = g_malloc(sizeof(*entry));

    entry->match = g_strdup(match);

    entry->deny = deny;



    QTAILQ_FOREACH(tmp, &acl->entries, next) {

        i++;

        if (i == index) {

            QTAILQ_INSERT_BEFORE(tmp, entry, next);

            acl->nentries++;

            break;

        }

    }



    return i;

}

int qemu_acl_insert(qemu_acl *acl,

                    int deny,

                    const char *match,

                    int index)

{

    qemu_acl_entry *entry;

    qemu_acl_entry *tmp;

    int i = 0;



    if (index <= 0)

        return -1;

    if (index > acl->nentries) {

        return qemu_acl_append(acl, deny, match);

    }



    entry = g_malloc(sizeof(*entry));

    entry->match = g_strdup(match);

    entry->deny = deny;



    QTAILQ_FOREACH(tmp, &acl->entries, next) {

        i++;

        if (i == index) {

            QTAILQ_INSERT_BEFORE(tmp, entry, next);

            acl->nentries++;

            break;

        }

    }



    return i;

}

    qemu_acl_entry *entry;     entry = g_malloc(sizeof(*entry));     entry->match = g_strdup(match);     entry->deny = deny;
int FUNC_0(qemu_acl *VAR_0,

                    int VAR_1,

                    const char *VAR_2,

                    int VAR_3)

{

    qemu_acl_entry *entry;

    qemu_acl_entry *tmp;

    int VAR_4 = 0;



    if (VAR_3 <= 0)

        return -1;

    if (VAR_3 > VAR_0->nentries) {

        return qemu_acl_append(VAR_0, VAR_1, VAR_2);

    }



    entry = g_malloc(sizeof(*entry));

    entry->VAR_2 = g_strdup(VAR_2);

    entry->VAR_1 = VAR_1;



    QTAILQ_FOREACH(tmp, &VAR_0->entries, next) {

        VAR_4++;

        if (VAR_4 == VAR_3) {

            QTAILQ_INSERT_BEFORE(tmp, entry, next);

            VAR_0->nentries++;

            break;

        }

    }



    return VAR_4;

}

int FUNC_0(qemu_acl *VAR_0,
int VAR_1,
const char *VAR_2,
int VAR_3)
{ qemu_acl_entry *entry; qemu_acl_entry *tmp; int VAR_4 = 0; if (VAR_3 <= 0)
return -1; if (VAR_3 > VAR_0->nentries) { return qemu_acl_append(VAR_0, VAR_1, VAR_2); } entry = g_malloc(sizeof(*entry)); entry->VAR_2 = g_strdup(VAR_2); entry->VAR_1 = VAR_1; QTAILQ_FOREACH(tmp, &VAR_0->entries, next) { VAR_4++; if (VAR_4 == VAR_3) { QTAILQ_INSERT_BEFORE(tmp, entry, next); VAR_0->nentries++; break; } } return VAR_4; }