static int inc_refcounts(BlockDriverState *bs,

                          uint16_t *refcount_table,

                          int refcount_table_size,

                          int64_t offset, int64_t size)

{

    BDRVQcowState *s = bs->opaque;

    int64_t start, last, cluster_offset;

    int k;

    int errors = 0;



    if (size <= 0)

        return 0;



    start = offset & ~(s->cluster_size - 1);

    last = (offset + size - 1) & ~(s->cluster_size - 1);

    for(cluster_offset = start; cluster_offset <= last;

        cluster_offset += s->cluster_size) {

        k = cluster_offset >> s->cluster_bits;

        if (k < 0 || k >= refcount_table_size) {

            fprintf(stderr, "ERROR: invalid cluster offset=0x%" PRIx64 "\n",

                cluster_offset);

            errors++;

        } else {

            if (++refcount_table[k] == 0) {

                fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64

                    "\n", cluster_offset);

                errors++;

            }

        }

    }



    return errors;

}

static int inc_refcounts(BlockDriverState *bs,

                          uint16_t *refcount_table,

                          int refcount_table_size,

                          int64_t offset, int64_t size)

{

    BDRVQcowState *s = bs->opaque;

    int64_t start, last, cluster_offset;

    int k;

    int errors = 0;



    if (size <= 0)

        return 0;



    start = offset & ~(s->cluster_size - 1);

    last = (offset + size - 1) & ~(s->cluster_size - 1);

    for(cluster_offset = start; cluster_offset <= last;

        cluster_offset += s->cluster_size) {

        k = cluster_offset >> s->cluster_bits;

        if (k < 0 || k >= refcount_table_size) {

            fprintf(stderr, "ERROR: invalid cluster offset=0x%" PRIx64 "\n",

                cluster_offset);

            errors++;

        } else {

            if (++refcount_table[k] == 0) {

                fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64

                    "\n", cluster_offset);

                errors++;

            }

        }

    }



    return errors;

}

static int inc_refcounts(BlockDriverState *bs,     int errors = 0;         return 0;         if (k < 0 || k >= refcount_table_size) {             errors++;                 errors++;     return errors;     int errors = 0;     return errors;     int errors = 0;                 errors++;     return errors;             errors++;             errors++;             errors++;     return errors;
static int FUNC_0(BlockDriverState *VAR_0,

                          uint16_t *VAR_1,

                          int VAR_2,

                          int64_t VAR_3, int64_t VAR_4)

{

    BDRVQcowState *s = VAR_0->opaque;

    int64_t start, last, cluster_offset;

    int VAR_5;

    int VAR_6 = 0;



    if (VAR_4 <= 0)

        return 0;



    start = VAR_3 & ~(s->cluster_size - 1);

    last = (VAR_3 + VAR_4 - 1) & ~(s->cluster_size - 1);

    for(cluster_offset = start; cluster_offset <= last;

        cluster_offset += s->cluster_size) {

        VAR_5 = cluster_offset >> s->cluster_bits;

        if (VAR_5 < 0 || VAR_5 >= VAR_2) {

            fprintf(stderr, "ERROR: invalid cluster VAR_3=0x%" PRIx64 "\n",

                cluster_offset);

            VAR_6++;

        } else {

            if (++VAR_1[VAR_5] == 0) {

                fprintf(stderr, "ERROR: overflow cluster VAR_3=0x%" PRIx64

                    "\n", cluster_offset);

                VAR_6++;

            }

        }

    }



    return VAR_6;

}

static int FUNC_0(BlockDriverState *VAR_0,
uint16_t *VAR_1,
int VAR_2,
int64_t VAR_3, int64_t VAR_4)
{ BDRVQcowState *s = VAR_0->opaque; int64_t start, last, cluster_offset; int VAR_5; int VAR_6 = 0; if (VAR_4 <= 0)
return 0; start = VAR_3 & ~(s->cluster_size - 1); last = (VAR_3 + VAR_4 - 1) & ~(s->cluster_size - 1); for(cluster_offset = start; cluster_offset <= last; cluster_offset += s->cluster_size) { VAR_5 = cluster_offset >> s->cluster_bits; if (VAR_5 < 0 || VAR_5 >= VAR_2) { fprintf(stderr, "ERROR: invalid cluster VAR_3=0x%" PRIx64 "\n",
cluster_offset); VAR_6++; } else { if (++VAR_1[VAR_5] == 0) { fprintf(stderr, "ERROR: overflow cluster VAR_3=0x%" PRIx64
"\n", cluster_offset); VAR_6++; } } } return VAR_6; }