void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table)

{

    CachedL2Table *entry;



    entry = qed_find_l2_cache_entry(l2_cache, l2_table->offset);

    if (entry) {

        qed_unref_l2_cache_entry(entry);

        qed_unref_l2_cache_entry(l2_table);

        return;

    }



    if (l2_cache->n_entries >= MAX_L2_CACHE_SIZE) {

        entry = QTAILQ_FIRST(&l2_cache->entries);

        QTAILQ_REMOVE(&l2_cache->entries, entry, node);

        l2_cache->n_entries--;

        qed_unref_l2_cache_entry(entry);

    }



    l2_cache->n_entries++;

    QTAILQ_INSERT_TAIL(&l2_cache->entries, l2_table, node);

}

void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table)

{

    CachedL2Table *entry;



    entry = qed_find_l2_cache_entry(l2_cache, l2_table->offset);

    if (entry) {

        qed_unref_l2_cache_entry(entry);

        qed_unref_l2_cache_entry(l2_table);

        return;

    }



    if (l2_cache->n_entries >= MAX_L2_CACHE_SIZE) {

        entry = QTAILQ_FIRST(&l2_cache->entries);

        QTAILQ_REMOVE(&l2_cache->entries, entry, node);

        l2_cache->n_entries--;

        qed_unref_l2_cache_entry(entry);

    }



    l2_cache->n_entries++;

    QTAILQ_INSERT_TAIL(&l2_cache->entries, l2_table, node);

}

        entry = QTAILQ_FIRST(&l2_cache->entries);         QTAILQ_REMOVE(&l2_cache->entries, entry, node);         l2_cache->n_entries--;         qed_unref_l2_cache_entry(entry);
void FUNC_0(L2TableCache *VAR_0, CachedL2Table *VAR_1)

{

    CachedL2Table *entry;



    entry = qed_find_l2_cache_entry(VAR_0, VAR_1->offset);

    if (entry) {

        qed_unref_l2_cache_entry(entry);

        qed_unref_l2_cache_entry(VAR_1);

        return;

    }



    if (VAR_0->n_entries >= MAX_L2_CACHE_SIZE) {

        entry = QTAILQ_FIRST(&VAR_0->entries);

        QTAILQ_REMOVE(&VAR_0->entries, entry, node);

        VAR_0->n_entries--;

        qed_unref_l2_cache_entry(entry);

    }



    VAR_0->n_entries++;

    QTAILQ_INSERT_TAIL(&VAR_0->entries, VAR_1, node);

}

void FUNC_0(L2TableCache *VAR_0, CachedL2Table *VAR_1)
{ CachedL2Table *entry; entry = qed_find_l2_cache_entry(VAR_0, VAR_1->offset); if (entry) { qed_unref_l2_cache_entry(entry); qed_unref_l2_cache_entry(VAR_1); return; } if (VAR_0->n_entries >= MAX_L2_CACHE_SIZE) { entry = QTAILQ_FIRST(&VAR_0->entries); QTAILQ_REMOVE(&VAR_0->entries, entry, node); VAR_0->n_entries--; qed_unref_l2_cache_entry(entry); } VAR_0->n_entries++; QTAILQ_INSERT_TAIL(&VAR_0->entries, VAR_1, node); }