static int cloop_read(BlockDriverState *bs, int64_t sector_num,

                    uint8_t *buf, int nb_sectors)

{

    BDRVCloopState *s = bs->opaque;

    int i;



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

        uint32_t sector_offset_in_block =

            ((sector_num + i) % s->sectors_per_block),

            block_num = (sector_num + i) / s->sectors_per_block;

        if (cloop_read_block(bs, block_num) != 0) {

            return -1;

        }

        memcpy(buf + i * 512,

            s->uncompressed_block + sector_offset_in_block * 512, 512);

    }

    return 0;

}

static int cloop_read(BlockDriverState *bs, int64_t sector_num,

                    uint8_t *buf, int nb_sectors)

{

    BDRVCloopState *s = bs->opaque;

    int i;



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

        uint32_t sector_offset_in_block =

            ((sector_num + i) % s->sectors_per_block),

            block_num = (sector_num + i) / s->sectors_per_block;

        if (cloop_read_block(bs, block_num) != 0) {

            return -1;

        }

        memcpy(buf + i * 512,

            s->uncompressed_block + sector_offset_in_block * 512, 512);

    }

    return 0;

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,

                    uint8_t *VAR_2, int VAR_3)

{

    BDRVCloopState *s = VAR_0->opaque;

    int VAR_4;



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

        uint32_t sector_offset_in_block =

            ((VAR_1 + VAR_4) % s->sectors_per_block),

            block_num = (VAR_1 + VAR_4) / s->sectors_per_block;

        if (cloop_read_block(VAR_0, block_num) != 0) {

            return -1;

        }

        memcpy(VAR_2 + VAR_4 * 512,

            s->uncompressed_block + sector_offset_in_block * 512, 512);

    }

    return 0;

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
uint8_t *VAR_2, int VAR_3)
{ BDRVCloopState *s = VAR_0->opaque; int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { uint32_t sector_offset_in_block =
((VAR_1 + VAR_4) % s->sectors_per_block),
block_num = (VAR_1 + VAR_4) / s->sectors_per_block; if (cloop_read_block(VAR_0, block_num) != 0) { return -1; } memcpy(VAR_2 + VAR_4 * 512,
s->uncompressed_block + sector_offset_in_block * 512, 512); } return 0; }