static bool qht_insert__locked(struct qht *ht, struct qht_map *map,

                               struct qht_bucket *head, void *p, uint32_t hash,

                               bool *needs_resize)

{

    struct qht_bucket *b = head;

    struct qht_bucket *prev = NULL;

    struct qht_bucket *new = NULL;

    int i;



    do {

        for (i = 0; i < QHT_BUCKET_ENTRIES; i++) {

            if (b->pointers[i]) {

                if (unlikely(b->pointers[i] == p)) {

                    return false;

                }

            } else {

                goto found;

            }

        }

        prev = b;

        b = b->next;

    } while (b);



    b = qemu_memalign(QHT_BUCKET_ALIGN, sizeof(*b));

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

    new = b;

    i = 0;

    atomic_inc(&map->n_added_buckets);

    if (unlikely(qht_map_needs_resize(map)) && needs_resize) {

        *needs_resize = true;

    }



 found:

    /* found an empty key: acquire the seqlock and write */

    seqlock_write_begin(&head->sequence);

    if (new) {

        atomic_rcu_set(&prev->next, b);

    }

    b->hashes[i] = hash;

    /* smp_wmb() implicit in seqlock_write_begin.  */

    atomic_set(&b->pointers[i], p);

    seqlock_write_end(&head->sequence);

    return true;

}

static bool qht_insert__locked(struct qht *ht, struct qht_map *map,

                               struct qht_bucket *head, void *p, uint32_t hash,

                               bool *needs_resize)

{

    struct qht_bucket *b = head;

    struct qht_bucket *prev = NULL;

    struct qht_bucket *new = NULL;

    int i;



    do {

        for (i = 0; i < QHT_BUCKET_ENTRIES; i++) {

            if (b->pointers[i]) {

                if (unlikely(b->pointers[i] == p)) {

                    return false;

                }

            } else {

                goto found;

            }

        }

        prev = b;

        b = b->next;

    } while (b);



    b = qemu_memalign(QHT_BUCKET_ALIGN, sizeof(*b));

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

    new = b;

    i = 0;

    atomic_inc(&map->n_added_buckets);

    if (unlikely(qht_map_needs_resize(map)) && needs_resize) {

        *needs_resize = true;

    }



 found:

    

    seqlock_write_begin(&head->sequence);

    if (new) {

        atomic_rcu_set(&prev->next, b);

    }

    b->hashes[i] = hash;

    

    atomic_set(&b->pointers[i], p);

    seqlock_write_end(&head->sequence);

    return true;

}

    b->hashes[i] = hash;
static bool FUNC_0(struct qht *ht, struct qht_map *map,

                               struct qht_bucket *head, void *p, uint32_t hash,

                               bool *needs_resize)

{

    struct qht_bucket *VAR_0 = head;

    struct qht_bucket *VAR_1 = NULL;

    struct qht_bucket *VAR_2 = NULL;

    int VAR_3;



    do {

        for (VAR_3 = 0; VAR_3 < QHT_BUCKET_ENTRIES; VAR_3++) {

            if (VAR_0->pointers[VAR_3]) {

                if (unlikely(VAR_0->pointers[VAR_3] == p)) {

                    return false;

                }

            } else {

                goto found;

            }

        }

        VAR_1 = VAR_0;

        VAR_0 = VAR_0->next;

    } while (VAR_0);



    VAR_0 = qemu_memalign(QHT_BUCKET_ALIGN, sizeof(*VAR_0));

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

    VAR_2 = VAR_0;

    VAR_3 = 0;

    atomic_inc(&map->n_added_buckets);

    if (unlikely(qht_map_needs_resize(map)) && needs_resize) {

        *needs_resize = true;

    }



 found:

    

    seqlock_write_begin(&head->sequence);

    if (VAR_2) {

        atomic_rcu_set(&VAR_1->next, VAR_0);

    }

    VAR_0->hashes[VAR_3] = hash;

    

    atomic_set(&VAR_0->pointers[VAR_3], p);

    seqlock_write_end(&head->sequence);

    return true;

}

static bool FUNC_0(struct qht *ht, struct qht_map *map,
struct qht_bucket *head, void *p, uint32_t hash,
bool *needs_resize)
{ struct qht_bucket *VAR_0 = head; struct qht_bucket *VAR_1 = NULL; struct qht_bucket *VAR_2 = NULL; int VAR_3; do { for (VAR_3 = 0; VAR_3 < QHT_BUCKET_ENTRIES; VAR_3++) { if (VAR_0->pointers[VAR_3]) { if (unlikely(VAR_0->pointers[VAR_3] == p)) { return false; } } else { goto found; } } VAR_1 = VAR_0; VAR_0 = VAR_0->next; } while (VAR_0); VAR_0 = qemu_memalign(QHT_BUCKET_ALIGN, sizeof(*VAR_0)); memset(VAR_0, 0, sizeof(*VAR_0)); VAR_2 = VAR_0; VAR_3 = 0; atomic_inc(&map->n_added_buckets); if (unlikely(qht_map_needs_resize(map)) && needs_resize) { *needs_resize = true; } found:
seqlock_write_begin(&head->sequence); if (VAR_2) { atomic_rcu_set(&VAR_1->next, VAR_0); } VAR_0->hashes[VAR_3] = hash; atomic_set(&VAR_0->pointers[VAR_3], p); seqlock_write_end(&head->sequence); return true; }