static int write_refcount_block_entries(BlockDriverState *bs,
    int64_t refcount_block_offset, int first_index, int last_index)
{
    BDRVQcowState *s = bs->opaque;
    size_t size;
    int ret;
    if (cache_refcount_updates) {
    first_index &= ~(REFCOUNTS_PER_SECTOR - 1);
    last_index = (last_index + REFCOUNTS_PER_SECTOR)
        & ~(REFCOUNTS_PER_SECTOR - 1);
    size = (last_index - first_index) << REFCOUNT_SHIFT;
    BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART);
    ret = bdrv_pwrite(bs->file,
        refcount_block_offset + (first_index << REFCOUNT_SHIFT),
        &s->refcount_block_cache[first_index], size);
    if (ret < 0) {
        return ret;
static int write_refcount_block_entries(BlockDriverState *bs,
    int64_t refcount_block_offset, int first_index, int last_index)
{
    BDRVQcowState *s = bs->opaque;
    size_t size;
    int ret;
    if (cache_refcount_updates) {
    first_index &= ~(REFCOUNTS_PER_SECTOR - 1);
    last_index = (last_index + REFCOUNTS_PER_SECTOR)
        & ~(REFCOUNTS_PER_SECTOR - 1);
    size = (last_index - first_index) << REFCOUNT_SHIFT;
    BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART);
    ret = bdrv_pwrite(bs->file,
        refcount_block_offset + (first_index << REFCOUNT_SHIFT),
        &s->refcount_block_cache[first_index], size);
    if (ret < 0) {
        return ret;
static int FUNC_0(BlockDriverState *VAR_0,
    int64_t VAR_1, int VAR_2, int VAR_3)
{
    BDRVQcowState *s = VAR_0->opaque;
    size_t size;
    int VAR_4;
    if (cache_refcount_updates) {
    VAR_2 &= ~(REFCOUNTS_PER_SECTOR - 1);
    VAR_3 = (VAR_3 + REFCOUNTS_PER_SECTOR)
        & ~(REFCOUNTS_PER_SECTOR - 1);
    size = (VAR_3 - VAR_2) << REFCOUNT_SHIFT;
    BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_UPDATE_PART);
    VAR_4 = bdrv_pwrite(VAR_0->file,
        VAR_1 + (VAR_2 << REFCOUNT_SHIFT),
        &s->refcount_block_cache[VAR_2], size);
    if (VAR_4 < 0) {
        return VAR_4;
static int FUNC_0(BlockDriverState *VAR_0,
int64_t VAR_1, int VAR_2, int VAR_3)
{ BDRVQcowState *s = VAR_0->opaque; size_t size; int VAR_4; if (cache_refcount_updates) { VAR_2 &= ~(REFCOUNTS_PER_SECTOR - 1); VAR_3 = (VAR_3 + REFCOUNTS_PER_SECTOR)
& ~(REFCOUNTS_PER_SECTOR - 1); size = (VAR_3 - VAR_2) << REFCOUNT_SHIFT; BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_UPDATE_PART); VAR_4 = bdrv_pwrite(VAR_0->file,
VAR_1 + (VAR_2 << REFCOUNT_SHIFT),
&s->refcount_block_cache[VAR_2], size); if (VAR_4 < 0) { return VAR_4;