int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table)

{

    int i = qcow2_cache_get_table_idx(bs, c, *table);



    if (c->entries[i].offset == 0) {

        return -ENOENT;

    }



    c->entries[i].ref--;

    *table = NULL;



    if (c->entries[i].ref == 0) {

        c->entries[i].lru_counter = ++c->lru_counter;

    }



    assert(c->entries[i].ref >= 0);

    return 0;

}

int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table)

{

    int i = qcow2_cache_get_table_idx(bs, c, *table);



    if (c->entries[i].offset == 0) {

        return -ENOENT;

    }



    c->entries[i].ref--;

    *table = NULL;



    if (c->entries[i].ref == 0) {

        c->entries[i].lru_counter = ++c->lru_counter;

    }



    assert(c->entries[i].ref >= 0);

    return 0;

}

int FUNC_0(BlockDriverState *VAR_0, Qcow2Cache *VAR_1, void **VAR_2)

{

    int VAR_3 = qcow2_cache_get_table_idx(VAR_0, VAR_1, *VAR_2);



    if (VAR_1->entries[VAR_3].offset == 0) {

        return -ENOENT;

    }



    VAR_1->entries[VAR_3].ref--;

    *VAR_2 = NULL;



    if (VAR_1->entries[VAR_3].ref == 0) {

        VAR_1->entries[VAR_3].lru_counter = ++VAR_1->lru_counter;

    }



    assert(VAR_1->entries[VAR_3].ref >= 0);

    return 0;

}

int FUNC_0(BlockDriverState *VAR_0, Qcow2Cache *VAR_1, void **VAR_2)
{ int VAR_3 = qcow2_cache_get_table_idx(VAR_0, VAR_1, *VAR_2); if (VAR_1->entries[VAR_3].offset == 0) { return -ENOENT; } VAR_1->entries[VAR_3].ref--; *VAR_2 = NULL; if (VAR_1->entries[VAR_3].ref == 0) { VAR_1->entries[VAR_3].lru_counter = ++VAR_1->lru_counter; } assert(VAR_1->entries[VAR_3].ref >= 0); return 0; }