static int map_f(BlockBackend *blk, int argc, char **argv)

{

    int64_t offset;

    int64_t nb_sectors, total_sectors;

    char s1[64];

    int64_t num;

    int ret;

    const char *retstr;



    offset = 0;

    total_sectors = blk_nb_sectors(blk);

    if (total_sectors < 0) {

        error_report("Failed to query image length: %s",

                     strerror(-total_sectors));

        return 0;

    }



    nb_sectors = total_sectors;



    do {

        ret = map_is_allocated(blk_bs(blk), offset, nb_sectors, &num);

        if (ret < 0) {

            error_report("Failed to get allocation status: %s", strerror(-ret));

            return 0;

        } else if (!num) {

            error_report("Unexpected end of image");

            return 0;

        }



        retstr = ret ? "    allocated" : "not allocated";

        cvtstr(offset << 9ULL, s1, sizeof(s1));

        printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s "

               "at offset %s (%d)\n",

               offset << 9ULL, num, nb_sectors, retstr, s1, ret);



        offset += num;

        nb_sectors -= num;

    } while (offset < total_sectors);



    return 0;

}

static int map_f(BlockBackend *blk, int argc, char **argv)

{

    int64_t offset;

    int64_t nb_sectors, total_sectors;

    char s1[64];

    int64_t num;

    int ret;

    const char *retstr;



    offset = 0;

    total_sectors = blk_nb_sectors(blk);

    if (total_sectors < 0) {

        error_report("Failed to query image length: %s",

                     strerror(-total_sectors));

        return 0;

    }



    nb_sectors = total_sectors;



    do {

        ret = map_is_allocated(blk_bs(blk), offset, nb_sectors, &num);

        if (ret < 0) {

            error_report("Failed to get allocation status: %s", strerror(-ret));

            return 0;

        } else if (!num) {

            error_report("Unexpected end of image");

            return 0;

        }



        retstr = ret ? "    allocated" : "not allocated";

        cvtstr(offset << 9ULL, s1, sizeof(s1));

        printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s "

               "at offset %s (%d)\n",

               offset << 9ULL, num, nb_sectors, retstr, s1, ret);



        offset += num;

        nb_sectors -= num;

    } while (offset < total_sectors);



    return 0;

}

static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)

{

    int64_t offset;

    int64_t nb_sectors, total_sectors;

    char VAR_3[64];

    int64_t num;

    int VAR_4;

    const char *VAR_5;



    offset = 0;

    total_sectors = blk_nb_sectors(VAR_0);

    if (total_sectors < 0) {

        error_report("Failed to query image length: %s",

                     strerror(-total_sectors));

        return 0;

    }



    nb_sectors = total_sectors;



    do {

        VAR_4 = map_is_allocated(blk_bs(VAR_0), offset, nb_sectors, &num);

        if (VAR_4 < 0) {

            error_report("Failed to get allocation status: %s", strerror(-VAR_4));

            return 0;

        } else if (!num) {

            error_report("Unexpected end of image");

            return 0;

        }



        VAR_5 = VAR_4 ? "    allocated" : "not allocated";

        cvtstr(offset << 9ULL, VAR_3, sizeof(VAR_3));

        printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s "

               "at offset %s (%d)\n",

               offset << 9ULL, num, nb_sectors, VAR_5, VAR_3, VAR_4);



        offset += num;

        nb_sectors -= num;

    } while (offset < total_sectors);



    return 0;

}

static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)
{ int64_t offset; int64_t nb_sectors, total_sectors; char VAR_3[64]; int64_t num; int VAR_4; const char *VAR_5; offset = 0; total_sectors = blk_nb_sectors(VAR_0); if (total_sectors < 0) { error_report("Failed to query image length: %s",
strerror(-total_sectors)); return 0; } nb_sectors = total_sectors; do { VAR_4 = map_is_allocated(blk_bs(VAR_0), offset, nb_sectors, &num); if (VAR_4 < 0) { error_report("Failed to get allocation status: %s", strerror(-VAR_4)); return 0; } else if (!num) { error_report("Unexpected end of image"); return 0; } VAR_5 = VAR_4 ? "    allocated" : "not allocated"; cvtstr(offset << 9ULL, VAR_3, sizeof(VAR_3)); printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s "
"at offset %s (%d)\n",
offset << 9ULL, num, nb_sectors, VAR_5, VAR_3, VAR_4); offset += num; nb_sectors -= num; } while (offset < total_sectors); return 0; }