static int alloc_f(int argc, char **argv)

{

    int64_t offset;

    int nb_sectors, remaining;

    char s1[64];

    int num, sum_alloc;

    int ret;



    offset = cvtnum(argv[1]);

    if (offset & 0x1ff) {

        printf("offset %" PRId64 " is not sector aligned\n",

               offset);

        return 0;

    }



    if (argc == 3) {

        nb_sectors = cvtnum(argv[2]);

    } else {

        nb_sectors = 1;

    }



    remaining = nb_sectors;

    sum_alloc = 0;

    while (remaining) {

        ret = bdrv_is_allocated(bs, offset >> 9, nb_sectors, &num);

        remaining -= num;

        if (ret) {

            sum_alloc += num;

        }

    }



    cvtstr(offset, s1, sizeof(s1));



    printf("%d/%d sectors allocated at offset %s\n",

           sum_alloc, nb_sectors, s1);

    return 0;

}

static int alloc_f(int argc, char **argv)

{

    int64_t offset;

    int nb_sectors, remaining;

    char s1[64];

    int num, sum_alloc;

    int ret;



    offset = cvtnum(argv[1]);

    if (offset & 0x1ff) {

        printf("offset %" PRId64 " is not sector aligned\n",

               offset);

        return 0;

    }



    if (argc == 3) {

        nb_sectors = cvtnum(argv[2]);

    } else {

        nb_sectors = 1;

    }



    remaining = nb_sectors;

    sum_alloc = 0;

    while (remaining) {

        ret = bdrv_is_allocated(bs, offset >> 9, nb_sectors, &num);

        remaining -= num;

        if (ret) {

            sum_alloc += num;

        }

    }



    cvtstr(offset, s1, sizeof(s1));



    printf("%d/%d sectors allocated at offset %s\n",

           sum_alloc, nb_sectors, s1);

    return 0;

}

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

{

    int64_t offset;

    int VAR_2, VAR_3;

    char VAR_4[64];

    int VAR_5, VAR_6;

    int VAR_7;



    offset = cvtnum(VAR_1[1]);

    if (offset & 0x1ff) {

        printf("offset %" PRId64 " is not sector aligned\n",

               offset);

        return 0;

    }



    if (VAR_0 == 3) {

        VAR_2 = cvtnum(VAR_1[2]);

    } else {

        VAR_2 = 1;

    }



    VAR_3 = VAR_2;

    VAR_6 = 0;

    while (VAR_3) {

        VAR_7 = bdrv_is_allocated(bs, offset >> 9, VAR_2, &VAR_5);

        VAR_3 -= VAR_5;

        if (VAR_7) {

            VAR_6 += VAR_5;

        }

    }



    cvtstr(offset, VAR_4, sizeof(VAR_4));



    printf("%d/%d sectors allocated at offset %s\n",

           VAR_6, VAR_2, VAR_4);

    return 0;

}

static int FUNC_0(int VAR_0, char **VAR_1)
{ int64_t offset; int VAR_2, VAR_3; char VAR_4[64]; int VAR_5, VAR_6; int VAR_7; offset = cvtnum(VAR_1[1]); if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n",
offset); return 0; } if (VAR_0 == 3) { VAR_2 = cvtnum(VAR_1[2]); } else { VAR_2 = 1; } VAR_3 = VAR_2; VAR_6 = 0; while (VAR_3) { VAR_7 = bdrv_is_allocated(bs, offset >> 9, VAR_2, &VAR_5); VAR_3 -= VAR_5; if (VAR_7) { VAR_6 += VAR_5; } } cvtstr(offset, VAR_4, sizeof(VAR_4)); printf("%d/%d sectors allocated at offset %s\n",
VAR_6, VAR_2, VAR_4); return 0; }